I always forget this so I’ll just make a quick post with it.
Let’s say you need to access something from you Xen Server that isn’t reachable via your default route. No you can of course just add a static route with the route command.
The problem with this is that it doesn’t stick after reboot, and neither does it stick even if I put it /etc/rc.local or any other config file.
To solve it you have to use the xen commands. Here’s a quick howto.
First, here’s the command :
xe network-param-set uuid=<Network UUID> other-config:static-routes=<network>/<;bitmask>/<gateway IP>
Only problem with this is that you probably don’t know your <Network UUID>. To find this you can run this command from the command line :
xe network-list
This will generate output like this:
uuid ( RO) : 873c04b0-6b79-a235-41a7-69fbe7d96f0d
name-label ( RW): ETH0 Xen Management
name-description ( RW):
bridge ( RO): xenbr0
And voila, you have your UUID. Now, just fill in the rest of the paramters for instance, your xenserver has 192.168.2.200 as it’s ip on the UUID you just found.To route 192.168.1.0/24 to router 192.168.2.1 do:
xe network-param-set uuid=873c04b0-6b79-a235-41a7-69fbe7d96f0d other-config:static-routes=192.168.1.0/24/192.168.2.1
This seems to take effect on reboot so to add the route during your current session just use route add.