In order to set static IP and complete this configuration, You will need the following information:
– IP Address
– Netmask
– Gateway Address
– DNS Server Addresses
Step-1: First you have to stop NetworkManager:
1 2 3 4 5 | service NetworkManager stop OR /etc/init.d/NetworkManager stop |
Step-2: Make sure NetworkManager does not start at boot:
1 2 3 | chkconfig NetworkManager off |
Step-3: Make sure the network service is set to start at boot:
1 2 3 | chkconfig network on |
Now NetworkManager is out of the way we need to edit these three files.
1. /etc/sysconfig/network-scripts/ifcfg-eth0
2. /etc/sysconfig/network
3. /etc/resolv.conf
First of all edit “/etc/sysconfig/network-scripts/ifcfg-eth0” file to configure eth0:
1 2 3 | # vi /etc/sysconfig/network-scripts/ifcfg-eth0 |
1 2 3 4 5 6 7 8 9 10 11 | DEVICE=eth0 HWADDR=00:1E:67:6C:5F:DC TYPE=Ethernet UUID=c68c7552-3271-41b7-a0ef-f8e5b93ce529 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=static IPADDR=172.26.83.16 NETMASK=255.255.252.0 |
Note: change IP address according to you.
Configure Default Gateway by editing “/etc/sysconfig/network” file:
1 2 3 | # vi /etc/sysconfig/network |
1 2 3 4 5 6 | NETWORKING=yes HOSTNAME=localhost.localdomain NTPSERVERARGS=iburst GATEWAY=172.26.83.254 |
Note: change IP address according to you.
Restart Network Interface
1 2 3 4 5 | service network restart OR /etc/init.d/network restart |
Add these lines to “vi /etc/resolv.conf” to configure DNS Server
1 2 3 | # vi /etc/resolv.conf |
1 2 3 4 | nameserver 172.31.1.130 nameserver 172.31.1.1 |
Note: change IP address according to you.