Two network cards - unable to register on eth1


I have a freepbx server with two network cards. eth0 is and gateway which is going to my customer LAN (point to point connection)

eth1 is my network which is and gateway (going through pfsense and assigned an external ip)

the client can register to my server using just fine. however when I try to register from my office to the external ip address (eth1) most of the time the registration times out.

this morning I registered my softphone just fine but then few hours later I couldn’t register any more… ports are open on the firewall…

I have added the following to sip_nat.conf (my external ip)

but still I cannot register most of the time to the server. I have tried from multiple locations but it’s the same thing…

Can someone help me please?



You can only specify one default gateway for the system.

Use the command ‘netstat -rn’ to see where things are assigned.

Per your post ..

eth0 is Mask No gateway.. 
eth1 is Mask gateway

 Traffic to Phones and Devices on 192.168.180.n will go out eth0. Traffic to Phones and devices on 192.168.31.n will leave via eth1.  Traffic to any other network device will leave via then route to the internet or other local networks through your router gateway at


well, I have two different gateway … each network card has its own gateway…

eth0 is Mask gateway:
eth1 is Mask gateway

however, netstat -rn returns this:

Destination Gateway Genmask Flags MSS Window irtt Iface U 0 0 0 eth0 UG 0 0 0 eth0 U 0 0 0 eth1 UG 0 0 0 eth1 UG 0 0 0 eth0

and this is my eth1 configuration:
allow-hotplug eth1
auto eth1
iface eth1 inet static

how about incoming traffic though… if I use my external IP which is routed to it should work just fine… by the problem is that the server doesn’t response.

Do I need to add something to linux routing for this to work?


No You can’t do that !!!

If you need to route some network through the 2nd Gateway you need to add exlicit routes.


route add -net netmask

Would explicitly routetraffic for the 172.16.200.n network through the eth0 adapter and then through the .254 gateway…

Read this about IP gateways & routers…

“it should work just fine… by the problem is that the server doesn’t response.” huh? i interpret that as it does not work fine.

to reiterate what phonebuff already said: you can only have 1 default gateway.

if you have multiple gateways, then you have a great chance that, for example, asterisk receives traffic on one NIC but responds via the other. With asterisk, this can even happen with multiple IP addresses on the same NIC with a single gateway.

what you need to do is have one default gateway and if you want some specific traffic to use a different route, create appropriate static routes.

additionally, in your asterisk configuration, you posted the following setting:


this is telling asterisk that addresses in the range thru are within your LAN [and conversely, neither of the LAN segments and are in that localnet] so I think its safe to say asterisk is totally confused.

Good Catch mudslide567 – Missed this one…

Should have been == localnet=

thanks… I did change that but still having the same issue… I will add route and see if that’s gonna work…