route -n 查看当前网关,发现无线网络没有网关
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.3.1 0.0.0.0 UG 0 0 0 eth0 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 10.10.80.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0 192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
#添加一个 添加的网关和ip在同一个网段:route add default gw 192.168.3.1 dev wlan0 添加的网关和ip不在同一个网段: 1、route add -host 192.168.2.3 dev eth0 2、route add default gw 192.168.2.5 dev eth0
route -n
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.3.1 0.0.0.0 UG 0 0 0 eth0 0.0.0.0 192.168.3.1 0.0.0.0 UG 0 0 0 wlan0 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 10.10.80.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0 192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
|