Recently, we need to use the Linux iptablesNAT function to map ports, but the interface machine only has one Nic. To achieve both Intranet access and Internet access, we need to use the methods described below: 1. Assume that the Intranet IP address is address192.168.100.6netmask?255.255.0gateway192.
We recently used the Linux iptables NAT Function to map ports,
However, the interface machine has only one Nic, which must be able to access both the Intranet and the Internet,
So we need to use the methods described below:
1. Assume that the Intranet IP address information is:
Address 192.168.100.6
Netmask 255.255.255.0
Gateway 192.168.100.1
2. Assume that the Internet IP address is:
Address 192.168.200.188
Netmask 255.255.255.0
Gateway 192.168.200.1
3. Assume that the network card in the system is eth0.
4. You can directly modify the Ubuntu IP configuration file:
# Vim/etc/network/interfaces
Then, refer to the following content and I believe that all Linux kids shoes can be understood ~
# This file describes the network interfaces available on your system # and how to activate them. for more information, see interfaces (5 ). # The loopback network interfaceauto loiface lo inet loopback # The primary network interfaceauto eth0iface eth0 inet staticaddress 255.255.255.255.0 # gateway 192.168.100.1 # The following is The setting of The Internet IP Address auto eth0: 1 iface ETH: 1 inet staticaddress 192.168.200.188netmask 255.255.255.0gateway 192.168.200.1
After modification, wq! Exit and save, and then restart the NIC:
#/etc/init.d/networking restart
OK.