我正在使用 debian 8 ,有 eth0 和 wlan0 , eth0 连接内网, wlan0 连接外网,/e/n/interfaces 如下:
allow-hotplug eth0
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
默认的路由表如下:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.17.128.2 0.0.0.0 UG 202 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 303 0 0 wlan0
172.17.128.0 0.0.0.0 255.255.128.0 U 202 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan0
现在的问题是我无法通过 WIFI 来 SSH 到我的主机,因为系统默认回复到 eth0 导致 TCP 连接无法建立
以下是我尝试过的方法:
unset new_routers
post-up route del default dev eth0
把 wlan0 设置 metric 0
都没用
而且我手动删掉 eth0 的默认路由之后,过一会儿自己又回来了……
有没有什么办法可以在系统启动的时候只保留 wlan0 的默认路由呢?