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

Ultravps.eu 1GB RAM SSD Hard Drive German KVM VPS Review

Details: UltraVPS.eu: €12/year/256MB memory/10GB ...

rlshosting latest 60% discount code

Love8 has an introduction: http://love8.org/6341....

WootHosting: $15/year/1GB RAM/50GB storage/3TB bandwidth/OpenVZ/Miami

WootHosting, an American hosting provider, was fo...

PieLayer: VPS starting at $10, with locations in Germany, France, etc.

PieLayer, old and stable. The latest offers are a...

Sharktech: $95/year/512MB RAM/40GB storage/unlimited traffic/KVM/Los Angeles

Sharktech, a long-established American hosting pr...

vpsdime: $8/year/128MB/5GB space/250GB traffic/OpenVZ

vpsdime previously launched $15/year/512MB/30GB s...