[Nix-dev] Failed to add route because network is unreachable

Bas van Dijk v.dijk.bas at gmail.com
Tue Apr 28 11:05:12 CEST 2015


On 28 April 2015 at 09:16, Kirill Elagin <kirelagin at gmail.com> wrote:
> It would be nice if you showed us the output of `ip route` at the point
> where `ip route add` fails.
> Also `ip route get 136.243.17.1` might give some hints.

# ip route show
default via 136.243.17.1 dev eth0
136.243.17.0/26 via 136.243.17.1 dev eth0
172.16.48.16/28 dev eth0  proto kernel  scope link  src 172.16.48.17

# ip route get 136.243.17.1
136.243.17.1 via 136.243.17.1 dev eth0  src 136.243.17.41
    cache

> It totally looks like the gateway you are trying to use is unreachable.

Indeed that's how I also understand the error message. The only thing
I don't understand is what "unreachable" means exactly. I can ping the
gateway just fine and I can reach hosts on the internet (meaning the
gateway is correctly routing my packages). Maybe it means my Linux
kernel doesn't allow sending packets to the gateway with a destination
in the private range 10.180.0.0/24 or with the private source address
172.16.48.17.

> To be honest, I have no idea what does the `mainIPv4  = "136.243.17.41";` line
> do, but feels like it doesn’t configure the routes (or even the address)
> properly.

Nixops will add the mainIPv4 address (136.243.17.41/26) to
networking.interfaces.eth0.ip4 after which the nixos networking module
configures the interface. Nixops will also add the surprising route:

ip -4 route change '136.243.17.0/26' via '136.243.17.1' dev 'eth0'

which is needed because in the Hetzner network it's required to route
all traffic (including traffic to my own subnet) to the gateway. (See:
http://wiki.hetzner.de/index.php/Netzkonfiguration_Debian/en)

Anyway, I'm glad I found a work-around by manually adding the route
without the gateway option.

Cheers,

Bas


More information about the nix-dev mailing list