How to add an additional IP address in Centos 7
In this article we will show you how to add a secondary IP address to your server which is running CentOS 7. Adding an additional IP address is needed if you have two or more subnets and you need to use them on CentOS server. For doing it, you will need to add the second and subsequent ip address to NIC. We remind you that a NIC (network interface controller) card is typically a circuit board that is installed on a computer to connect to the network.
1. Connect via ssh to our server. Create file /etc/sysconfig/network-scripts/ifcfg-eth0:0 with the following content:
(IPADDR and NETMASK data use those that you received when ordering an IP address)
2. It can be done using next commands. Go to the network-scripts directory: cd /etc/sysconfig/network-scripts/. Then create a new file:
# nano ifcfg-eth0:0
3. After that, restart the network service:
service network restart
We execute ifconfig, we see that eth0:0 has appeared.
eth0:0 Link encap:Ethernet HWaddr 00:11:22:33:44:55
inet addr:192.168.0.11 Bcast:192.168.0.11 Mask:255.255.255.255
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0xa000
We completed adding an extra IP to CentOS 7..
Our other articles: