来源:http://blog.csdn.net/duyiwuer2009/article/details/26263855
1. ip route show
[html] view plain copy
- $ 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 网关地址为 192.168.217.2
2. route -n or netstat -rn
[html] view plain copy
- $ 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 100 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 网关地址为 192.168.217.2
3. traceroute www.baidu.com
[html] view plain copy
- $ traceroute www.baidu.com
- traceroute to www.baidu.com (119.75.218.77), 30 hops max, 60 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 * * *
第一跳的地址就是网关地址
时间: 2024-11-10 01:14:56