Asterisk PBX server behind NAT (asterisk port forwarding)
If Your asterisk server is behind NAT then to access asterisk from outside world you need to use the port forwarding features of iptables in Linux.
Steps for asterisk Port forwarding
1] Check rtp.conf file in asterisk
root@indiangnu.org:/etc/asterisk# cat rtp.conf
;
; RTP Configuration
;
[general]
;
; RTP start and RTP end configure start and end addresses
;
rtpstart=10000
rtpend=20000
root@indiangnu.org:/etc/asterisk#
* In rtp.conf file rtpstart and rtpend variables defines which range of port is your asterisk server using for data transfer at real time it is 10000 to 20000 range.
*supose IP address of Asterisk server is 192.168.1.150
2] Apply iptables rules for port forwarding
#Port forwarding for Asterisk
itables -I FORWARD -s 192.168.1.150 -p tcp –dport 5060 -j ACCEPT
#port forwarding for TCP
itables -A PREROUTING -t nat -i eth3 -p tcp -m tcp –dport 5060 -j DNAT –to-destination 192.168.1.150
#port forwarding for UDP
iptables -A PREROUTING -t nat -i eth3 -p udp -m udp –dport 5060 -j DNAT –to-destination 192.168.1.150
#port forwarding for RTP traffic
iptables -I FORWARD -s 192.168.1.150 -p udp –dport 10000:20000 -j ACCEPT
iptables -A PREROUTING -t nat -i eth3 -p udp –dport 10000:20000 -j DNAT –to-destination 192.168.1.150
Thank you,
Arun Bagul
Similar Posts:
- Asterisk md5secret password problem
- SSH tunneling – for SOCK proxy port forwarding
- Installing and configuring SSHD Filter
- Caller ID problem with Aserisk?
- Zimbra with non 80 port ( Zimbra with 7071 and 8086 port and Apache web server on 80 port)
- Installation of Vmware-Exsi 5.0 Server
- PHP – How to Filter/validate IP Address?
3 Replies to “Asterisk PBX server behind NAT (asterisk port forwarding)”
good Article
hmm, i found this confusing.
is eth3 your internal, or external interface in this case?
Well I managed to get it to work in the end. Have a look at http://www.linuxjournal.com/article/9399 if you’ve ran into any issues here, and you should be sorted. 😉