Sei sulla pagina 1di 10

2010/2011

IICT Frankie Inguanez

[CONFIGURING DHCP ON CENTOS]


This guide will inform the user on how to configure DHCP in the CentOS 5.5 Linux Distribution OS.

Configuring DHCP on CentOS


Contents
Configuring DHCP on CentOS ........................................................................................................................ 3 Configuring Ubuntu to obtain IP via DHCP (GUI) .......................................................................................... 7 Configuring Ubuntu to obtain IP via DHCP (CLI) ........................................................................................... 9

Supporting Network Operation System - Notes

Page 2

Configuring DHCP on CentOS


Configuring DHCP on CentOS
1. Open a terminal window:

2. Switch user to administrator. su 3. Edit the DHCP configuration file vim /etc/dhcpd.conf or nano /etc/dhcpd.conf

Supporting Network Operation System - Notes

Page 3

Configuring DHCP on CentOS


4. Take note of the location of the sample configuration file.

N.B. You are to replace the * with the actual dhcp version number. You can find the version number by pressing tab twice. 5. Copy the sample configuration file to the actual file cp /usr/share/doc/dhcp-3.05/dhcpd.conf.sample /etc/dhcpd.conf N.B. The current version number may different from the illustrated one. Check your current version.

N.B. When asked to confirm whether you want to overwrite the configuration file type y then press enter.

Supporting Network Operation System - Notes

Page 4

Configuring DHCP on CentOS


6. Edit the configuration file. vim /etc/dhcpd.conf or nano /etc/dhcpd.conf 7. Use the sample configuration as a guide for your configuration. Either add a # at the beginning of each line to comment the current settings or else press delete to remove. This guide will apply the following settings: Network Address: Subnet Mask: Default Lease Time: Maximum Lease Time: Range: 192.168.1.0 255.255.255.0 600 1700 192.168.1.100 192.168.1.200

8. Save and close the configuration file. 9. Create the dhcpd.leases file. touch /var/lib/dhcpd/dhcpd.leases 10. Give read and write permissions for all users on the dhcpd.leases file. chmod +rw /var/lib/dhcpd/dhcpd.leases 11. Edit the system configuration file for dhcpd vim /etc/sysconfig/dhcpd or nano /etc/sysconfig/dhcpd

Supporting Network Operation System - Notes

Page 5

Configuring DHCP on CentOS


12. Set the name of the network interface to use for dhcp configuration (generally eth0).

13. Save and close the configuration file. 14. Start the dhcp server /sbin/service dhcpd start

15. To stop the dhcp server type: /sbin/service dhcpd stop 16. To restart the dhcp server type: /sbin/service dhcpd restart 17. To check the status of the dhcp server type: /sbin/service dhcpd status 18. To configure the dhcp server while operational use the omshell command.

Supporting Network Operation System - Notes

Page 6

Configuring DHCP on CentOS


Configuring Ubuntu to obtain IP via DHCP (GUI)
1. Launch the network connections utility from the system preferences menu.

2. Select the network interface then click edit.

Supporting Network Operation System - Notes

Page 7

Configuring DHCP on CentOS


3. Select the IPv4 settings tab and select the automatic dhcp option.

4. Click apply then enter the administrative password.

N.B. If you have previous edited the network interfaces file then you will need to re-amend it.

Supporting Network Operation System - Notes

Page 8

Configuring DHCP on CentOS


Configuring Ubuntu to obtain IP via DHCP (CLI)
1. Open a terminal window. 2. Either switch user to administrator or perform commands using administrative privileges. su 3. Edit the interfaces file. nano /etc/network/interfaces (If you switched user to root) or sudo nano /etc/network/interfaces N.B. Instead of nano you can use vi. 4. Set the network interface to accept an IP address via dhcp.

5. Save and close the configuration file.

Supporting Network Operation System - Notes

Page 9

Configuring DHCP on CentOS


6. Restart the networking interfaces /etc/init.d/networking restart (If you switched user to root) or sudo /etc/init.d/networking restart

7. Confirm that the IP address has been properly obtained. ifconfig

Supporting Network Operation System - Notes

Page 10

Potrebbero piacerti anche