Persistent static routes

Latest response



I have a problem configuring my network on the RHEV (3.0 beta) hypervisors. For our storage network I need to add a route which should survive reboots.


Normally one would place a route-<devicename> file in /etc/sysconfig/network-scripts and be done with it,  however this does not seems to survive reboots on RHEVH machines.


What would be the preferred method of doing this?


Have you run `persist /etc/sysconfig/network-scripts/route-<devicename>` after creating the file?

No I have not, I was not aware of such commands. Is there a document describing the commandline tools?

Technically, RHEV-H is a liveCD image deployed to the local drive. the root FS is in read-only state, and in order to be able to change configs, you need to update the config file and run `persist./path/to/file`


I don't think thisis documented anywhere besides KB articles, because normally, there should be no reason to actually do anything in the RHEV-H command shell, everything should be done from the admin GUI

Thank you for your quick replies. I do have some additional questions, I hope I may ask here.


Can adding a static route be done using the admin GUI?


Also, can you duplicate network configuration between hosts?


To my standards we have a pretty complex network, and configuring 20+ RHEV-H hosts with the GUI is kind of painfull. Ofcourse I can script it now using the "persist" command, but like you pointed out that is not the idea behind the admin GUI.

>Can adding a static route be done using the admin GUI?
Not currently, we normally let the kernel handle routing, according to the interface IP. Besides, you can use VLANs, that provides far better isolation, though it's not applicable for every use case of course. If you really require static routing, the only way currently is to do it manually. However, if this is such a critical feature, please file an RFE for this capability through a support case.

>Also, can you duplicate network configuration between hosts?
You cannot duplicate network configs because there is no guarrantee that every host will have the same set of NICs. RHEV operates in terms of "Logical Network", which on the hosts is turned into a virtual switch (a bridge interface that rides on a physical NIC or a bond and into which VMs plug in). On one host a logical network can be using a bond, on another a simple NIC, it's all flexible.
If you have a similar set of machines, you could use the RHEV-M API to automate setting the same network on all of the hosts of course. Instructions are in the API guide

If you decide to bring an interface up (ethx) or a logical network (bridge) with an ip address configuration for storage network, then initscripts will configure routing for it automatically. Is it possible for you to give output of "ifconfig", "route -n" and the static route that you want to add so that we can understand why you had to add it manually?

Sure, this is the "nfs" bridge's ifconfig:

nfs       Link encap:Ethernet  HWaddr 98:4B:E1:0F:7C:31
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::9a4b:e1ff:fe0f:7c31/64 Scope:Link
          RX packets:342864 errors:0 dropped:0 overruns:0 frame:0
          TX packets:398682 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:158481847 (151.1 MiB)  TX bytes:125146952 (119.3 MiB)

Output of route -n:

[root@host ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface   UG    0      0        0 nfs   U     0      0        0 rhevm   U     0      0        0 nfs     U     1003   0        0 eth1     U     1010   0        0 bond0     U     1011   0        0 bond3     U     1012   0        0 bond4     U     1013   0        0 rhevm     U     1015   0        0 2701     U     1017   0        0 nfs     U     1019   0        0 1701     U     1021   0        0 2091         UG    0      0        0 rhevm



The first entry shows you the route I needed to add using the route-nfs file in /etc/sysconfig/network-scripts/.

You can avoid the requirement for static routing if you do either of the below, if possible.


1 - Place your NFS server on network.




2 - Configure "nfs" bridge using an IP  from after putting it in the same vlan or network.


If none of the above is possible, you need to go the route of static network as explained earlier and do "persist" it.