Iptables this instruction, as shown in the following man query, it is used to filter packets and do NAT network address translation (network location translation), the application of a lot of this directive, can do many network application.
Iptables-administration tool for IPV4 packet filtering and NAT
Application 1: Let the computer in the area network share the bandwidth (real NAT) with a real IP
Schema diagram:
Required Equipment: One Linux server, 2 Web card
Network card 1:eth0, using real IP, network card 2:eth1, using 192.168.1.254
Setting: Write the following lines in/etc/rc.d/rc.local
echo "1" > /proc/sys/net/ipv4/ip_forward
modprobe ip_tables
modprobe ip_nat_ftp
modprobe ip_conntrack
modprobe ip_conntrack_ftp
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.1.0/24 -j MASQUERADE
Application 2: Allow computers in the area network to share bandwidth (implemented NAT) with an ADSL
This example is similar to the previous example, just a certain setting to be modified
Schema diagram:
Required Equipment: One Linux server, 2 Web card
Network card 1:eth0, using real IP, network card 2:eth1, using 192.168.1.254
Setting: Write the following lines in/etc/rc.d/rc.local
echo "1" > /proc/sys/net/ipv4/ip_forward
modprobe ip_tables
modprobe ip_nat_ftp
modprobe ip_conntrack
modprobe ip_conntrack_ftp
iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.1.0/24 -j MASQUERADE