Skip to contentSkip to conversation

Masquerade UDP doesn't work

DISCUSSION Enrique Huerta de la Fuente 3 participants 3 messages Feb 9, 2012 – Feb 14, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hello,

Masquerade do not work at a UDP port, but if it works at a TCP port.

(works) iptables -t nat -I POSTROUTING -m tcp -p tcp --dport 22 -o ppp0 -j MASQUERADE (not working) iptables -t nat -I POSTROUTING -m udp -p udp --dport 1195 -o ppp0 -j MASQUERADE

Any ideas?

regards

E.Huerta

#2 lore raw
Quoted 9 lines · Enrique Huerta de la Fuente

Hello,

Masquerade do not work at a UDP port, but if it works at a TCP port.

(works) iptables -t nat -I POSTROUTING -m tcp -p tcp --dport 22 -o ppp0 -j MASQUERADE
(not working) iptables -t nat -I POSTROUTING -m udp -p udp --dport 1195 -o ppp0 -j MASQUERADE

The "-m udp" confuses me. Do you really need to specify that module, try it without the -m option for UDP, I don't tend to use it for TCP either, but if it's not broken, don't fix it...

Signature · 1 line
Message sent via my webmail account.
#3 lore raw
Quoted 11 lines · Giles Coochey
Quoted 9 lines · Enrique Huerta de la Fuente

Hello,

Masquerade do not work at a UDP port, but if it works at a TCP port.

(works) iptables -t nat -I POSTROUTING -m tcp -p tcp --dport 22 -o ppp0 -j MASQUERADE
(not working) iptables -t nat -I POSTROUTING -m udp -p udp --dport 1195 -o ppp0 -j MASQUERADE

Quoted 3 lines

The "-m udp" confuses me. Do you really need to specify that module, try it without the -m option for UDP, I don't tend to use it for TCP either, but if it's not broken, don't fix it...

Note that -p only looks at the IP header, but -m udp is required for the UDP header. So yes, -m udp is required (though it's added automatically if you forget it).