Manually Set Asterisk Network IP Address -- Contact and Network IP Mismatch

Details:

Component/s:    	Asterisk Configuration
Asterisk Version:	Asterisk 16.27.0
Distro Version: 	FreePBX 16.0.21.3
Distro:    		FreePBX Distro

Description:

On some networks, ours included, multiple external IP addresses can be assigned to a single port. For example, you purchase a block of five IP addresses from your ISP. All five IP’s are then assigned to the WAN port of the firewall/router.

FreePBX automatically queries the firewall and gets a response under CONNECTIVITY->SIP STATION. Clicking the Check Connectivity button returns the first IP address assigned to the WAN port.

The Issue: We need to assign one of the other IP addresses listed on the WAN port. Another FreePBX server has already grabbed the first listed IP address and is in use on the “OLD” FreePBX server. Installing a “NEW” FreePBX server requires one of the other static IP addresses.

The Problem: Have not been able to assign one of the other available static IP addresses. We have attempted to locate the Asterisk file that controls this but did not find the appropriate file.

Attempted Fix: Have reviewed Asterisk Config Files: pjsip.transports.conf and sip_general_additional.conf. The files reflect the correct “Your Contact IP” but no mention of the “Your Network IP”. I suspect that there is a specific FreePBX file for this configuration but have not located it. Perhaps this is a feature request?

Request: How can I manually set the “Your Network IP” so that it matches the “Your Contact IP”? How do we manually assign IP addresses?

Additional Info: I have manually set the IP address in Asterisk SIP Settings on both the General SIP Settings and the SIP Setting [chan_pjsip] tabs. The correct (desired) IP address was assigned to External Address and External IP Address boxes.

FreePBX is just going out to the internet and asking what IP address is seen, similar to going to http://whatismyip.akamai.com. So you will need to update your firewall so that you have a 1:1 NAT for your FreePBX server and the WAN address you want assigned to it. And once that is done, you will not need to make any adjustments to FreePBX other than to go into Asterisk SIP Settings and click the detect button again, Apply Configuration, and then restart asterisk (due to transport changes).

Hi @billsimon:

Thanks for your prompt reply. Currently, we have a 1:1 NAT configured and have confirmed that we can access the ports directly related to the NAT. Unfortunately, the issue still exists. The IP addresses assigned to the WAN port as follows:

x.x.x.128
x.x.x.129
x.x.x.127

The current active server is using x.x.x.128 and the new server needs x.x.x.127. When FreePBX queries the router, it only reports the first IP address in the list; even with the NAT in tact. There are two separate configurations in play here. The Contact IP and the Network IP. I am successful configuring the Contact IP, it is the Network IP that poses the problem.

NEW SERVER:

EXISTING SERVER:

When the CHECK CONNECTIVITY button is used to detect the IP address, it only returns the first IP address in the list on both servers. Once a server registers with the first IP address, the second server will error because it’s trying to register the same address.

EXISTING SERVER:

NEW SERVER:

I don’t recognize My Contact Address and My Network Address as anything that would appear in the configuration files. I suspect what you want is the external media and signalling addresses:

These are controllable through the GUI.

However, first you should, as already said, fix these in the router, as it seems that outgoing traffic isn’t being assigned your desired address and may well be having the port rewritten.

The only network addresses that Asterisk is interested in are the networks inside your LAN (but not the individual router and host addresses for them), as it need these to know when to use the address of its LAN interface, rather than the external address on the router.

Incidentally, what ism much more likely than an interface with multiple addresses, here, is one with a single address which is being used as the destination for a route coming in from the ISP, in basically the same way as every address on the internet doesn’t actually exist on the LAN side interface on the router.

@wingutechnology get on the console or SSH session of FreePBX and do a curl http://whatismyip.akamai.com to make sure your NAT is working as you expect.

Hi @billsimon and @david55:

After confirming with our firewall guy, we were not in fact 1:1 nat’d as I presumed. This should resolve our issue. Thanks for your patience and expertise.

You still need to go into the Chan_PJSIP settings and make sure your transport has the proper information inside it. The external media and signalling need to be set to the .127 IP along with your proper local network details. When the destination doesn’t match a local network it will update the SIP packet with the external media/signalling details of the transport. It will set the contact, SDP, etc to .127.

You will also need to make sure that requests from the PBX, when leaving the WAN, are also using the .127 as its source otherwise if it uses .128 it could route replies back to the wrong WAN IP. That is going to be router level though.

Hi @BlazeStudios:

Thank you for the additional information. We do in fact have the chan_pjsip IP configurations in place pointing to .127. I believe this is what allows the “Your Contact IP” to be set correctly. A correctly configured 1:1 NAT should resolve the “Your Network IP” and allow correct outgoing requests when leaving the WAN over the correct .127 IP address.

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