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?
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.
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.
wlan0 UP 192.168.0.3/24 [...]
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
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
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 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
In any terminal emulator app:
~$ ip -o a
Applicable both to WiFi and Mobile Data. Doesn't require root.