NAT rules betweek 2 network interfaces (with iptables)
- by Simone Falcini
this is the current network that I have:
UBUNTU:
eth0:
ip: 212.83.10.10
bcast: 212.83.10.10
netmask 255.255.255.255
gateway 62.x.x.x
eth1:
ip: 192.168.1.1
bcast: 192.168.1.255
netmask: 255.255.255.0
gateway ?
CENTOS:
eth0:
ip: 192.168.1.2
bcast: 192.168.1.255
netmask 255.255.255.0
gateway 192.168.1.1
I basically want this:
Make specific NAT rules from the internet to specific internal servers depending on the port:
Connections incoming to port 80 must be redirected to 192.168.1.2:80
Connections incoming to port 3306 must be redirected to 192.168.1.3:3306
and so on...
I also need one NAT rule to allow the servers in the subnet 192.168.1.x to browse the internet. I need to route the requests on eth0 to eth1 to be able to exit to internet.
Can I do this on the UBUNTU machine with iptables?
Thanks!