Q. How do I setup my Red Hat / CentOS / Fedora Linux system to get IP address and other information via a DHCP server for eth0 interface?
A. You can edit eth0 configuration file to switch between static and dhcp networking configuration under RHEL / Fedora or CentOS Linux. Simply edit /etc/sysconfig/network-scripts/ifcfg-eth0 file.
Backup existing static configuration
First backup existing network configuration file using cp command:
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /root/ifcfg-eth0.bak
Configuring a DHCP Client
Setting up a Linux for dhcp can be done by editing file using a text editor such as vi:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Following is sample static configuration:
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:19:D1:2A:BA:A8
IPADDR=10.10.29.66
NETMASK=255.255.255.192
ONBOOT=yes
Replace static configuration with DHCP:
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:19:D1:2A:BA:A8
ONBOOT=yes
Save and close the file. Just restart network service:
# /etc/init.d/network restart
Please note that you need a configuration file for each device that you want to configure to use DHCP.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop













{ 5 comments… read them below or add one }
This info was of great help!
thx!
Actually on F13 minimal you have to create the mentioned file! but still works very great :)
Is there any post around about configuring dhcp server on CentOS/Redhat?!!
in my system have same problem but when i am restarting my computing again eth0.bak is coming..please help me. i done everything but it is not working.
It works like a charm! Thanks a lot