default route with linkdown

11,717

In new kernel we have new defaults. Solution is

echo 1 > /proc/sys/net/ipv4/conf/enp0s10/ignore_routes_with_linkdown
echo 1 > /proc/sys/net/ipv4/conf/enp0s18/ignore_routes_with_linkdown

And make new default

echo net.ipv4.conf.all.ignore_routes_with_linkdown=1 > /etc/sysctl.d/10-linkdown.conf
sysctl -p /etc/sysctl.d/10-linkdown.conf
Share:
11,717

Related videos on Youtube

eri
Author by

eri

Updated on September 18, 2022

Comments

  • eri
    eri over 1 year

    If no link on enp0s18 i have

    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 
    

    Expected that default swiches to x.x.x.49, but it tries linkdown route

    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
    

    Link state

    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
    

    Result: Traffic black-holed

  • eri
    eri over 5 years
    Create this file. If you have no /etc/sysctl.d/ dir - append this "net.ipv4.conf.all.ignore_routes_with_linkdown=1" to /etc/sysctl.conf
  • Nikita
    Nikita over 5 years
    But there is no /etc/sysctl.conf as well
  • eri
    eri over 5 years
    create it. look to dmesg to check
  • AJ Smith 'Smugger'
    AJ Smith 'Smugger' over 3 years
    Why have you not accepted your own answer? It does work...