linux下GPRS ppp拨号默认路由问题(存在eth0)

问题描述:(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
相关文章
相关标签/搜索