[VLAN] NAT between VLANS

Jonathan Petersson jpetersson at mysql.com
Mon Mar 5 07:59:18 PST 2007


Hi everyone I've a question in regards of using NAT between VLANS, 
here's a forum post which I posted at linuxquestions.org

I'm currently about to replace our existing 10.0.0.0/8 network into 
several /24 networks.
This covers 200+ servers.

Since I've NFS shares across the network I need to have these up and 
running meanwhile I'm doing the IP-range changes.

For this I though that SNAT and DNAT would be a good solution but I 
haven't succeeded doing it.

For the test I've 2 VLANS.

eth0
eth0.10 10.128.16.0/24
eth0.20 10.128.17.0/24

Not I want to map lets say 10.100.1.20 to the host who has 10.128.17.2 
on VLAN eth0.20.

For doing this I did it this way.

# ip addr add 10.100.1.20/8 dev eth0
# iptables -t nat -I PREROUTING -i eth0 -s 0.0.0.0/0 -d 10.100.1.20 -j 
DNAT --to-destiation 10.128.17.2
# iptables -t nat -I POSTROUTING -o eth0 -s 10.128.17.2 -d 0.0.0.0/0 -j 
SNAT --to-source 10.100.1.20

I've used this setup earlier to map external addresses to a internal ip 
address but in this case it doesn't seam to work.

By doing some tcpdumps the ICMP never seams to reach the final host but 
the gateway instead.

Please advice, thanks!

-- 
-----------------------------------------------------------------------
  __  ___     ___ ____  __    Jonathan Petersson, System Administrator
 /  |/  /_ __/ __/ __ \/ /    MySQL AB, Uppsala, Sweden
/ /|_/ / // /\ \/ /_/ / /__   Mobile: +46 732 00 16 78
/_/  /_/\_, /___/\___\_\___/   SIP: 4431 at sip.mysql.com
      <___/   www.mysql.com   Phone: +46 18 17 44 31
-----------------------------------------------------------------------
          Are you MySQL certified? www.mysql.com/certification



More information about the Vlan mailing list