Independent servers can be bound to multiple IPs, and merchants generally give away 2-5 IP addresses when purchasing independent servers. Independent IP addresses are very beneficial to SEO for multiple sites. Of course, it is a waste to use a dedicated server to build a website. We can virtualize the dedicated server into a VPS host so that more people can use it.

Binding multiple IPs to a standalone server and adding multiple IP addresses to SolusVM are, strictly speaking, two different things. If you find that the IP address assigned to the VPS host created by SolusVM is not connected to the network, you may check whether other IP addresses are bound to the server's network card. One IP can only be used by one server, otherwise there will be a conflict.

VPS host, independent server binding multiple IPs and SolusVM method of adding multiple IP addresses - network card configuration multiple IPs

This article will share how to bind multiple IP addresses to an independent server and how to add multiple IP addresses to SolusVM. There are more related tutorials about independent servers (friends looking for VPS can read my special topic: VPS host ranking list):

  1. Solution to Linux system disk space full-No Space Left on Device error
  2. Linux Crontab command scheduled task basic syntax and operation tutorial-VPS/Server Automation
  3. Use SolusVM to set up a NAT VPS host on the server/VPS - integrate WHMCS to sell NAT VPS

1. Preparation conditions

A VPS host or dedicated server. If you want a fast VPS host, you can find it here: CN2 GIA VPS host collection and summary. Some hosting providers support adding IP to VPS hosts, but some hosting providers do not provide such services. Please read the instructions carefully before purchasing.

SolusVM master and slave have been installed and configured. If it is KVM and you need to configure the network bridge at the same time, friends who have not used SolusVM can first learn about it: Server virtualization panel SolusVM installation and use - supports new management of OpenVZ, KVM and Xen VPS.

Calculate the IP address. After the host provider purchases an IP address, it will usually provide a network address, gateway address and mask bits. Friends who do not understand can directly use online calculation tools to find out which IP addresses they can use.

  1. HTTP://tool. Which kind of food to eat.com/tools/subnetmosaic

2. VPS host or independent server binds multiple IPs

2.1 CentOS 6 adds binding to a single IP

First, execute the command: cd /etc/sysconfig/network-s #Enter the network card configuration directory, command: cp ifcfg-eth0  ifcfg-eth0:0 #Copy is in use network card configuration file.

After opening the ifcfg-eth0:0 file with vi, you can see the copied network card information. We only need to keep the following items and modify the IP. If there are different IP segments, gateways need to be added.

DEVICE=eth0:0 #此处添加:0,保持和文件名一致,添加多个ip依次递增
ONBOOT=yes #是否开机激活
BOOTPROTO=static #静态ip,如果需要dhcp获取请输入dhcp
IPADDR=192.168.1.2 #此处修改为要添加的ip
NETMASK=255.255.255.0 #子网掩码根据你的实际情况作修改

GATEWAY=192.168.1.1 #如是不同段ip需要添加网关

After adding, restart the network card to take effect: service  network restart

2.2  CentOS 6 adds binding to multiple IPs or IP segments

First, create a new file ifcfg-eth0-range0 in /etc/sysconfig/network-scripts/ (Note: the name of the new file is the name of the network card in use - range0). After creation, use vi editor: vi /etc/sysconfig/network-scripts/ifcfg-eth0-range0.

Enter the following file content format:

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR_START=起始IP地址
IPADDR_END=结束IP地址
CLONENUM_START=0 子网卡命名起始数 

GATEWAY=网关地址
NETMASK=子网掩码
NO_ALIASROUTING=yes 

If there are multiple IP segments that need to be added, be careful not to mistake the starting position of the subnet card name. Name the second segment as -range1 and so on. After the addition is completed, restart the network card to take effect: service  network restart

DEVICE=eth0:0 #此处添加:0,保持和文件名一致,添加多个ip依次递增
ONBOOT=yes #是否开机激活
BOOTPROTO=static #静态ip,如果需要dhcp获取请输入dhcp
IPADDR=192.168.1.2 #此处修改为要添加的ip
NETMASK=255.255.255.0 #子网掩码根据你的实际情况作修改 

GATEWAY=192.168.1.1 #如是不同段ip需要添加网关 

2.3  Ubuntu adds binding IP

Determine the name of your ethernet device. In this example, we’ll use eth0.

ip link show

Add the following lines in /etc/network/interfaces:

auto eth0:0
iface eth0:0 inet static
address 1.2.3.5
netmask 255.255.255.0

Activate the alias with the following command:

ifup eth0:0

If it is Ubuntu 16.x, first execute the following command to display the network card you are using:

ip link show

Then add in /etc/network/interfaces:

auto ens3:0
iface ens3:0 inet static
address 1.2.3.5
netmask 255.255.255.0

activation:

ifup ens3:0

3. Add multiple IP addresses to SolusVM

Example of adding an IP segment:

2.2.2.1/27

Edit the file: vi  /etc/sysconfig/network-scripts/ifcfg-br0:0 , add the following content:

DEVICE=br0:0 
BOOTPROTO=static 
IPADDR=2.2.2.1 
NETMASK=255.255.255.224 
ONBOOT=yes 

Then, execute restart network: service network restart. At the same time, check whether: cat /etc/sysctl.conf is net.ipv4.ip_forward = 1. If not, modify it with the following command:

echo 1 > /proc/sys/net/ipv4/ip_forward

Finally, go back to SolusVM and add IP Block, gateway is set to 2.2.2.1, and netmask is set to: 255.255.255.224 as above.

4. Summary

One of the most critical steps before adding an IP is to find out the name of the network card you are currently using. It may be eth0 or eth1, etc. When you modify the configuration file, remember to replace the above code with your own IP address.

If you want to assign the IP to a virtual VPS through SolusVM, there is no need to bind it to the server. SolusVM's KVM architecture involves KVM Bridge Setup. When adding multiple IPs, you only need to modify br0:0.

Leave a Reply