. . .

How to Add an Additional IP in Centos 7.

# To add an additional IP address in CentOS 7, you can use the ‘ifcfg’ files in the ‘/etc/sysconfig/network-scripts/’ directory. Here are the steps:-

Step 1: Navigate to the network scripts directory.
# [ cd /etc/sysconfig/network-scripts/ ]

Step 2: Create a new ifcfg file for the additional IP.
You can copy the existing ifcfg file for your network interface and modify it for the new IP. For example, if your network interface is ‘eth0’, you can create a new file named ‘ifcfg-eth0:1’ for the additional IP:-
# [ cp ifcfg-eth0 ifcfg-eth0:1 ]

Step 3: Edit the new ifcfg file.
a).  Use a text editor to open the newly created file. For example, you can use ‘nano’ or ‘vi’.
[ nano ifcfg-eth0:1 ]
b). Modify the file to include the new IP address. Here’s an example of what the file might look like:-
c). Make sure to replace ‘your_additional_ip’ and ‘your_subnet_mask’ with the actual values for the additional IP address and subnet mask you want to add.

Step 4:Restart the network service.
After making the changes, you need to restart the network service for the changes to take effect.
# [ systemctl restart network ]

Step 5: Verify the new IP.
a). You can use the ‘ip addr’ command to verify that the new IP address has been added.
b). Look for the interface (‘eth0:1’ in this example) and check if the new IP address is listed.

Note: these changes will not persist after a system reboot unless you configure them to do so. If you want the additional IP to be automatically added at startup, make sure the ‘ONBOOT’ parameter in the ifcfg file is set to ‘yes’.