Software >> OS >> Unix >> Linux >> Networking >>  How to configure for dynamic IP using DHCP

 

Oracle Linux 6

# cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
HWADDR=52:54:00:91:6A:B3     ===> optional, put only if you want to tie to a fixed MAC, can work without this
PEERDNS=yes
PEERROUTES=yes
 

Other parameters we can add if necessary
 

to override the nameserver settings from DHCP,

PEERDNS=no
DNS1=x.x.x.x
DNS2=x.x.x.x

to set the DHCP hostname

DHCP_HOSTNAME=hostname     ( need to also add HOSTNAME=hostname in /etc/sysconfig/network )

 


References :

[1] (oracle linux) http://www.oracle-base.com/articles/linux/linux-network-configuration.php

 

 

Deals @yubeshop.com