How To Add IP Address to Interface in CentOS

centos

CentOS how to add multiple IP addresses to the existing network interface, this is also known as “adding a network alias”. Please note – this is not a tutorial for adding an second interface, it adds an additional IP address to the existing network card.

This article is useful for the following:

  • CentOS add IP address
  • Adding a second IP address in CentOS
  • CentOS add multiple IP addresses
  • Add IP address to interface

CentOS Add Second IP Address

 cd /etc/sysconfg/network-scripts 

Copy the existing network script:

 [root@thor network-scripts]# cp ifcfg-eth0 ifcfg-eth0:1

After you have copied the file open it and edit it to look like:

IPADDR=XXX.XXX.XXX.XXX
NETMASK=255.255.255.0
GATEWAY=XXX.XXX.XXX.XXX
TYPE=Ethernet

Obviously enter your IP address information, I don’t think type=ethernet is actually required.

Confirm the IP address information is correct and restart the network service:

service network restart

When the service restarts you should be able to access your server via the new IP address.

Note, you can add multiple IP addresses to the same interface in CentOS by creating fcfg-eth0:1, fcfg-eth0:2, fcfg-eth0:3 and so on…

Оцените статью
Настройка серверов windows и linux
Добавить комментарий

  1. asfeDif28qh

    thank you very much, very helpful