红联Linux门户
Linux帮助

debian服务器上不了网,缺少默认网关

发布时间:2016-06-03 15:32:07来源:linux网站作者:hbg-rohens

debian服务器上不了网,缺少默认网关:

root@hbg:/# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth2
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1


添加网关

root@hbg:/# route add default gw 192.168.1.1

上网网段为192.168.1.X网段。


添加后查询路由表信息如下:

root@hbg:/# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0             UG    0      0        0    eth2
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0     eth2
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0     eth1


本文永久更新地址:http://www.linuxdiyf.com/linux/21212.html