[Asterisk-Users] SIP behind IPTables/NAT

Ian Pattison ianp at technologyassociates.ca
Tue Apr 26 06:56:23 MST 2005


Hi All,

Can anyone help me out here? I'm having some issues configuring my IPTables firewall to properly NAT SIP and RTP packets to my asterisk server hiding behind it.

Here are my current rules:

#Inbound SIP to HERMES
$IPTABLES -A PREROUTING -t nat -i $EXTIF -p udp --dport 5060 -j DNAT --to 192.168.123.4:5060
$IPTABLES -A FORWARD -i $EXTIF -p udp -d 192.168.123.4 --dport 5060 -j ACCEPT

#Inbound RTP to HERMES
$IPTABLES -A PREROUTING -t nat -i $EXTIF -p udp --dport 10000:20000 -j DNAT --to 192.168.123.4:10000:20000
$IPTABLES -A FORWARD -i $EXTIF -p udp -d 192.168.123.4 --dport 10000:20000 -j ACCEPT

When I dial out via my SIP provider I appear to get a partial connection (the phone rings... that's a good sign) but no audio. Inbound I just get a busy and asterisk sees nothing. SIP SHOW REGISTRY shows me as registered with the remote host. Something else that worries me is that I'm seeing the good old "Attempting native bridge..." message when the destination picks up which, to my understanding, shouldn't happen since I have "canreinvite=no" set for both my SIP phone and SIP provider.

Make sense to anyone?

Ian





More information about the asterisk-users mailing list