Skip to contentSkip to conversation

iptables udp 1195 MASQUERADE

DISCUSSION Enrique Huerta de la Fuente 2 participants 2 messages Feb 10, 2012 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 10 lines
Quoted 4 lines

Apply the rule: "iptables -t nat -I POSTROUTING -o ppp0 -j MASQUERADE", this masks the port 22 (tcp) but not the 1195 (udp), because I can
connect via ssh.

What do you mean by "masks"? What are you expecting the MASQUERADE target to do? From the little information I've seen, it looks like you are sending packets from a single interface from the local machine, in which case the MASQUERADE will have no effect anyway.

Quoted 6 lines
Quoted 2 lines

It seems the problem is that does not mask the port 1195 (udp).

MASQUERADE works fine with UDP whenever I have used it.

Andy

Hello Andy, thank you for the atention.

I have four interfaces and the default gateway is eth1

- eth0 (LAN)
- eth1 (internet link)
- eth3 (internet link)
- ppp0 (internet link)

I mark (mangle) package udp (1195) for out by interface ppp0. "iptables -t mangle -I OUTPUT -p udp -m udp --dport 1195 -j MARK --set-mark 1

and when i try MASQUERADE the package udp (1195) with "iptables -t nat -I POSTROUTING -p udp -m udp --dport 1195 -o ppp0 -j MASQUERADE", does not work!!

Any idea?

E.Huerta

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

I have four interfaces and the default gateway is eth1

- eth0 (LAN)
- eth1 (internet link)
- eth3 (internet link)
- ppp0 (internet link)

Quoted 6 lines

I mark (mangle) package udp (1195) for out by interface ppp0. "iptables -t mangle -I OUTPUT -p udp -m udp --dport 1195 -j MARK --set-mark 1

and when i try MASQUERADE the package udp (1195) with "iptables -t nat -I POSTROUTING -p udp -m udp --dport 1195 -o ppp0 -j MASQUERADE", does not work!!

I'm still not sure exactly what you're trying to achieve. Presumably you want different traffic going out on different interfaces, source-natted to that interface IP address.

If so, why not route your traffic as you are already doing (I assume that is working) and then just MASQUERADE each interface:

iptables -t nat -I POSTROUTING -o ppp0 -j MASQUERADE

Andy