Recently, we have to use UbuntuLinux's iptablesNAT function to map ports. However, the interface machine only has one Nic. To enable 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.6netmask00000000255.0gateway192.168.100.12. Assume that the Internet IP address is address1900008.
I recently used the iptables NAT Function of Ubuntu Linux to map ports, but the interface machine only has one Nic. To achieve both Intranet access and Internet access, I 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
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-04/115785.htm