Linux Netfilter discussions
 help / color / mirror / Atom feed
From: sean darcy <seandarcy2@gmail.com>
To: netfilter@vger.kernel.org
Subject: why can't I DNAT SIP?
Date: Wed, 07 May 2008 21:10:53 -0400	[thread overview]
Message-ID: <fvtjuu$7i1$1@ger.gmane.org> (raw)

On my outside box I trying to route sip ( port 5060 ) and iax ( 4659 ) 
packets to an internal asterisk server. I use DNAT, which works fine for 
  iax, but doesn't for SIP. I'm using identical DNAT statments.

The log shows the SIP packets coming in, but then going to the INPUT 
chain. Nothing shows up on the FORWARD chain.

iptables -L -n -v -t nat
Chain PREROUTING (policy ACCEPT 168K packets, 17M bytes)
  pkts bytes target     prot opt in     out     source 
destination
     0     0 DNAT       udp  --  external *       0.0.0.0/0 
0.0.0.0/0           udp dpt:4569 to:10.10.10.180:4569
     0     0 DNAT       udp  --  external *       0.0.0.0/0 
0.0.0.0/0           udp dpts:10000:10100 to:10.10.10.180
     0     0 DNAT       udp  --  external *       0.0.0.0/0 
0.0.0.0/0           udp dpt:5060 to:10.10.10.180:5060

Chain POSTROUTING (policy ACCEPT 3098 packets, 298K bytes)
  pkts bytes target     prot opt in     out     source 
destination
     0     0 LOG        udp  --  *      lan     0.0.0.0/0 
0.0.0.0/0           udp dpt:5060 LOG flags 0 level 4 prefix `SIP-POST: '
     5   268 SNAT       all  --  *      external  0.0.0.0/0 
0.0.0.0/0           to:xxx.yyy.zzz.ooo


IPT=/sbin/iptables

# first, flush all chains
/sbin/iptables  -F
/sbin/iptables -t nat -F
$IPT  -t raw -F
/sbin/iptables  -X

# log SIP packets

$IPT -t raw -A PREROUTING -p udp --dport 5060 -s ext-box -j LOG 
--log-prefix "GATEWAY:   "
$IPT  -A FORWARD -p udp --dport 5060 -s ext-box  -j LOG --log-prefix 
"SIP-FWD:    "
$IPT  -A INPUT -p udp --dport 5060 -s ext-box  -j LOG --log-prefix 
"SIP-INPUT:    "
$IPT -t nat -A POSTROUTING -s 76.248.148.160 -p udp --dport 5060  -j LOG 
--log-prefix "SIP-POST: "

##  DNAT iax packets

$IPT -t nat -A PREROUTING -i external -p udp --dport 4569 -j DNAT --to 
10.10.10.180:4569
$IPT -A FORWARD -p udp -m state --state NEW -d 10.10.10.180 --dport 4569 
-j ACCEPT

# this should do the same for sip

$IPT -t nat -A PREROUTING -s ext-box  -p udp --dport 5060 -j DNAT --to 
10.10.10.180:5060
$IPT -A FORWARD -p udp --dport 5060 -m state --state NEW -d 10.10.10.180 
-j ACCEPT

.............

The log shows SIP packets both at GATEWAY and SIP-INPUT.

Any help appreciated.

sean


             reply	other threads:[~2008-05-08  1:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-08  1:10 sean darcy [this message]
2008-05-08 19:31 ` why can't I DNAT SIP? Grant Taylor
2008-05-08 22:24   ` sean darcy
2008-05-09  1:18     ` sean darcy
2008-05-09 14:15     ` Grant Taylor
2008-05-09 14:23       ` Patrick McHardy
2008-05-10  2:04         ` sean darcy
2008-05-10  8:43           ` Jan Engelhardt
2008-05-11 14:53             ` sean darcy
2008-05-11 14:58               ` Jan Engelhardt
2008-05-11 18:02                 ` sean darcy
2008-05-11 18:12                   ` Jan Engelhardt
2008-05-12 16:01           ` Patrick McHardy
2008-05-09  0:31 ` Mike Wright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='fvtjuu$7i1$1@ger.gmane.org' \
    --to=seandarcy2@gmail.com \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox