OpenCloud
OpenCloud Service FAQ
< Back

Configuring Private IP on Instances - Centos 7 & 8

After requesting private IP, follow the below steps for configuring the private IP on the instance.
1.Confirm the new interface name created after requesting private IP
Run the below command -

ip a


Below should be shown. The new interface name for private IP would be "eth1" in this sample case. Centos_privateIP_Before.png


2.Run the below command to duplicate the "eth0" config to the new interface config ( "eth1" in this case)
Make sure you replace the interface name if it is different.

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1


3.Run the below commands to replace the device Name and delete the MAC address in the new cfg file

sed -i 's/DEVICE.*/DEVICE=\eth1/g' /etc/sysconfig/network-scripts/ifcfg-eth1

sed -i '/HWADDR/d' /etc/sysconfig/network-scripts/ifcfg-eth1


4.Run the following command to restart network service, or restart the instance

service network restart


After that, the interface information should be shown as this, and configuration of private IP is completed - Centos_privateIP_After.png

Back
People are also looking for