Sunday, 13 April 2014

Useful Android Network Console Commands

When dealing with network connectivity issues on computers the quickest and usually most productive troubleshooting tools involve opening a console and typing a few key but vital commands.

In the same way for Android I have found myself asking why not follow the same tried & tested method. I have found that the same commands exist and are outlined below. With these commands you will soon locate networking issues.

Note : Your device does not required to have root (super user) access as these as standard. You will require a console or network emulator to be installed which can be found free on Google Play.

Netcfg

  • This is really useful to find out what intefaces you have and the current IP's
  • I also find this a quick way to get the MAC address instead of having to navigate through the various Settings screens
  • The following screen shows an example (I have obfuscated my MAC addresses)


Ifconfig

  • This is similar to what you would use on any Linux machine (or ipconfig on Windows)
  • The main thing of note is 'ifconfig' on its own or 'ifconfig -a' will not work you need also to specify an interface 
  • A common example would be for the WiFi interface e.g. 
$ ifconfig wlan0

What are the DNS servers defined as?

  • If internet access is not working correctly you may have DNS issues
  • To check the DNS servers use 
$ getprop net.dns1
$ getprop net.dns2

Routing Table

  • Its important for networking issues to be able to view the routing table

$ show ip route


  •  The following screen shows examples of running the last three commands


Ping

  • The simplest yet very powerful tool is available
  • First ping the local gatway e.g. 192.168.0.1 then try an IP on the Internet  e.g. 8.8.8.8 (Google's Public DNS)



No comments:

Post a Comment