Discussion:
[systemd-devel] Why is default route scope RT_SCOPE_UNIVERSE?
Daniel Wang
2017-05-16 16:51:56 UTC
Permalink
I'd like to understand the rational behind defaulting to scope universe
instead of scope link.
https://github.com/systemd/systemd/blob/master/src/network/networkd-route.c#L71

I have a NIC configured through DHCP. The DHCP server sends two routes, one
to the router, and the other to the rest of the LAN:

# cat leases/3 | grep ROUTES
ROUTES=192.168.0.1/32,0.0.0.0 192.168.0.0/24,192.168.0.1

systemd was able to add the first route, as this:

# ip route show
192.168.0.1 dev eth1 proto dhcp metric 1024

And it failed to add the second, getting error "Network is unreachable". I
think the kernel rejects it because it _doesn't know how to reach the
router_, in this case 192.168.0.1, as I read somewhere that the route has
to be configured link local.

I understand that systemd is smart enough to add a link local route to the
router, _if the router IP is included in the DHCP lease_. Unfortunately my
DHCP server doesn't do so, and I don't see any RFC mandates that.

I am trying to see if we can update our server implementation, but on the
other hand I'd like to understand why systemd chose RC_SCOPE_UNIVERSE as
its default?
--
Best,
Daniel
Daniel Wang
2017-05-16 17:45:57 UTC
Permalink
Following up on this, the "ip route" command has some intelligence of
deciding what scope to use for a route, depending on its type. Does it make
sense for systemd to do something similar?

https://linux.die.net/man/8/ip

```
scope SCOPE_VAL
the scope of the destinations covered by the route prefix. SCOPE_VAL
may be a number or a string from the file /etc/iproute2/rt_scopes. If this
parameter is omitted, ip assumes scope global for all gatewayed unicast
routes, scope link for direct unicast and broadcast routes and scope host
for local routes.
```
Post by Daniel Wang
I'd like to understand the rational behind defaulting to scope universe
instead of scope link. https://github.com/systemd/systemd/blob/master/src/
network/networkd-route.c#L71
I have a NIC configured through DHCP. The DHCP server sends two routes,
# cat leases/3 | grep ROUTES
ROUTES=192.168.0.1/32,0.0.0.0 192.168.0.0/24,192.168.0.1
# ip route show
192.168.0.1 dev eth1 proto dhcp metric 1024
And it failed to add the second, getting error "Network is unreachable". I
think the kernel rejects it because it _doesn't know how to reach the
router_, in this case 192.168.0.1, as I read somewhere that the route has
to be configured link local.
I understand that systemd is smart enough to add a link local route to the
router, _if the router IP is included in the DHCP lease_. Unfortunately my
DHCP server doesn't do so, and I don't see any RFC mandates that.
I am trying to see if we can update our server implementation, but on the
other hand I'd like to understand why systemd chose RC_SCOPE_UNIVERSE as
its default?
--
Best,
Daniel
--
Best,
Daniel
Lennart Poettering
2017-05-17 09:32:43 UTC
Permalink
Post by Daniel Wang
Following up on this, the "ip route" command has some intelligence of
deciding what scope to use for a route, depending on its type. Does it make
sense for systemd to do something similar?
https://linux.die.net/man/8/ip
```
scope SCOPE_VAL
the scope of the destinations covered by the route prefix. SCOPE_VAL
may be a number or a string from the file /etc/iproute2/rt_scopes. If this
parameter is omitted, ip assumes scope global for all gatewayed unicast
routes, scope link for direct unicast and broadcast routes and scope host
for local routes.
```
Could you please file an RFE bug on github regarding this?

(Even better, provide a patch... ;-) )

Lennart
--
Lennart Poettering, Red Hat
Daniel Wang
2017-05-17 17:41:40 UTC
Permalink
Thanks. I filed https://github.com/systemd/systemd/issues/5979
Post by Lennart Poettering
Post by Daniel Wang
Following up on this, the "ip route" command has some intelligence of
deciding what scope to use for a route, depending on its type. Does it
make
Post by Daniel Wang
sense for systemd to do something similar?
https://linux.die.net/man/8/ip
```
scope SCOPE_VAL
the scope of the destinations covered by the route prefix. SCOPE_VAL
may be a number or a string from the file /etc/iproute2/rt_scopes. If
this
Post by Daniel Wang
parameter is omitted, ip assumes scope global for all gatewayed unicast
routes, scope link for direct unicast and broadcast routes and scope host
for local routes.
```
Could you please file an RFE bug on github regarding this?
(Even better, provide a patch... ;-) )
Lennart
--
Lennart Poettering, Red Hat
--
Best,
Daniel
Loading...