iptables and NAT

Jeff jdyke at azimapower.com
Sat Feb 5 22:08:14 UTC 2005


I'm trying to set up a NAT using iptables on an aliased ip address to forward 
all mysql requests coming to 192.168.2.81:3306 192.168.2.81:3307.

The request will be coming from a windows host(192.168.2.10), which is the 
reason for jumping through this hoop of course, to a FC3 host running two 
versions of mysql, one on 192.168.2.80:3306 and one on 192.168.2.81:3307. Which 
i'd like[need] to have both up and available at all times.

The ips above(80&81) are aliases to eth0 named eth0:1 and eth0:2.

So far i've
echo 1 > /proc/sys/net/ipv4/ip_forward
to enable forwarding and restarted iptables, and saw
Setting chains to policy ACCEPT: nat filter [OK]  - when i restarted.

 From some web searching and man iptables i deceided to try the following:

iptables -t nat -A PREROUTING  -p tcp  -s 192.168.2.81 --source-port 3306  -d 
192.168.2.81 --destination-port 3307 -j DNAT --to-destination 192.168.2.81

Of course i've done something wrong, as i don't see this entry using iptables -L

Do i need to account for the outbound traffic from this request, or does it 
simply go back the way it came?  i'm new here :)

Thanks for any input you may have
Jeff





More information about the Redhat-install-list mailing list