問題描述:(linux版本是Linux 2.6.33-rc4,)html
第一種狀況: eth0:192.168.1.2 eth0 gw:192.168.1.1 ppp0:10.0.0.1 eth0的IP地址和gw在同一個網段下,此時的默認路由是 Destination Gateway Genmask Flags Metric Ref Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 eth0 此時ppp0沒法聯網。 第二種狀況: eth0:192.168.1.2 eth0 gw:192.168.3.1 ppp0:10.0.0.1 eth0的IP地址和gw不在同一個網段下,此時的默認路由是 Destination Gateway Genmask Flags Metric Ref Iface 0.0.0.0 10.0.0.254 0.0.0.0 UG 0 0 ppp0 此時ppp0能夠聯網
解決方案:linux
一、在撥號前將默認路由刪除(若是已經存在默認路由,pppd撥號是不會修改這個的,具體解釋見How to hook up PPP in Linux的no default route)。 二、將ppp0設置爲默認路由。 先刪除原來路由,route del default 再將ppp0設置爲默認路由,route add default dev ppp0
參考資料:.net
一、https://blog.csdn.net/zhang_danf/article/details/48138037 二、http://linux-sxs.org/networking/pppunruh.html#NoDefault 三、https://blog.csdn.net/chenliang0224/article/details/72758640