Software >> OS >> Unix >> Linux >> RHEL >> 6 >> How to configure static and dynamic IP address without using Network Manager

 

## Note the Ethernet device names

[root@rh6 network-scripts]# ifconfig -a | grep Ethernet

eth3      Link encap:Ethernet  HWaddr 08:00:27:C0:00:D1 
eth4      Link encap:Ethernet  HWaddr 08:00:27:93:CD:8B 
virbr0    Link encap:Ethernet  HWaddr 52:54:00:63:06:7F 
virbr0-nic Link encap:Ethernet  HWaddr 52:54:00:63:06:7F



## cd to network-scripts directory

[root@rh6 network-scripts]# cd /etc/sysconfig/networkscripts


## edit the respective device ifcfg scripts


[root@rh6 network-scripts]# vi ifcfg-eth3


## e.g. Set Static IP for eth3

[root@rh6 network-scripts]# cat ifcfg-eth3

DEVICE="eth3"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
IPADDR=192.168.0.11
NETMASK=255.255.255.0
#GATEWAY=192.168.0.254
IPV6INIT=no


## e.g. set Dynamic IP for eth4 - assuming there is DHCP server on the networ that is connected to eth4


[root@rh6 network-scripts]# vi ifcfg-eth4

[root@rh6 network-scripts]# cat ifcfg-eth4

DEVICE="eth4"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV6INIT=no
PEERDNS=yes
PEERROUTES=yes