Follow the steps mentioned below to configure or assign static IP to a centos machine:
1. Check for interface name of the ip to be made static by running command:
ifconfig
2. If the interface name of IP is say eth6 then create or open the corresponding interface file as:
sudo nano /etc/sysconfig/network-scripts/ifcfg-eth6
3. Add following values to this interface file:
DEVICE="eth6"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
NAME="System eth6"
IPADDR=192.168.56.102
NETMASK=255.255.255.0
4. Open the network file:
sudo nano /etc/sysconfig/network
5. Add following at the end of file:
GATEWAY=192.168.56.1
6. Restart network using:
sudo /etc/init.d/network restart
Share this: