Network configuration file Settings: http://www.cnblogs.com/LJ-fish/archive/2010/05/17/1737674.html
There are many places to work with Ubuntu iptables , such as: intranet Port mapping
1. System Environment
Intranet Two servers:
A 172.16.119.128
B 172.16.119.129
You want to map the 80 port of a machine to the 8013 port of the B machine.
2. Set Steps
2.1./etc/sysctl.conf Configuration file Modification
Delete "#" in front of the "# Net.ipv4.ip_forward = 1" line. The line is commented out by default.
2.2. View existing configuration information
Iptables-l
If the display reads as follows:
Chain INPUT (Policy ACCEPT)
Target Prot opt source destination
Chain FORWARD (Policy ACCEPT)
Target Prot opt source destination
Chain OUTPUT (Policy ACCEPT)
Target Prot opt source destination
Indicates no settings, you can continue to the next step.
Otherwise execute:
Iptalbes-f
Iptalbes-x
Iptalbes-z
2.3. Set Port Mappings
Execute separately:
Iptables-t nat-a prerouting-d 172.16.119.128-p tcp--dport 80-j dnat--to-destination 172.16.119.129:8013
Iptables-t nat-a postrouting-d 172.16.119.129-p tcp--dport 8013-j SNAT--to 172.16.119.128
Iptables-a forward-o eth0-d 172.16.119.129-p tcp--dport 8013-j ACCEPT
Iptables-a forward-i eth0-s 172.16.119.129-p tcp--sport 8013-j ACCEPT
2.4. Verify Port Mappings
At this point, access to http://172.16.119.128/abc.htm, should be able to access the corresponding 129 server port to 8013 Web site abc.htm page.
3. Set the boot automatically load iptables configuration file
3.1 Save Configuration
To execute a command:
# Iptables-save >/etc/init.d/iptables.up.rules
Save the current configuration in Iptables.up.rules file, the filename can be determined by itself.
3.2 To modify the NIC configuration file
At the end of the network card IP profile/etc/network/interfaces (/etc/init.d/iptables.up.rules can be changed to its own defined configuration file location and name)
Pre-up Iptables-restore </etc/init.d/iptables.up.rules
3.3 Reboot Server Authentication
Shutdown-r now
Through the introduction of the three steps of the text, we clearly know the formation of the Ubuntu iptables Intranet port mapping. I hope it works for you.