[systemd-devel] networkd: Link local static IP address behind NAT

Andrei Borzenkov arvidjaar at gmail.com
Wed Jan 18 04:06:35 UTC 2023


On 17.01.2023 18:28, Thomas Burghout wrote:
> Hello,
> 
> We are trying to configure a device to use a gateway and a static IP address
> (in the link-local address range). However, the default gateway does not appear
> to be used. As such, there is no traffic possible to the internet.
> 
> The device runs systemd 251.4 on a custom Yocto distribution with
> Linux 5.4.124-altera.
> 
> The following network is used:
> 
> [Match]
> Name=eth0
> 
> [Network]
> Address=169.254.1.2/16
> DNS=169.254.1.1
> Gateway=169.254.1.1
> 
> With this configuration ping 8.8.8.8 does not work. However, if we specify the
> interface like so:
> 
> ping -I 169.254.1.2 8.8.8.8
> 
> We are able to reach it successfully. We verified that the gateway is indeed
> reachable.
> 
> See also the following relevant output:
> 
> $ ip route
> default via 169.254.1.1 dev eth0
> 169.254.0.0/16 dev eth0 scope link  src 169.254.146.171  metric 2048
> $ ip address
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
>      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>      inet 127.0.0.1/8 scope host lo
>         valid_lft forever preferred_lft forever
>      inet6 ::1/128 scope host
>         valid_lft forever preferred_lft forever
> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq qlen 1000
>      link/ether e2:26:9e:11:ae:da brd ff:ff:ff:ff:ff:ff
>      inet 169.254.146.171/16 brd 169.254.255.255 scope link eth0

Is it output from the correct system? Because address is different. I do 
not see how "ping -I 169.254.1.2" can work with this.

>         valid_lft forever preferred_lft forever
> 3: usb0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
>      link/ether b6:c8:ab:ac:44:7f brd ff:ff:ff:ff:ff:ff
> 4: sit0 at NONE: <NOARP> mtu 1480 qdisc noop qlen 1000
>      link/sit 0.0.0.0 brd 0.0.0.0
> $ ip route get 8.8.8.8
> 8.8.8.8 via 169.254.1.1 dev eth0
> 
> The route seems to be configured correctly. The scope appears to be link,
> we would expect global as this is consistent with other configurations. The
> output of ip route get shows no src address.
> 
> If the interface is configured in an interactive manner we get the expected
> behavior. The device is able to use the gateway by default.
> 
> $ ip address flush dev eth0
> $ ip route flush dev eth0
> $ ip address add 169.254.1.2/16 brd + dev eth0
> $ ip route add 169.254.1.1 dev eth0
> $ ip route add default via 169.168.1.1 dev eth0
> 
> Which produces a route which includes a src address and produces the address
> with scope global.
> 
> networkd does not show any warnings or errors in the log. Is there a
> configuration option we are missing?
> 
> 
> With kind regards,
> Thomas Burghout



More information about the systemd-devel mailing list