Sep 20, 2018

How to delete a route from Linux routing table

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eno1
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eno1
0.0.0.0         192.168.1.1     0.0.0.0         UG    101    0        0 eno2
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.29.0.0      192.168.0.1     255.255.0.0     UG    0      0        0 eno1
172.30.0.0      192.168.0.1     255.255.0.0     UG    0      0        0 eno1
192.168.0.0     0.0.0.0         255.255.254.0   U     100    0        0 eno1
192.168.0.0     0.0.0.0         255.255.254.0   U     101    0        0 eno2
$ sudo route del -net 0.0.0.0 gw 192.168.1.1 netmask 0.0.0.0 dev eno2
$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eno1
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eno1
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.29.0.0      192.168.0.1     255.255.0.0     UG    0      0        0 eno1
172.30.0.0      192.168.0.1     255.255.0.0     UG    0      0        0 eno1
192.168.0.0     0.0.0.0         255.255.254.0   U     100    0        0 eno1
192.168.0.0     0.0.0.0         255.255.254.0   U     101    0        0 eno2