In this config we are going to configure a network interface to receive an IP configuration settings from DHCP server. First get the name of the network interface you would like to set as DHCP client. To do this you can run command:
# ip addr show 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:15:38:b7 brd ff:ff:ff:ff:ff:ff valid_lft forever preferred_lft forever inet6 fe80::a00:27ff:fe15:38b7/64 scope link valid_lft forever preferred_lft forever
Once we have located a name of the network interface in question open a corresponding configuration file. So as an example, for network interface epn0s3
vi will edit a /etc/sysconfig/network-scripts/ifcfg-enp0s3
. Open this file and enter the minimum configuration settings in order to make this network interface act as a DHCP client:
DEVICE=enp0s3 BOOTPROTO=dhcp ONBOOT=yes
Some optional configuration settings for this network interface are:
DEVICE="enp0s3" NETBOOT="yes" HWADDR="08:00:27:15:38:B7" TYPE="Ethernet" BOOTPROTO="dhcp" NAME="enp0s3" UUID="462f4834-4fe7-43a7-84e7-83b2722e94c1" ONBOOT="yes"
Once you have configured your network interface as DHCP client restart your network settings. On Redhat 7 linux it is easy as:
# systemctl restart network
Optionally reboot your RHEL system.