creating unreachable routes with NetworkManager

Mateusz Marzantowicz mmarzantowicz at osdf.com.pl
Sun Jan 19 01:27:39 UTC 2014


On 19.01.2014 00:32, Wolfgang S. Rupprecht wrote:
> 
> Back when I ran my server with the networking scripts instead of
> NetworkManager it was easy to add unreachable routes.  I'd put lines
> like the following:
> 
> /etc/sysconfig/network-scripts/route-lo:
> unreachable 10.0.0.0/8
> unreachable 172.16.0.0/16
> unreachable 192.168.0.0/16
> 
> /etc/sysconfig/network-scripts/route6-lo:
> unreachable fc00::/7
> 
> When lo was enabled, I'd get those unreachable routes loaded (and a few
> others that the networking scripts added for me.)  Now with
> NetworkMisManager I don't get either my unreachalbes or the formerly
> built-in ones.
> 
> Is there a trick I'm missing?  Obviously I could do an "ip route add"
> from a private systemd service, but that seems a bit heavy handed.
> 
> (The reason I need to add the unreachables is that my ISP doesn't send
> me network unreachables for private addresses.  For laptops on the go,
> they sometimes get routable IPv6 addresses as well as unroutable IPv4
> addresses.  I use nsupdate to register my laptop's current addresses in
> DNS and when private addresses show up it would be nice for things like
> "ssh laptop" to quickly move on from the private addresses without a
> very long timeout.)
> 
> -wolfgang
> 

You can create script that would be invoked by NM on ifup event. Put it
inside /etc/NetworkManager/dispatcher.d/ and make executable. Content of
the script would be something like ip route add ... dev xxx for each
unreachable/non routable network.



Mateusz Marzantowicz


More information about the users mailing list