Centos 6, Centos 7 / Debian add multiple IPs to a single network card

Centos 6, Centos 7 / Debian add multiple IPs to a single network card

1. Add multiple IPs to a single network card in Centos 6

1. Check the network card information

 ip addr

See which network card IPv4 is bound to. Subsequent operations will require binding other IPs to this network card. For example, the Du Fu network card of valvps is eth1.

2. Add IP
Under SSH:

 cd /etc/sysconfig/network-scripts/ cp ifcfg-eth1 ifcfg-eth1:1 cp ifcfg-eth1 ifcfg-eth1:2 cp ifcfg-eth1 ifcfg-eth1:3 cp ifcfg-eth1 ifcfg-eth1:4

. . . And so on, add as much as you have.

 vi ifcfg-eth1:1

vi command:

Press I to start editing text content

Find the line DEVICE=eth1 and change it to DEVICE=eth1:1

Find the line IPADDR=xxx.xxx.xxx.xxx and replace it with the new IP

Vi Commands:

Press ESC, then enter: :wq (save, :wq are vi commands) to save and exit vi editing.

3. Restart

 chkconfig NetworkManager off chkconfig network on service NetworkManager stop service network start

or

 systemctl restart network.service

2. Add multiple IP addresses to a single network card in Centos 7
1. Check the network card information

 ip addr

See which network card IPv4 is bound to. Subsequent operations will require binding other IPs to this network card. For example, the Du Fu network card of valvps is eth1.

2. Add IP
Under SSH:

 cd /etc/sysconfig/network-scripts/

vi ifcfg-eno1

turn up

IPADDR="172.245.xxx.xxx"
PREFIX=”28″

Then add the next line:

IPADDR1="172.245.xxx.xxx"
PREFIX1=”28″
IPADDR2="172.245.xxx.xxx"
PREFIX2=”28″

Among them, 28 is filled in according to the IP segment provided by the host provider.

3. Restart

 chkconfig NetworkManager off chkconfig network on service NetworkManager stop service network start

or

 systemctl restart network.service

3. Add multiple IP addresses to a single Debian network card

1. Edit the /etc/network/interfaces file and add it in the following format:

 auto eth0 iface eth0 inet static address 8.8.8.115 netmask 255.255.255.0 network 172.16.3.0 broadcast 172.16.3.255 gateway 172.16.3.1 auto eth0:1 iface eth0:1 inet static address 8.8.8.116 netmask 255.255.0.0 network 10.16.0.0 broadcast 10.16.255.255

2. Create /etc/network/ifstate and add:

 lo=lo eth0=eth0 eth0:1=eth0:1

3. Finally, restart the network.

 /etc/init.d/networking restart

<<:  ValHost E3-1220v5 16GB RAM Los Angeles Dedicated Server Review

>>:  WebHi: $49/month/Atom™ C2750/16GB RAM/512GB SSD hard drive/unlimited traffic/DDOS protection/Europe

Recommend

DediStation: $15/year/3GB memory/50GB space/10TB traffic/OpenVZ/Canada

DediStation, created by the boss of hostwithlinux...

whois.com: cheap domain names with free whois protection

I have introduced whois.com before: WHOIS: .org d...

PHP-based file sharing website (QuickTransfer)

Similar to Firefox Send, it is easy to set up, su...

Dediserve: $5.5/month/1GB memory/20GB SSD/1.5TB traffic/KVM/Los Angeles

Dediserve has many data centers, but although the...