How to Implement Dual IP addresses for a single network card in Ubuntu

Source: Internet
Author: User
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.

 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.