Off-subnet Gateway configuration for XCP-NG/XenServer 8 Dedicated Server

Public IP: 46.x.y.z/32

GW: 100.64.0.1/32

temporary configuration is possible via ip route command:

ip route add 100.64.0.1 dev xenbr0

ip route add default via 100.64.0.1

but i've problem with permanent configuration

xe network-param-set uuid=<xe_network-list_xenbr0_uuid> other-config:static-routes=10.64.0.1/32/0.0.0.0

due to fails to apply Default Gatewa via Xen network configuration and via ip route command

ip route add default via 100.64.0.1

(Error: Nexthop has invalid gateway )

there is a chance to remediate to this behavior?

Hello,

I've never used XCP-NG but the keyword to look for, that most Linux distributions apply for this kind of route outside of the interface's subnet, is "onlink" (pretend that the nexthop is directly attached to this link, even if it does not match any interface prefix).

For instance, Debian's ifupdown adds it automatically since 2016: https://salsa.debian.org/debian/ifupdown/-/commit/8b7bca9597d2f75670b182f0fc149cdbaec3544c
I don't think xe supports this so maybe you could file a bug report?

A workaround could be adding a SystemD service that runs before XCP-NG's networking service and whose only job is to run "ip route add 100.64.0.1 dev xenbr0"? I don't know if that's possible, depending on whether xenbr0 has already been created by then.

Hello,

thank you for your reply, i posted it on the XCP-NG community forum https://xcp-ng.org/forum/post/96286, because

ip route add default via 100.64.0.1 dev xenbr0 onlink

works without need for

ip route add 100.64.0.1 dev xenbr0

That’s a solid observation. Since XCP-NG doesn’t natively support routes outside the subnet, filing a bug report makes sense. In the meantime, using a systemd service as a workaround seems like a practical approach, provided the bridge is up in time.

It actually reminds me of the Bowmaster action game: sometimes the default mechanics don’t cut it, and you need a creative workaround to hit your target. Same idea here with networking fixes—different path, same goal.

Visit the website if you are interested in XCP-NG static routes and Bowmasters game strategies.