您的位置:首页 > 运维架构 > Linux

八月考核:如何查看Linux的默认网关

2018-09-07 22:56 465 查看
一:如何查看Linux的默认网关

1.如果固定IP上网,cat /etc/sysconfig/network里面gateway项

2.如果是dhcp上网,使用route命令,default那一行就是网关了
[root@hello ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.1.1.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 255.255.0.0 U 0 0 0 eth0
default 192.1.1.1 0.0.0.0 UG 0 0 0 eth0

3.也可以用netstat命令查看
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  asdf