I've got a linux d/b server (OEL 6.4 but effectively Redhat 6 I believe) with bonded nics connecting to juniper switches.
I've split the bond up into multiple vlans (bond0.11, ... bond0.18) with IP address ranges 192.168.X.Y/22 so that the d/b server instances can listen on those addresses separately, and thus ensure d/b access is done by appropriate VLAN membership and projects on different vlans can't connect to each others databases without explicit rules on the Juniper firewall.
When I bring the network up I have 2 issues:
- The g/w is set to 0.0.0.0 on every bond's network
- I have to manually add routes to the correct g/w for each network
So for instance, I have the following routing by default:
Destination GateWay Genmask ... Iface
192.168.4.0 0.0.0.0 255.255.252.0 bond0.11
192.168.8.0 0.0.0.0 255.255.252.0 bond0.12
... etc
And I have to manually add the routes to the gateways for each network with
route add -net 192.168.4.0 netmask 255.255.252.0 gw 192.168.4.1
route add -net 192.168.8.0 netmask 255.255.252.0 gw 192.168.8.1
What I'd like to do is have this automatically set the X.1 gateway addresses when the network starts, but I haven't been able to find the appropriate magic to enable this.
I've tried adding files for route-bond0.11 with:
192.168.4.0/22 via 192.168.4.1
but when I start the network, I get an error
Bringing up interface bond0: [ OK ]
Bringing up interface bond0.11: RTNETWORK answers: File exists
which I've looked up and usually means the route isn't required as it already exists. Presumably this is because of the default 0.0.0.0 entries I'm getting.
I don't have a GATEWAY entry in any of the ifcfg-bond0.XX files (tried that and the "last one" wins setting the global default gateway which isn't what I want in this case anyway).
So my questions are:
- How do I get the network to come up without the 0.0.0.0 entries?
- Would this then enable the route-bond.XX files to work correctly?
- Or is there another way to get the routes to be defined on startup of the network?
Once my manual routes are in place everything is fine, the gateways on the juniper are all there and traffic flows across my VLANs as expected, I just can't get the initial settings to be what happen on boot-up or restart of the network.
EDIT Rather embarrassingly after rebooting everything it all is working as should be, and doesn't need the routing added to get traffic to work to the rest of the VLAN through the switch. This was a mixture of a transient problem with the new setup and my understanding of gateways in this case it seems.