This turns out to be harder than I thought. The routes I want to delete are the "!" rejected routes, but I can't seem to formulate the right "route del" command to pull it off.
Here is the routing table...
Destination Gateway Genmask Flags Metric Ref Use Iface
67.40.227.206 * 255.255.255.255 UH 0 0 0 ppp0
192.168.46.79 * 255.255.255.255 UH 0 0 0 ipsec0
192.168.46.79 - 255.255.255.255 !H 2 - 0 -
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
10.1.0.0 * 255.255.0.0 U 0 0 0 ipsec0
10.1.0.0 - 255.255.0.0 ! 2 - 0 -
default * 0.0.0.0 U 3 0 0 ppp0
default * 0.0.0.0 U 4 0 0 ppp0
I have two entries for 192.168.46.79 and 10.1.0.0. These are auto-generated by the little Linux based router I'm using. I can ping the IPSEC tunnels from the shell itself, but traffic from the LAN takes the second route (the rejected "!" or "!H" route) for reasons I simply don't understand.
with the
route -n
command you'll obtainsudo route del -net 0.0.0.0 gw 192.168.178.1 netmask 0.0.0.0 dev eth0
you'll get all parameters respectively from above
The types of the routes with the
!
flag are either unreachable or prohibit.route
, being an ancient utility from net-tools, does not differentiate between the two. Use iproute2.The net-tools way to delete these routes would be to use
route del
on it. However, net-tools provides no way to differentiate between the rejected route and the other one (because the dev argument is optional, though not specifying a device is likely to remove the unreachable route).iproute2 allows you to do it like this:
It might not be unreachable, but prohibit. Use
ip route
with no arguments to determine which.I think it's this:
route del -net 10.1.0.0 netmask 255.255.0.0 metric 2
I'm not 100% certain. But, I think you've got something else goofy going on since you have 2 default routes.
From my experience,
should work. In your specific case,
should do the trick. Please note that this applies to routes I manually added. I'm not entirely certain why yours has duplicate routes without interfaces. As such, it may be necessary to apply a metric parameter, as described by baumgart.
Please see if there is a "device config file" under /etc/network/interfaces.d/ -> I had eht0!! Really, it was eht0 and not eth0 there!