使用 systemd 在启动时在 VLAN 上启动 ppp

使用 systemd 在启动时在 VLAN 上启动 ppp

我正在用 Linux 机器替换我的消费级路由器/AP。我的消费级路由器通过标记 VLAN 上的 PPPoE 链路拨入我的 ISP。我配置了一个ppp使用标记设备的工作设置enp7s0.201,它运行良好,直到我重新启动。重新启动时,ppp在创建 VLAN 设备之前出现,然后立即死机。

[me@router ~]$ sudo journalctl -b | egrep 'ppp|enp7s0'
Feb 11 03:01:22 router kernel: r8169 0000:07:00.0 enp7s0: renamed from eth0
Feb 11 03:01:23 router systemd[1]: [email protected]: Unit is bound to inactive unit sys-subsystem-net-devices-enp7s0.201.device. Stopping, too.
Feb 11 03:01:23 router systemd-networkd[444]: /etc/systemd/network/enp7s0.201.netdev:5: Unknown section 'VLAN'. Ignoring.
Feb 11 03:01:25 router systemd-networkd[444]: enp7s0.201: netdev ready
Feb 11 03:01:25 router systemd-networkd[444]: enp7s0: IPv6 successfully enabled
Feb 11 03:01:25 router kernel: r8169 0000:07:00.0 enp7s0: link down
Feb 11 03:01:25 router kernel: r8169 0000:07:00.0 enp7s0: link down
Feb 11 03:01:25 router kernel: IPv6: ADDRCONF(NETDEV_UP): enp7s0: link is not ready
Feb 11 03:01:25 router systemd-networkd[444]: enp7s0.201: IPv6 successfully enabled
Feb 11 03:01:25 router systemd-networkd[444]: enp7s0: Gained carrier
Feb 11 03:01:25 router systemd-networkd[444]: enp7s0.201: Gained carrier
Feb 11 03:01:25 router systemd-networkd[444]: enp7s0.201: Lost carrier
Feb 11 03:01:26 router systemd-networkd[444]: enp7s0: Lost carrier
Feb 11 03:01:27 router systemd-networkd[444]: enp7s0.201: Gained IPv6LL
Feb 11 03:01:27 router systemd-networkd[444]: enp7s0: Gained carrier
Feb 11 03:01:27 router kernel: r8169 0000:07:00.0 enp7s0: link up
Feb 11 03:01:27 router kernel: IPv6: ADDRCONF(NETDEV_CHANGE): enp7s0: link becomes ready
Feb 11 03:01:27 router systemd-networkd[444]: enp7s0.201: Gained carrier
Feb 11 03:01:29 router systemd-networkd[444]: enp7s0: Gained IPv6LL
Feb 11 03:01:32 router systemd-networkd[444]: enp7s0: Lost carrier
Feb 11 03:01:32 router kernel: r8169 0000:07:00.0 enp7s0: link down
Feb 11 03:01:32 router systemd-networkd[444]: enp7s0.201: Lost carrier
Feb 11 03:01:35 router systemd-networkd[444]: enp7s0: Gained carrier
Feb 11 03:01:35 router kernel: r8169 0000:07:00.0 enp7s0: link up
Feb 11 03:01:35 router systemd-networkd[444]: enp7s0.201: Gained carrier

Before=network.target[email protected]文件中删除了一个,并添加了一个插件BindsTo=sys-subsystem-net-devices-enp7s0.201.device

[me@router ~]$ sudo systemctl cat ppp@centurylink
[sudo] password for me: 
# /usr/lib/systemd/system/[email protected]
[Unit]
Description=PPP link to %I
#Before=network.target

[Service]
ExecStart=/usr/sbin/pppd call %I nodetach nolog

[Install]
WantedBy=multi-user.target

# /etc/systemd/system/[email protected]/port-bind.conf
[Unit]
BindsTo=sys-subsystem-net-devices-enp7s0.201.device

然而,查看pppd启动期间的运行位置,它仍然远早于enp7s0.201可用时间。


编辑:我是个白痴。我忘了我也需要一个After=sys-subsystem-net-devices-enp7s0.201.device插件。

相关内容