NAT and asterisk/SIP


I have question regarding asterisk and NAT. My service provider has gave me
SIP trunk with fixed IP address, gw on the side of provider is
10.160.xx.x1/30 and my address (eth1) is 10.160.xx.x2/30 (directly connected to ISP via separate VPI/VCI on ADSL modem) and he also gave me address of SIP gateway which is also something like 10.4.xx.xx. There is no registration, I just have to route traffic toward SIP gw.
So second ethernet interface on asterisk server (eth0, my LAN side)- is and on that side I got connected couple of SIP phones (Avaya).
I didnt used NAT iptables on server- CentOS , nor I didnt enabled ip_forward.
Canreinvite is set to no in sip.conf and everything is working fine.
I can place and receive calls. So all this left me in wonder- how come that I didnt have to use/enable NAT on server or on asterisk in sip.conf?

Well if canreinvite=no then all communication on the phones is happening through the direction of the server which is talking on two interfaces… If the clients dont need to communicate to the SIP provider then no NAT is needed as all the traffic is bridged in your *server

You did not need to enable any NAT in sip.conf, because you do not have any NAT in your Asterisk setup :smile:

Your providers SIP server is not on the Internet but is on a providers dedicated VoIP network to which you connect via a dedicated NIC on your server (eth1). The provider assigned the Asterisk server IP address from its VoIP network, so you do not have or need any NAT there.

All your clients are on your LAN, to which your Asterisk server connects via another dedicated NIC (eth0). Again you do not have or need any NAT there.

You would need to configure NAT in sip.conf in case your Asterisk server is behind a NAT router and:

  • you would need to access your provider via your internet connection (providers SIP server is on the internet and has a public IP address)
  • you had extensions that connect to your Asterisk from the internet

first off all- thx for yours kind explanation,

I understand that my SIP trunk is not on a internet but my ISP give me private addresses from their VoIP network,
but what confuses me is that basically my calls goes toward ISP SIP gw with addresses of I was
thinkin’ that since I have to put on my eth1 that is toward ISP- 10.160.xx.xx/30 address- packets that goes toward
SIP gw of ISP also have to be of that address converted via NAT or will be rejected.