4

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:

  1. The g/w is set to 0.0.0.0 on every bond's network
  2. 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.

2

you seem to read the information in the routing table wrong.

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

The above actually means that network 192.168.4.0/255.55.252.0 is locally connected on bond0.11, thus can be reached without a gateway.
A gateway entry would look like:

Destination  GateWay      Genmask            ... Iface
172.16.0.0   192.168.4.1  255.255.255.0      bond0.11

However you do not need this to send traffic to a locally connected network.

So from what I see there isn't really something wrong with your interface setup, and normally after a reboot your clients of vlan x should be able to connect to the server IP on vlan x.

  • Your second version is what it looks like after I put my manual routing in (although the 0.0.0.0 entry is still there). just checking, it appears to be working today... – Mark Fisher Dec 3 '14 at 12:41
  • Well this is all rather embarrassing. After rebooting everything, I don't need to add the routes for the traffic to work, but I swear I did yesterday. Also, I think I understand better what you're saying, a gateway is only needed for traffic off the local subnet (192.168.4.0/22 in this case), and that traffic on this subnet will transparently work through the switch without me having to give it the gateway's IP address. – Mark Fisher Dec 3 '14 at 13:15
  • sometimes a reboot / restart of the networking is needed to flush the routing tables etc. I have encountered it before. And indeed. A gateway is only needed when you want to reach a destination outside of the locally connected LAN. – Goez Dec 3 '14 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.