Source port different after passing through NAT

  • I have a PFsense router setup with NAT internally. I have a PBX system running freePBX and I have a wholesale SIP trunk from Gafachi. The problem that I am running into is that the source port on the audio is not the same when the router forwards the packet to Gafachi as it is when the PBX sends it. Apparently Gafachi requires that the source port be the same as the port that they use as a destination port for the audio. This problem seems to have just started with no changes being made to the configuration of PFsense, or the PBX. I am not sure why I did not see this problem before, or why it seems to have shown up out of nowhere, but I need to find out why the source port is changing and get it fixed. Does anyone have an idea on what I need to do to fix this?

    I am running PFsense 2.0 on a computer with a core 2 duo processor, I have 3 network connections on it, 1 is going to the internet, 1 is going to most of the internal network, and the last one is connecting to the PBX.

  • @thexder1:

    I need to find out why the source port is changing and get it fixed.

    Change the outbound nat mode do manual and create an outbound nat rule to your sip server with static port option selected.

  • I think that might work, but right now that seems to have completely broken it. for some reason no matter what I try it looks  like it is not translating the address at all. I am not sure why it is doing that. Probably a setting that I am not aware of.

  • NM I figured out that part of it. Now I have to get Gafachi to fix a problem on their end and I think I will have it working now.

  • You can try static-port as marcelloc suggested, but generally speaking most providers have no issues with port rewriting (which is pfsense's default behavior since v2.x).

  • I got it to work. This is not the first time that I have had to do setup like this to get the Gafachi trunk working. I will be switching to a different provider as soon as possible since this is the second time they seem to have changed the setup on their end without notification and caused my phone system to go down, right in the middle of doing a lot of advertising.