Source: http://blog.csdn.net/duyiwuer2009/article/details/26263855
1. IP Route Show
[HTML]View PlainCopy
- $ IP Route Show
- Default via 192.168.217.2 Dev eth0 metric 100
- 192.168.122.0/24 Dev virbr0 proto kernel scope link src 192.168.122.1
- 192.168.217.0/24 Dev eth0 proto kernel scope link src 192.168.217.129
Eth0 Gateway address is 192.168.217.2
2. Route-n or Netstat-rn
[HTML]View PlainCopy
- $ route-n
- Kernel IP Routing Table
- Destination Gateway genmask Flags Metric Ref use Iface
- 0.0.0.0 192.168.217.2 0.0.0.0 UG 0 0 eth0
- 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
- 192.168.217.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Eth0 Gateway address is 192.168.217.2
3. Traceroute www.baidu.com
[HTML]View PlainCopy
- $ traceroute www.baidu.com
- Traceroute to Www.baidu.com (119.75.218.77), hops max, byte packets
- 1 localhost (192.168.217.2) 0.607 ms 0.546 ms 1.379 ms
- 2 * * *
- 3 * * *
- 4 * * *
- 5 * * *
- 6 * * *
- 7 * * *
- 8 * * *
- 9 * * *
- 10 * * *
The first hop address is the gateway address
Ubuntu 12.04 LTS View Gateway address method Summary