I run several LXC containers on my machine, some of which have their own IP address outside a network shared with the host. This IP address, as well as the corresponding network mask and gateway was provided to me by my ISP. I am using systemd 238 and tried following configuration :
[Match] Name=enpXsY [Network] Address=192.168.0.2/24 Gateway=192.168.0.1 IPForward=yes [Route] Destination=10.0.0.64/29 Gateway=10.0.0.65
systemd-networkd logs I see following error:
Could not set route: Network is unreachable, but I cannot really explain this. If I do not specify a gateway, the kernel can route to this network just fine. Thus I would assume it would also be able to route the traffic to the gateway through this same interface. This does not even work, if I specify a route with
Destination=10.0.0.65/32 before the route to
10.0.0.64/29, in order to take the kernel by the hand and explain how to reach that network.
UPDATE: In the meantime I changed the host's network configuration significantly, but these were the IPv4 addresses and routes it was configured with :
# ip -4 address 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: enpXsY: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 inet 192.168.0.2/24 brd 192.168.0.255 scope global enpXsY valid_lft forever preferred_lft forever 4: lxcbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 inet 10.10.10.1/24 brd 10.10.10.255 scope global lxcbr0 valid_lft forever preferred_lft forever # ip -4 route default via 192.168.0.1 dev enpXsY proto static 192.168.0.0/24 dev enpXsY proto kernel scope link src 192.168.0.2 10.10.10.0/24 dev lxcbr0 proto kernel scope link src 10.10.10.1
: I translated the actual IP-addresses into similar addresses in non-routed networks for privacy reasons.