Community discussions

MikroTik App
 
TurboCow
just joined
Topic Author
Posts: 12
Joined: Thu Jun 14, 2018 11:21 pm

SIP Trunk won't connect. Possible port NAT gone wrong?

Fri Jun 15, 2018 5:27 pm

Hello All,

I'm having a problem connecting a Asterisk SIP trunk between my G and my O router. Routers are at different counties.
I can ping between them.
When I try to set up a trunk between them in Asterisk, my O router passes traffic on the 5060 ports, but my G router changes the port from 5060 to 1024 on the Reply Dst. Address.
Is the port change causing the problem and how do I stop it from changing the reply dest address port?
Pic attached.
You do not have the required permissions to view the files attached to this post.
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11317
Joined: Mon Dec 04, 2017 9:19 pm

Re: SIP Trunk won't connect. Possible port NAT gone wrong?

Sun Jun 17, 2018 3:13 pm

When doing src-nat, Mikrotik seems to prefer to keep the original port unchanged where possible; where possible means that no connection already exists with the same remote socket address and using the same local public socket address (socket address = ip.add.re.ss:port). Since the source port of your Asterisk gets replaced to 1024, I assume some other SIP device behind the G router also connects to router O's public address and port 5060. So G delivers any packet from O:5060 to G:5060 to that other device, and thus the connection initiated by the Asterisk had to get another port on the public address.

The remedy should be to use a dst-nat rule forwarding packets coming to G:5060 to the Asterisk, thus "reserving" port 5060 for the Asterisk and forcing the connections of other device(s), presumably phones registering to the PBX behind O, to get the different port.

Or you may create an IPsec tunnel between O and G and bypass the NAT issues completely.