Multiple network interfaces

Hello friends,

I need your help.
FreePBX 17 has three network interfaces:

etx0 - local network
etx1 - SIP provider network
etx2 - internet access

Peers are on the local network.
SIP 1 trunk via eth1
SIP 2 trunk via eth2

I want to configure routing on FreePBX via the web interface (not the operating system).
How do I do this correctly?

  1. Each network connection uses a default gateway. Will there be a gateway conflict or FreePBX can work with multiple gateways when selecting the required transport?
  2. How needs properly configure the firewall in FreePBX for multiple networks?

I used FreePBX 13 and configured routing at the operating system level.
But I think that’s a this way of the past.

If the SIP and media addresses accessed via eth1 are in its subnet, you shouldn’t have to do anything special, other than setting up separate transports for the trunks. If they aren’t, AFAIK you need to set up the static routes at the OS level; FreePBX System Admin does not offer this feature.

Yes, SIP and media are available on eth1 if I specify a default gateway in the settings on eth1.

Is it allowed to use multiple default gateways?

For the Internet: eth2 gateway
For the local network: eth0 gateway
For connecting to a SIP provider: eth1 gateway

I’m sure standard Unix has no such concept. I’m pretty sure Linux doesn’t have the concept under that name, but there may be tricks you can play with iptables.

The normal way of handling it would be a static route to the provider on the private network, with higher priority than any default route.

In any case, you will only be able to address this at the OS level.

This could be a lost-in-translation issue – remove the word default, maybe change the word gateway to route and the answer is, perhaps, much closer to yes.

Have you looked into the ip command, e.g.

$ ip route show
$ ip route add ...

I think you’re right. There should be one default gateway. I saw that somewhere.

Can you help me find the problem?
Connected only eth0.
If I use the default transport udp - 0.0.0.0 - All, extension and PJSIP trunk registration (registration and reception) incoming and outgoing calls work.

If I enable advanced parameters and select udp - 192.168.0.200 - pbxeth0, extension and PJSIP trunk registration (registration and reception) work, but incoming and outgoing calls through the PJSIP trunk don’t work.

I specify udp - 192.168.0.200 - eth0 transport in the trunk settings.

What am I missing?

Friends, I was able to solve this.

After adding or changing a transport, you need to reboot. Because pjsip show transports didn’t show any transports before rebooting.
After rebooting:

The trunk issue has been resolved:
After changing the transport, you need to delete the trunks and create them again.

After changing the transport, the transport was automatically changed in the trunk settings, but the trunk did not work.
FreeBX may not make changes to trunk configuration files that have already been created, but only when they are created.

But in the log file I see entries like: res_pjsip.c: Unable to retrieve PJSIP transport ‘0.0.0.0-udp’
Perhaps additional changes need to be made somewhere.

It might be due to extensions. I’ll try deleting it and creating it again.
because they were created before changes in the transport infrastructure and also used UDP 0.0.0.0

I can check the configuration files, but freepbx doesn’t like it when change.

:slight_smile:

This is hard to do in all scenarios without at least a restart of Asterisk – although not necessarily a reboot of the entire system.

Also, you could try enabling Allow Transports Reload at the top of the PJSIP settings page, with some caveats (see FreePBX forum post here, Asterisk blog post here, Asterisk GitHub issue here, etc.)

Hmm, that sounds like a bug, possibly for the issue tracker. But, it could be related to transports not changing dynamically, without either modifying the reload setting as mentioned above (or restart/reboot) not sure. :thinking:

What about changes made after the reboot ? Are those all set now ? Or is an Asterisk restart/system reboot not enough to correct things ?

Changing transports on a server is usually kind of a big deal – lots of low-level network related things are happening when you do that, and if there’s active calls on those interfaces that are disappearing, well, you and your users are not going to have a very good time.

I almost got it all working.
I can’t figure out the trunk for the SIP provider, which requires a special transport.

I use three transporters.
Transport 1 is for local clients.
Transport 2 is for the SIP providers trunk.
Transport 3 is for remote clients via Internet.

Created a trunk, specified the transport, created an IP route to the network interface.
But registration reject.

To check, I use the command pjsip show Transport xx.xx.xx.xx-udp.

I see that the external IP address and local networks are displayed. And when I request registration in the log file, I see an incorrect header with the address.

REGISTER sip:10.0.0.68:5060 SIP/2.0 477946Via: SIP/2.0/UDP external ip address:5060;rport;branch=z9hG4bKPj78572b7f-6836-483c-92f8-177bbda3874b 477947From: sip:[email protected];tag=1b6e879b-d64a-4a39-a642-08233182b48a 477948To: sip:[email protected] 477949Call-ID: b0b51ddf-2058-4ba7-bbed-1c7918ac6b03 477950CSeq: 49410 REGISTER 477951Contact: <sip:account@external ip address :5060;line=unfuvvu> 477952Expires: 3600 477953Allow: OPTIONS, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INFO, REFER, MESSAGE

Can someone explain why a trunk connection uses an external address from another transport?

Well it looks like you’re adding a public IP to register over a private LAN. But since you’ve hidden everything and really have provided details to help us understand your masking of even what other transport is being used instead of the proper one it limits how we can help.

Detailed information helps us help you.