102

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?

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

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.

  • 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 '10 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 – kcoppock Nov 19 '10 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 '10 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
  • Works on Android 4.2.1 as well. – Firelord Dec 2 '15 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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.