FPBX Multiple NIC, plus static ip routing

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 with a gw of - 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 (which is a valid gw available to eth0) instead of the default gw noted on eth1. Once it gets to, 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!


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

route add -net netmask gw dev eth1

EDIT: is some destination network, so any network that has the IP range of would be intercepted by this command. would be the gateway of the network on eth1, your example would likely be the IP of


As @dickson says. For persistence (to survive reboots), see

1 Like

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.

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