2011-01-11

android: How to see the routing table and dns in adb shell


For checking DNS server addresses, you can use getprop, such
as:
| # getprop net.dns1
| 192.168.32.18
or, if you'd like to know the values which dhcp server
offers:
| # getprop dhcp.tiwlan0.dns1
| 192.168.32.18
You also can see dhcp supply default gateway value:
| # getprop dhcp.tiwlan0.gateway
| 192.168.32.1
You might see all property values if you exec 'getprop'
without arguments.
If you'd like to see live routing table, the easiest(but
complicated to understand) way is to see /proc/net/route.
| # cat /proc/net/route
| Iface Destination     Gateway         Flags   RefCnt  Use     Metric  Mask            MTU     Window  IRTT
| tiwlan0       0020A8C0        00000000        0001    0       0       0       00FFFFFF        0       0       0
| tiwlan0       00000000        0120A8C0        0003    0       0       0       00000000        0       0       0
The Destination '00000000' means, of course, default route
and Gateway value '0120A8C0' means '1.32.168.192' in
decimal('192.168.32.1' in reverse), so you can know what is
default gateway address is.




댓글 없음:

댓글 쓰기