HostOnNet Blog

Add IP Address in CentOS Server

Looking for Linux Server Admin or WordPress Expert? We can help.

On a dedicated server, we got following IP range

107.150.52.19 - 107.150.52.22

By default, only one IP was configured on the server.

To Add extra IP, create file

vi /etc/sysconfig/network-scripts/ifcfg-eth0-range0

With following content

IPADDR_START=107.150.52.19
IPADDR_END=107.150.52.22
CLONENUM_START=0

Restart network, make sure you have not made any mistake.

service network restart

Now all IP will be available on the server

[root@localhost ~]# ifconfig | grep 'inet'
          inet addr:107.150.52.18  Bcast:107.150.52.23  Mask:255.255.255.248
          inet6 addr: fe80::226:9eff:fe1d:c9e/64 Scope:Link
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0-range0
[root@localhost ~]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Determining if ip address 107.150.52.18 is already in use for device eth0...
Determining if ip address 107.150.52.20 is already in use for device eth0...
Determining if ip address 107.150.52.21 is already in use for device eth0...
Determining if ip address 107.150.52.22 is already in use for device eth0...
                                                           [  OK  ]
[root@localhost ~]# ifconfig | grep 'inet'
          inet addr:107.150.52.18  Bcast:107.150.52.23  Mask:255.255.255.248
          inet6 addr: fe80::226:9eff:fe1d:c9e/64 Scope:Link
          inet addr:107.150.52.19  Bcast:107.150.52.23  Mask:255.255.255.248
          inet addr:107.150.52.20  Bcast:107.150.52.23  Mask:255.255.255.248
          inet addr:107.150.52.21  Bcast:107.150.52.23  Mask:255.255.255.248
          inet addr:107.150.52.22  Bcast:107.150.52.23  Mask:255.255.255.248
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0-range0
IPADDR_START=107.150.52.19
IPADDR_END=107.150.52.22
CLONENUM_START=0
[root@localhost ~]# 

Posted in CentOS

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.