Different Linux distribution a network adapter to configure multiple IP method is basically the same, but the edited file is different.
1. Ubuntu Configuration Multiple IP
Edit/etc/network/interfaces:sudo Vi/etc/network/interfaces, and then follow interfaces eth0 configuration to add interfaces to eth0:0. For example:
The original interfaces is:
Auto Eth0
Iface eth0 inet Static
Name Ethernet Lan Card
Address 192.168.1.2
Netmask 255.255.255.0
Network 192.168.1.0
Broadcast 192.168.1.255
Gateway 192.168.1.1
The edited interfaces are:
Auto Eth0
Iface eth0 inet Static
Name Ethernet Lan Card
Address 192.168.1.2
Netmask 255.255.255.0
Network 192.168.1.0
Broadcast 192.168.1.255
Gateway 192.168.1.1
Auto eth0:0
Iface eth0:0 inet Static
Name Ethernet
Address 192.168.2.2
Netmask 255.255.255.0
Network 192.168.2.0
Broadcast 192.168.2.255
Gateway 192.168.2.1
2. Domestic Linux (Red Hat, CentOS, etc.)
Edit/etc/sysconfig/network-scripts/ifcfg-eth0:sudo Vi/etc/sysconfig/network-scripts/ifcfg-eth0, Then follow the Ifcfg-eth0 top eth0 configuration, add eth0:0 in Ifcfg-eth0. For example:
The ifcfg-eth0 before editing is:
Device=eth0
Bootproto=static
broadcast=192.168.4.255
Hwaddr=xx:xx:xx:xx:xx:xx
ipaddr=192.168.4.2
netmask=255.255.255.0
network=192.168.4.0
Onboot=yes
Type=ethernet
gateway=192.168.4.1
dns1=192.168.0.20
dns2=192.168.0.21
The edited Ifcfg-eth0 are:
Device=eth0
Bootproto=static
broadcast=192.168.4.255
Hwaddr=xx:xx:xx:xx:xx:xx
ipaddr=192.168.4.2
netmask=255.255.255.0
network=192.168.4.0
Onboot=yes
Type=ethernet
gateway=192.168.4.1
dns1=192.168.0.20
dns2=192.168.0.21
device=eth0:0
Bootproto=static
broadcast=192.168.1.255
Hwaddr=xx:xx:xx:xx:xx:xx
ipaddr=192.168.1.2
netmask=255.255.255.0
network=192.168.1.0
Onboot=yes
Type=ethernet
gateway=192.168.1.1
dns1=192.168.0.20
dns2=192.168.0.21
"Note": 1. If more than one IP is configured in domestic Linux, the network must be restarted every time the system is started, and the IP that will be able to access the Internet should be edited to the end, and the example above should be written to eth0:0, and Ubuntu does not appear to have similar problems.
2. If you are installing a desktop version of Linux, then set the above configuration file and desktop environment configured IP conflict, and the desktop environment can not be configured to a network card multiple IP, even if configured only the first entry into force, so we recommend using a configuration file to implement a network of multiple IP configuration, And in order to prevent the conflict needs to be configured before configuring the Linux operating mode to mode 3, that is, perform #init 3, and then restart the network, through the configuration file configured IP will take effect. However, the transformation of Linux run mode will kill the GNOME or KDE process, so the desktop environment can not be used, so it is recommended to install the server version of Linux.