Ubuntu 12.04 LTS 查看网关地址方法汇总

1. ip route show

$ 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

$ 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

$ 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  * * *
第一跳的地址就是网关地址



参考资料

Centos/Linux下如何查看网关地址/Gateway地址?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值