@neuberfran@dellgreen I know that this is an old topic, but I hope I can reach you this way. We are facing the same issue using systemd-networkd.
We have a static IP where we can reach other machines that are in the same network. We are not able to reach addresses that should be reachable using the gateway.
What we found out so far is that if we request the route for an external IP is it missing the source address.
I’m curious if you found a solution to get static IP addresses working or are willing to investigate this further.
$ networkctl status
* State: degraded
Online state: online
Address: 169.254.1.2 on eth0
Gateway: 169.254.1.1 on eth0
DNS: 169.254.1.1
Aug 08 09:10:09 sonor11AEDA systemd-networkd[169]: lo: Gained carrier
Aug 08 09:10:09 sonor11AEDA systemd-networkd[169]: Enumeration completed
Aug 08 09:10:09 sonor11AEDA systemd[1]: Started Network Configuration.
Aug 08 09:10:09 sonor11AEDA systemd-networkd[169]: eth0: Configuring with /usr/lib/systemd/network/10-lan.network.
Aug 08 09:10:09 sonor11AEDA systemd-networkd[169]: eth0: Link UP
Aug 08 09:10:09 sonor11AEDA systemd[1]: Starting Wait for Network to be Configured...
Aug 08 09:10:09 sonor11AEDA systemd-networkd[169]: eth0: Gained carrier
Aug 08 09:10:16 sonor11AEDA systemd[1]: Finished Wait for Network to be Configured.
Aug 08 09:10:29 sonor11AEDA systemd[1]: Reloading Network Configuration...
Aug 08 09:10:29 sonor11AEDA systemd[1]: Reloaded Network Configuration.
networkctl:
$ networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 eth0 ether degraded configured
3 usb0 gadget off unmanaged
4 sit0 sit off unmanaged
4 links listed.
We have tried it with a non link-local address as you asked and it works as expected.
The thing is that we want to use autoipd to build a network with multiple devices. One of those devices is a gateway which the other devices should use to reach the internet. We wanted to switch from autoipd to static since those systems can be big and have issues to find a new address when rebooting. This we also used in the past and it was working.
The strange thing is that when we configure the network from the command-line it’s working fine:
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.254.1.1 dev eth0
So it looks like it has to do with something in systemd-networkd. And that we could not keep the scenario and we have to find an other way to work around our problem.
In the link local setup, run the ‘route’ command to see if systemd is actually adding a gateway route to the kernels ip routing table. It’s probably not as its link local, which would explain why it probably works as you are explicitly adding a route entry yourself as per your last test
I believe you can add explicit routes in the systemd config file
After some fiddling around it seems that it’s a change in systemd-networkd. The older versions are adding the routes that we would expect.
Thanks for helping out!
For people looking for a solution:
We decide to use LinkLocal during the device discovery. After that based on some logic we switch to static IP address in the private network range. With this logic, we also define a gateway in the system that can be used by the other devices.
This way we comply with the RFC and can use new versions of systemd-networkd.