IPTABLES help

Could someone tell me what this line, that's been added to my router configuration at some stage, might be for:

iptables -t nat -I POSTROUTING -o eth1 -j SNAT --to

Thanks.

Reply to
Brian Gregory
Loading thread data ...

Drat, of course I meant:

iptables -t nat -I POSTROUTING -o -j SNAT --to

Thanks.

Reply to
Brian Gregory

All outgoing traffic is source natted with the IP of eth1.

Reply to
Burkhard Ott

Stuff happens ;-)

formatting link

[TXT] NAT-HOWTO.txt 05-Oct-2012 10:33 25K

Section 6.1

6.1. Source NAT

You want to do Source NAT; change the source address of connections to something different. This is done in the POSTROUTING chain, just before it is finally sent out; this is an important detail, since it means that anything else on the Linux box itself (routing, packet filtering) will see the packet unchanged. It also means that the `-o' (outgoing interface) option can be used.

Source NAT is specified using `-j SNAT', and the `--to-source' option specifies an IP address, a range of IP addresses, and an optional port or range of ports (for UDP and TCP protocols only).

## Change source addresses to 1.2.3.4. # iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 1.2.3.4

The whole HOWTO is about 700 lines

Old guy

Reply to
Moe Trin

This makes your internet work in your internal network if you don't have routable IP addresses for it.

Greetings Marc

Reply to
Marc Haber

Didn't mean to type eth1 there, just . It's the WAN port. I think it's actually ppp0, not eth1. Though eth1 is the PPPoE connection going to be modem.

Is this perhaps making it so that all outgoing packets have the correct from IP, so that I can't unwittingly be part of, say, a botnet that is spoofing the source IP of outgoing packets?

Though I'm not sure that would work through NAT anyway.

Reply to
Brian Gregory

Thanks. I must try and read up on this stuff thoroughly some time.

I think I see why it might have been added, see my reply to 'Burkhard Ott' below.

Reply to
Brian Gregory

Well then it shoud be ppp0, you should see then a ppp0 interface too if you do a ip a l.

What? If that would be a modification from malware, then you'd have a much bigger problem, since these rules need to be set by root.

Why not? It's just IP.

cheers

Reply to
Burkhard Ott

No.

I mean maybe that line was added by someone to make it impossible for us to be part of a botnet, or whatever, that is sending packets with a spoofed from address?

Reply to
Brian Gregory

That rule doesn't prevent you from participating in a bot net. It simply overrides the source address, making it so that you can't spoof your source IP. You can still participate in a bot net, just with your real external IP.

Reply to
Grant Taylor

That's what I said.

Reply to
Brian Gregory

Cabling-Design.com Forums website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.