Routing 从PPP连接返回后没有默认路由

Routing 从PPP连接返回后没有默认路由,routing,archlinux,pppd,Routing,Archlinux,Pppd,我现在在一个Arch Linux机箱上,通过3G U盘(ttyUSB0)可以使用ETH0(固定IP)和PPP连接。重新启动后,ETH0工作正常。建立PPP连接也很好。但在使用“poff”取消PPP连接后,我再也没有得到默认路由。我知道如何手动设置默认路由,但由于linux设备将在各种网络中注册,我必须找到一个在使用PPP连接后自动获取默认路由的过程 ETH0是在/etc/conf.d/net-conf-ETH0中配置的: address = 10.0.1.30 netmask = 24

我现在在一个Arch Linux机箱上,通过3G U盘(ttyUSB0)可以使用ETH0(固定IP)和PPP连接。重新启动后,ETH0工作正常。建立PPP连接也很好。但在使用“poff”取消PPP连接后,我再也没有得到默认路由。我知道如何手动设置默认路由,但由于linux设备将在各种网络中注册,我必须找到一个在使用PPP连接后自动获取默认路由的过程

ETH0是在/etc/conf.d/net-conf-ETH0中配置的:

address   = 10.0.1.30
netmask   = 24
broadcast = 10.0.1.255
gateway   = 10.0.1.1
PPP是使用

pacman -S ppp
。。。以及以下配置文件:

/etc/ppp/ip预升级

#!/bin/sh
/usr/bin/route del default
/etc/ppp/移动选项

ttyUSB0
921600
lock
crtscts
modem
passive
novj
defaultroute
noipdefault
usepeerdns
noauth
hide-password
persist
holdoff 10
maxfail 0
debug
PPP连接之前的路由表

# route
Kernel IP routing table
Destination     Gateway        Genmask         Flags Metric Ref    Use Iface
default         router.intern  0.0.0.0         UG    0      0        0 eth0
default         router.intern  0.0.0.0         UG    1024   0        0 eth0
10.0.1.0       *               255.255.255.0   U     0      0        0 eth0
router.intern  *               255.255.255.255 UH    1024   0        0 eth0
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.1.0        *               255.255.255.0   U     0      0        0 eth0
router.intern   *               255.255.255.255 UH    1024   0        0 eth0
成功PPP连接后的路由表

# route
Kernel IP routing table
Destination     Gateway        Genmask         Flags Metric Ref    Use Iface
default         router.intern  0.0.0.0         UG    0      0        0 eth0
default         router.intern  0.0.0.0         UG    1024   0        0 eth0
10.0.1.0       *               255.255.255.0   U     0      0        0 eth0
router.intern  *               255.255.255.255 UH    1024   0        0 eth0
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.1.0        *               255.255.255.0   U     0      0        0 eth0
router.intern   *               255.255.255.255 UH    1024   0        0 eth0

我遗漏了什么?

回答我自己的问题:/etc/ppp/ip down是线索。(我试图在/etc/ppp/ip-down.d/中放置一个脚本,但有时无法执行。ip-down过早地从pppd中获取SIGTERM。)因此我修改了/etc/ppp/ip-down:

!/bin/sh
#
# This script is run by pppd after the connection has ended.
#

ETH_Gateway=$(/usr/bin/cat /etc/conf.d/net-conf-eth0 | /usr/bin/grep 'gateway' | /usr/bin/grep -oE '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+')
/usr/bin/route del default
/usr/bin/ip route add default via $ETH_Gateway

# Execute all scripts in /etc/ppp/ip-down.d/
for ipdown in /etc/ppp/ip-down.d/*.sh; do
  if [ -x $ipdown ]; then
    # Parameters: interface-name tty-device speed local-IP-address remote-IP-address ipparam
    $ipdown "$@"
  fi
done