You can use $this->input->ip_address(); this to get IP Address.

BY Best Interview Question ON 13 Jan 2019