iptables/SNAT not working

From: Steffen Koepf (Taxman-usenet_at_opaya.de)
Date: 01/31/05


Date: Mon, 31 Jan 2005 18:48:16 +0100 (CET)

Hello,

i try to get SNAT working, but with no success.

The setup is:
Network A (eth1): 10.11.112.0/24 (Routed worldwide)
Network B (eth2): 192.168.21.0/24 (Private)

There is a laptop within Network B (192.168.21.52) that should
reach the world (www, telnet, ...).

I did on the linux router:

/sbin/ip addr add 10.11.112.106 brd + dev eth1 label eth1:2

/usr/sbin/iptables -t nat -A POSTROUTING -s 192.168.21.52 -o eth1 -j SNAT --to 10.11.112.106

Used kernel is 2.6.10.
There is no other rule in iptables.
/proc/sys/net/ipv4/ip_forward contains a "1".

What happens is, that packets from the laptop are routed out to the world
but keep the source address (and coz of this, the answer never reaches the
router), the iptables rule does never match:

root@tkserv:/home/sk# iptables -L -n -x -v -t nat
Chain PREROUTING (policy ACCEPT 202 packets, 13260 bytes)
    pkts bytes target prot opt in out source destination

Chain POSTROUTING (policy ACCEPT 61 packets, 7239 bytes)
    pkts bytes target prot opt in out source destination
       0 0 SNAT all -- * eth1 192.168.21.52 0.0.0.0/0 to:10.11.112.106

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
    pkts bytes target prot opt in out source destination
root@tkserv:/home/sk#

Does someone know whats wrong and can help me?

Greetings,

Steffen



Relevant Pages

  • Re: Ethernet issue: works one way but not another
    ... packets transmitted, 5 packets received, 0% packet loss ... (This is when connected directly to internet through ... FBSD, I have been working with BSDI at the isp I work for for the last ... As for my network topology, I have an internal network that goes ...
    (freebsd-questions)
  • Re: Update: UDP 770 Potential Worm
    ... > the network immediately after the 'attack', ... were no packets indicating some form of replication. ... I noticed that the UDP ... > of the UDP datagrams is the IP address of the proxy? ...
    (Incidents)
  • Re: IDSIPS that can handle one Gig
    ... especially with 64-byte UDP packets. ... There are plenty of network IPS's ... IDS/IPS devices through use of fragments. ... Find out quickly and easily by testing it with real-world attacks from ...
    (Focus-IDS)
  • Re: iptables and dhcp
    ... > the same physical network segment as the firewall and the remote DHCP ... You used INPUT and not FORWARD chain ... # This target allows packets to be marked in the mangle table ...
    (comp.os.linux.networking)
  • RE: Mapping Class A network ( any easy trick?)
    ... and wondering how I can map the network ... packets per second rate to ask for. ... This will read the payloads.conf file which may have multiple payloads ... per port. ...
    (Pen-Test)