To add IP address on a Linux server, first find name of your network interface. This can be done with command
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
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
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
systemctl restart network
If you need to add another IP, create file with name
INTERFACE_NAME:2
for example “enp3s0:2”, you need to use same alias name in DEVICE entry (first line) in the file.
Leave a Reply