Force WAN traffice through particular NIC

Hi,

Looking for some help, a bit of a noob, but stuck with one issue.

Currently have an active FreePBX system running with two NICs, one for WAN traffic, and one for LAN.

Our VOIP handsets are all on the LAN and connect to the LAN IP of the PBX on 192.168.1.15. All our LAN clients connect to the internet via one particular internet connection, which happens to be a Vsat, where the latency is too high for SIP calls. This is connected to the PBX on eth0.

I have another connection, with much lower latency that is dedicated for SIP traffic. I have this connection connected to the PBX on eth1.

What I am stuck with is how to make the PBX connect all our Trunks via the connection on eth1, rather than eth0, which it is doing by default. Is there any way to force trunk registrations through a particular eth port, ie. dedicate a connection to be a WAN port.

I have fiddled around with the Asterisk SIP settings, but the traffic seems determined to all flow through eth0. I have also tried swapping the connections around on the eth ports, so that the “WAN” port is eth0, but this has not changed anything.

Any help regarding this would be greatly appreciated.

Many thanks,

Liam

The server uses the routing table to determine which connection to send data out of. If you change the default gateway to the WAN eth1 connection you should get the desired behavior.

Instead of the default route… you probably want to add a host route for your SIP ‘endpoint’ that goes over your eth1 device and not all traffic. say that your sip endpoint is 123.123.123.123 and your locate eth1 gateway is 192.168.1.1… you’d do route add -host 123.123.123.123 gw 192.168.1.1 ( something like that )

jack

Hi, thanks for the reply. That solution worked. Now WAN traffic is going out through the correct connection.

Cheers

Great, thanks for that. I will look into trying that out now.

Many thanks :slight_smile: