Command "ip route del default" is not able remove default-route

  • Hello,

    i hit and observed this problem when i try to run openvpn client.

    I have observerd an issue when openvpn client (startup-script) try to remove the default-route from a routing table. Later i tried it manually with the following commands, see bellow. The goal was to remove a default-route from the routing table, which did not happen. The IP address of LAN is configured in manual mode as 192.168.211.130/24, gateway 192.168.211.2.

    LibreELEC:/usr/sbin # ip route

    default via 192.168.211.2 dev eth0

    10.45.0.0/24 dev tun0 scope link src 10.45.0.2

    192.168.211.0/24 dev eth0 scope link src 192.168.211.130

    192.168.211.2 dev eth0 scope link

    195.20.170.27 via 192.168.211.2 dev eth0

    >> default-route goes via 192.168.211.2

    >> ATTEMPT #1: here i will try to remove default-route from routing table:

    LibreELEC:/usr/sbin # ip route del default

    LibreELEC:/usr/sbin # ip route

    default via 192.168.211.2 dev eth0

    10.45.0.0/24 dev tun0 scope link src 10.45.0.2

    192.168.211.0/24 dev eth0 scope link src 192.168.211.130

    192.168.211.2 dev eth0 scope link

    195.20.170.27 via 192.168.211.2 dev eth0

    >> default-route has not been removed from the routing table, it is still there !!!

    >> ATTEMPT #2:

    LibreELEC:/usr/sbin # ip route del default via 192.168.211.2 dev eth0

    LibreELEC:/usr/sbin # ip route

    default via 192.168.211.2 dev eth0

    10.45.0.0/24 dev tun0 scope link src 10.45.0.2

    192.168.211.0/24 dev eth0 scope link src 192.168.211.130

    192.168.211.2 dev eth0 scope link

    195.20.170.27 via 192.168.211.2 dev eth0

    >> default-route has not been removed from the routing table, it is still there !!! Why???

    IP commnad is implemented with busybox utility (/usr/bin/busybox ip)

    LibreELEC:~ # busybox

    BusyBox v1.31.0 (2019-11-22 22:56:17 EST) multi-call binary.


    LibreElec Kodi 18.5 Git: 18.5-Leia

    Compiled: 2019-11-23

    Tested images: Virtual image (for Vmware), image for Odroid-C2

    Edited once, last by mbedy (January 28, 2020 at 1:21 PM).

  • I'd guess that ConnMan wants to have a deafult route and will add one back if it detects it's missing. If you put connman in debug mode stop the service and restart manually with -d in the command and tail the journal you'll probably observe that behaviour.

    I'm no expert on routing things, but can you change the route instead of delete it? .. and what's the purpose of deleting it?

  • Problem is with OpenVPN deamon which tries to modify the routing table when establishing new VPN, see here:

    # /run/openvpn.log

    ...

    Tue Jan 28 15:54:02 2020 /sbin/ip route add 195.20.170.27/32 via 192.168.211.2

    Tue Jan 28 15:54:02 2020 /sbin/ip route del 0.0.0.0/0

    Tue Jan 28 15:54:02 2020 /sbin/ip route add 0.0.0.0/0 via 10.45.0.1

    ip: RTNETLINK answers: File exists

    Tue Jan 28 15:54:02 2020 ERROR: Linux route add command failed: external program exited with error status: 2


    OpenVPN is not able to install a new defailt-route (via VPN tunnel) because the previous one has not been removed from the routeing table. When it tries to install a new default-route, it fails with an error.

  • How can i add permanent metric ?

    I added metric 1 over ssh by this command:

    Code
    ip route add 192.168.1.0/24 dev wlan0 scope link src 192.168.1.11 metric 1

    but after reboot the settings are at default.

  • /storage/.config/autostart.sh is run at userspace boot, so (sleep 10 && background the commands)& that you want to run and put them there, or create a systemd .service file in /storage/.config/system.d/routes.service with the commands you want, with dependencies on connman so the network is up before the commands are applied. LE has non-standard packaging - you cannot apply persistent network config, but there are ways to persistently (re)apply config.