Linux
帶連結的預設路由
如果 enp0s18 上沒有連結,我有
root@route:~# ip r default via a.a.a.1 dev enp0s18 metric 10 linkdown default via a.a.b.1 dev enp0s10 metric 20 onlink linkdown default via x.x.x.49 dev wwx001e101f0000 metric 30
預計預設切換為 xxx49,但它會嘗試
linkdown
路由root@route:~# ping -n ya.ru PING ya.ru (87.250.250.242) 56(84) bytes of data. From a.a.a.231 icmp_seq=1 Destination Host Unreachable From a.a.a.231 icmp_seq=2 Destination Host Unreachable From a.a.a.231 icmp_seq=3 Destination Host Unreachable ^C
連結狀態
4: enp0s10: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000 link/ether 1c:af:f7:08:27:e2 brd ff:ff:ff:ff:ff:ff 5: enp0s18: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000 link/ether 00:13:d3:14:83:f1 brd ff:ff:ff:ff:ff:ff
結果:交通黑洞
在新核心中,我們有新的預設值。解決方案是
echo 1 > /proc/sys/net/ipv4/conf/enp0s10/ignore_routes_with_linkdown echo 1 > /proc/sys/net/ipv4/conf/enp0s18/ignore_routes_with_linkdown
並設置新的預設值
echo net.ipv4.conf.all.ignore_routes_with_linkdown=1 > /etc/sysctl.d/10-linkdown.conf sysctl -p /etc/sysctl.d/10-linkdown.conf
我也面臨同樣的“非活動連結”問題
而且我的開發板中沒有
/etc/sysctl.d/10-linkdown.conf
文件。所以我嘗試了解決方案“
echo 1 > /proc/...../ignore_routes_with_linkdown
”下一次檢查 ip route show 會給出“dead inactive linkdown”。
有什麼意見/建議嗎?