dhcp

4
Setup DHCP Server On CentOS 6.5 DHCP Server is used to distribute IP addresses to the clients in your network. DHCP stands for Dynamic HostConfiguration Protocol. It reduces the work burden to a system admin if he have to assign IP addresses manually to more than 100+ systems. Installation To install DHCP server on CentOS 6.5, enter the following command: Step1: yum install dhcp -y Step2: First, we have to assign which interface you want your DHCP server to run on. Let us assigned on interface eth0. To do that, follow the below command. vi /etc/sysconfig/dhcpd # Command line options here DHCPDARGS=eth0 ## Assign the network interface Save and close the file. Step3: copy the sample dhcp configuration file to /etc/dhcp/ directory. cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf Step4: Editthe dhcpd.conf file, vi /etc/dhcp/dhcpd.conf Make the changes as shown below.

Upload: ravs

Post on 06-Dec-2015

5 views

Category:

Documents


1 download

DESCRIPTION

dhcp

TRANSCRIPT

Page 1: DHCP

Setup DHCP Server On CentOS 6.5

DHCP Server is used to distribute IP addresses to the clients in your

network. DHCP stands for Dynamic HostConfiguration Protocol. It

reduces the work burden to a system admin if he have to assign IP

addresses manually to more than 100+ systems.

Installation

To install DHCP server on CentOS 6.5, enter the following command:

Step1: yum install dhcp -y

Step2: First, we have to assign which interface you want your DHCP

server to run on. Let us assigned on interface eth0.

To do that, follow the below command.

vi /etc/sysconfig/dhcpd

# Command line options here

DHCPDARGS=eth0 ## Assign the network interface

Save and close the file.

Step3: copy the sample dhcp configuration file to /etc/dhcp/

directory.

cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf

Step4: Editthe dhcpd.conf file,

vi /etc/dhcp/dhcpd.conf

Make the changes as shown below.

Page 2: DHCP

Set the domain name and domain-name servers:

[...]

# option definitions common to all supported networks...

option domain-name "linux.com";

option domain-name-servers int.linux.com

[...]

If this DHCP server is the official DHCP server for the local network,

you should uncomment the following line:

[...]

authoritative;

[...]

Define the sunbet, range of ip addresses, domain and domain name

servers like below:

[...]

# A slightly different configuration for an internal subnet.

subnet 192.168.0.0netmask 255.255.255.0 {

range 192.168.0.5 192.168.0.10;

option domain-name-servers int.linux.com;

option domain-name "linux.com";

#option routers ;

#option broadcast-address ;

default-lease-time 600;

max-lease-time 7200;

Page 3: DHCP

}

[...]

If you want to assign a fixed IP address to your client, you should

enter it’s MAC id and the IP address in the following directive. For

example, I want to assign a fixed IP address 192.168.0.6 to

linuxclient, hence I modified the following directive as shown below.

[...]

hostlinux-client {

hardwareethernet 00:22:64:4f:e9:3a;

fixed-address 192.168.0.6;

}

[...]

After making all the changes, save and close the file.

Step5: Now, start the dhcpd service and make it to start automatically

on every reboot.

servicedhcpd start

chkconfigdhcpd on

Step1: Client Configurations

Now, go to the client configuration network settings and change the IP

settings to Automatic (DHCP).

Restart the network or reboot the client system to get IP address

automatically from the DHCP server.

Now, you should see the IP address has been automatically assigned to

the clients from the DHCP server.

Page 4: DHCP