带有 linkdown 的默认路由

带有 linkdown 的默认路由

如果 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

结果:交通黑洞

答案1

在新内核中,我们有新的默认值。解决办法是

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

答案2

我也面临同样的问题“inactive linkdown”

/etc/sysctl.d/10-linkdown.conf而且我的开发板上没有文件。

所以我尝试了解决方案“ echo 1 > /proc/...../ignore_routes_with_linkdown

接下来检查 ip 路由显示会给出“dead inactive linkdown”。

有什么意见/建议吗?

相关内容