CentOS add IP Address
To add IP address on a Linux server, first find name of your network interface. This can be done with command
1 |
ip link |
In most case, it can be enp3s0 or eth0, if you have more than one network card, this may be differnt, in such case, you need to identify which network interface you need to configure the the IP address .
Now create file
1 |
vi /etc/sysconfig/network-scripts/ifcfg-enp3s0:1 |
Here i used enp3s0 as network inferface name, replace it with whatever network interface name you use.
Add following content
1 2 3 |
DEVICE="enp3s0:1" IPADDR=IP_ADDR_HERE NETMASK=255.255.255.255 |
IP_ADDR_HERE = replace with the IP address you need to add.
enp3s0 = replace with actual network interface name.
Restart network service with command
1 |
systemctl restart network |
If you need to add another IP, create file with name
1 |
INTERFACE_NAME:2 |
for example “enp3s0:2”, you need to use same alias name in DEVICE entry (first line) in the file.