FPBX Multiple NIC, plus static ip routing


(T Hyde) #1

Greets - I’ve recently changed a network configuration (due to some sip trunking requirements) where I now have two NICs on board my F-PBX server. I have full setup functional, wherein:

eth0 is my LAN, subnet 172.20.3.x/25 with no gateway set, and hosts phones/clients only.

eth1 is my WAN egress subnet 192.168.240.4/28 with a gw of 192.168.240.1 - and pushes through my router and firewall.

I am not using the F-PBX firewall as it’s already covered and I didn’t need extra complexity until I was able to resolve the next issue:

I have a couple other subnets local to us (read: inside LAN) - for example 172.21.10.x/24 and 172.21.15.x/24, and are available to eth0, but since there is no gw for eth0, it doesn’t know how to route to them. Those subnets are NOT available to eth1.

I’m a Debian guy, not RHEL/Centos, so I’m not sure if iptables works the same way here or not.I know how to do this in debian, but don’t want to break F-PBX trying the same tricks.

What I’d like to do is put some entries into the routing table for eth0 that for subnets 172.21.x.x, to use a gw of 172.20.3.1 (which is a valid gw available to eth0) instead of the default gw noted on eth1. Once it gets to 172.20.3.1, my router can handle next-hop.

Unfortunately, I cannot intercept the traffic once it has exited eth1 to default gw and re-route it as that would create a bad routing loop. The most appropriate spot to determine the routing is at the server.

Assist most appreciated!

Thanks,
Ted.


(Dickson) #2

Do you mean something like this kind of statement?
This would push any network of 173.46.30.X out gw IP of 10.0.30.137 via nic ETH1

route add -net 173.46.30.0 netmask 255.255.255.0 gw 10.0.30.137 dev eth1

EDIT:
173.46.30.0 is some destination network, so any network that has the IP range of 173.46.30.0 would be intercepted by this command.

10.0.30.137 would be the gateway of the network on eth1, your example would likely be the IP of 192.168.240.1


#3

As @dickson says. For persistence (to survive reboots), see
https://my.esecuredata.com/index.php?/knowledgebase/article/2/add-a-static-route-on-centos


(T Hyde) #4

Gents - to both of you my thanks. Yes, this was what I was looking for (admittedly I didn’t know if there was issue with managing certain resources outside of the F-PBX gui - since so much of that is “overwrite-files-first-ask-questions-later” driven).My expectation is that perhaps I should also stay away from the GUI System Admin->Network Settings gui from now on, just to be sure.

Many thanks.
TH.


(system) closed #5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.