Skip to contentSkip to conversation

iptables-problem

DISCUSSION amir_sarbazi 2 participants 2 messages Mar 26, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all

I have a Lan with range IP:192.168.1.0/24 that
192.168.1.3 is my webserver.
& have a firewall with 2 eth (eth0:192.168.1.2)
& (eth1:217.218.68.20) .
I want when firewall get web request packet
with eth1 then give it to eth0 & eth0 send
packet to 192.168.1.3:80.

I used these iptables that SNAT didn't work(Bad
argument):
iptables -A PREROUTING -t nat -p tcp -d
217.218.68.20 --dport 80 -j SNAT --to
192.168.1.2:80
or(--to-source 192.168.1.3:80)

But DNAT is working good:
iptables -A PREROUTING -t nat -p tcp -d
217.218.68.20 --dport 80 -j DNAT --to
192.168.1.3

with regards.

amir sarbazi

#1 lore raw

amir_sarbazi <[email protected]> :
[...]

Quoted 4 lines

I used these iptables that SNAT didn't work(Bad
argument):

 iptables -A PREROUTING -t nat -p tcp -d  217.218.68.20 --dport 80 \
   -j SNAT --to 192.168.1.2:80 or(--to-source 192.168.1.3:80)
$ LANG=en_US man 8 iptables
[...]
   SNAT
       This target is only valid in the nat table, in the POSTROUTING chain.
                                                          ^^^^^^^^^^^
--
Ueimor