Linux Netfilter discussions
 help / color / mirror / Atom feed
* why can't I DNAT SIP?
@ 2008-05-08  1:10 sean darcy
  2008-05-08 19:31 ` Grant Taylor
  2008-05-09  0:31 ` Mike Wright
  0 siblings, 2 replies; 14+ messages in thread
From: sean darcy @ 2008-05-08  1:10 UTC (permalink / raw)
  To: netfilter

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-05-12 16:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-08  1:10 why can't I DNAT SIP? sean darcy
2008-05-08 19:31 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox