107

I would like to know what IP-address my Android phone has. E.g. if I use my phone over WiFi, how can I get the local IP-address that is assigned to my phone?

1
  • The4G-IP can be found under Settings->System->About Phone->IP address
    – arved
    Nov 26, 2019 at 7:47

5 Answers 5

123

The easy way is to go to your WiFi Settings, and hit Menu > Advanced. It'll show up there, or you can set it to a static IP if you want.

The cool way is to dial *#*#4636#*#* to open the Testing menu. Then click WiFi information, then WiFi Status.

3
  • 2
    When I call ##4636## I get this message: Connection problem or invalid MMI code. And in the WiFi Settings advanced menu, I can not see the IP-address if it is set by DHCP. But thanks for that menu, I didn't know about it.
    – Jonas
    Nov 19, 2010 at 17:58
  • Haha, sorry about that, yeah apparently an asterisk resolves to an italic pound sign? So you can't actually see your DHCP address in your WiFi Settings? I'm running Cyanogenmod and I can see mine towards the bottom of the menu. Didn't know that wasn't a standard feature. :O Nov 19, 2010 at 18:03
  • No, there is no IP-address there on my Nexus One with Android 2.2. but the Testing meny was very good.
    – Jonas
    Nov 19, 2010 at 18:07
13

ifconfig and ip Android 7

adb shell ifconfig
adb shell ip address show

ifconfig was an annoying implementation that did not show all versions by default on earlier versions as explained below, but now it works fine.

netcfg Android 5.1.1

This tool was removed in later Android, and ifconfig was made more decent and shows all interfaces by default, thus rendering this method useless on newer versions.

adb shell netcfg | grep wlan0

from your desktop is the best option if you're already developing for Android and have adb and an USB connection setup.

Sample output:

wlan0 UP 192.168.0.3/24 [...]

Confirm with:

adb shell ifconfig wlan0

ifconfig on Android (home-brewed?) is different from the one on desktops (net-tools package on Ubuntu 15.10) as it requires the interface to be given.

This is also mentioned at: Is there a command or application similar to ipconfig?

You could also install a terminal emulator like Teriminal Emulator from Jack Palevich, open it and type: netcfg. But in that case you'd be better off with some app that shows the IPs, since typing on devices is a pain (unless you've got an external keyboard...).

If all you want it so SSH into the device, adb shell is the way to go: https://stackoverflow.com/a/34040560/895245

If you are developing a server app, the most user-friendly thing to do would be to show the device's IPs on some TextView, which has a pure-Java method: https://stackoverflow.com/questions/494465 | https://stackoverflow.com/questions/6064510/how-to-get-ip-address-of-the-device

Router browser management

If you are at home, you can:

  • connect your desktop to the router with an Ethernet cable
  • access some magic vendor dependent address, often http://192.168.0.1
  • most vendors have a list of device IPs somewhere in there

nmap

If your device is running a server, e.g. SSHD on port 2222 as explained at: https://stackoverflow.com/a/34040560/895245, you can portscan it:

sudo nmap -sV --open 192.168.0.0/24 -p2222
1
  • Works on Android 4.2.1 as well.
    – Firelord
    Dec 2, 2015 at 11:08
9

The easiest way is using a tool like e.g. OS Monitor, which shows you (amongst others) also a lot of network details:

OS Monitor
OS Monitor showing network interface details (source: Google Play; click image to enlarge)

As the screenshot shows, this app reveals for each network interface:

  • interface name¹
  • IPv4 IP address assigned (if 0.0.0.0, this interface is currently unused)
  • IPv6 address (if available)
  • MAC address
  • packet statistics (i.e. transfered data)
  • a status

¹ interface names might be handled differently on different devices. But in most cases you can tell from the IP where it belongs to. Furthermore, rmnet is mostly used for GPRS (mobile data), while WiFi uses names like tiwlan or eth.

1

In any terminal emulator app:

~$ ip -o a

Applicable both to WiFi and Mobile Data. Doesn't require root.

0

This is an old question but I think you can try this command:

adb shell ip addr show rmnet0  | grep 'inet ' | cut -d ' ' -f 6 | cut -d / -f 1

It will return your IPV4 assigned by the operator

172.22.1.215

Note:

Usually, your phone has two networks one by your telcom operator and the other from your wireless interface. These are called network interfaces.

rmnet0 should be replaced with your interface my case was rmnet0 usually is eth0.

If u want to get the list of interfaces use this command:

ip link show

You will get something like this:

1: lo:  mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0:  mtu 1500 qdisc mq state UP qlen 1000
    link/ether b8:ac:6f:65:31:e5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.5/24 brd 192.168.1.255 scope global eth0
    inet6 fe80::baac:6fff:fe65:31e5/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0:  mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:21:6a:ca:9b:10 brd ff:ff:ff:ff:ff:ff
4: pan0:  mtu 1500 qdisc noop state DOWN 
    link/ether 92:0a:e7:31:e0:83 brd ff:ff:ff:ff:ff:ff
5: vmnet1:  mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:50:56:c0:00:01 brd ff:ff:ff:ff:ff:ff
    inet 192.168.121.1/24 brd 192.168.121.255 scope global vmnet1
    inet6 fe80::250:56ff:fec0:1/64 scope link 
       valid_lft forever preferred_lft forever
6: vmnet8:  mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:50:56:c0:00:08 brd ff:ff:ff:ff:ff:ff
    inet 192.168.179.1/24 brd 192.168.179.255 scope global vmnet8
    inet6 fe80::250:56ff:fec0:8/64 scope link 
       valid_lft forever preferred_lft forever

Where usually,

  • lo – Loopback interface.
  • eth0 – Your first Ethernet network interface on Linux.
  • wlan0 – Wireless network interface in Linux.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .