我有 2 个网络接口:
enp2s0
默认以太网metric 1
- 手机
enx0
默认metric 2
当以太网出现故障时,指标会发生相反的变化,我收到的系统通知如下:
systemd-resolved[628]: enp2s0: Bus client set default route setting: no
systemd-resolved[628]: enx0: Bus client set default route setting: yes
当以太网连接恢复时,它会变回:
systemd-resolved[628]: enp2s0: Bus client set default route setting: yes
systemd-resolved[628]: enx0: Bus client set default route setting: no
我有 Ubuntu systemd,并且我有自己编写的脚本来通过公共信使之一发送任何通知,所以在我的情况下会有 2 种情况:
send_messenger.sh "me" "the traffic is routed through 4g connection from now, please, be patient"
当以太网关闭且调制解调器启用时send_messenger.sh "me" "ethernet is back, the normal bandwidth is available"
当以太网恢复时。
systemd
当默认路由更改时可能会触发该脚本的服务是什么?或者其中一个网络接口已断开?
谢谢!