Configuration of the DHCP service

Source: Internet
Author: User

I. Introduction to DHCP

1. Package: DHCP

2. Service Name: DHCPD (main program), Dhcrelay (relay service)

3, Port: UDP 68 UDP

4. Configuration file:

/ETC/DHCP/DHCPD.CONF Master configuration file

/etc/sysconfig/dhcrelay Relay configuration file

/usr/share/doc/dhcp*/dhcpd.conf.sample Master Profile Template

5. Common Configuration options:

Ddns-update-style Interim; Set DHCP interactive update mode

Ignore client-updates; Ignore client Updates

Subnet 192.168.12.0 netmask 255.255.255.0 {//Set subnet declaration

#---Default gateway

Option routers 192.168.12.1; Set the client default gateway

Option Subnet-mask 255.255.255.0; Setting the client subnet mask

Option Nis-domain "Ixdba.net"; Setting up NIS domains

Option Domain-name "Ixdba.net"; Set the DNS domain

Option Domain-name-servers 192.168.12.1; Set the DNS server address

Option time-offset-18000; # Eastern Standard Time//Set timing deviation

# option Ntp-servers 192.168.12.1; //Set time server

# option Netbios-name-servers 192.168.12.1; Set the NetBIOS server address

#---Selects point-to-point node (default is hybrid). Don ' t change this unless

#--You understand Netbios very well

# option Netbios-node-type 2;

Range DYNAMIC-BOOTP 192.168.12.128 192.168.12.254; Set up an address pool

Default-lease-time 21600; Set the default lease period in seconds

Max-lease-time 43200; Set the maximum client lease period in seconds

# We want the nameserver to appear at a fixed address

Host NS {//set reserved address

Server-name Marvin.    redhat.com; Server name for Assigned address

Hardware Ethernet 12:34:56:78:AB:CD; Mac of the machine that was reserved for the address

Fixed-address 207.175.42.254; Assigned IP Address

}

}

Second, the experimental process:

A) build a DHCP server:

Server-side:

1. Yum-y Install DHCP

2, since the DHCP installation is complete when there is no configuration file, you must copy from the template file a copy

Cp/usr/share/doc/dhcp*/dhcpd.conf.sample/etc/dhcp/dhcpd.conf

3, vim/etc/dhcp/dhcpd.conf Delete redundant configuration, keep a subnet area

Subnet 192.168.1.0 netmask 255.255.255.0 {

Option routers 192.168.1.2;

Option Subnet-mask 255.255.255.0;

option domain-name-servers 192.168.1.2;

Range 192.168.1.10 192.168.1.100;

Default-lease-time 21600;

Max-lease-time 23200;

}

4, Service dhcpd restart


Client:

1, the client's network card to obtain the IP mode is set to automatically get

Vim/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth0

Onboot=yes

Bootproto=dhcp

2. Restart the Network Service

Service Network restart


II) build DHCP Relay service:

Server-side:

1. Yum-y Install DHCP

2, cp/usr/share/doc/dhcp*/dhcpd.conf.sample/etc/dhcp/dhcpd.conf

3, vim/etc/dhcp/dhcpd.conf

Subnet 192.168.1.0 netmask 255.255.255.0 {

Option routers 192.168.1.2;

Option Subnet-mask 255.255.255.0;

option domain-name-servers 192.168.1.2;

Range 192.168.1.10 192.168.1.100;

Default-lease-time 21600;

Max-lease-time 23200;

}

Subnet 200.200.200.0 netmask 255.255.255.0 {

Option routers 200.200.200.1;

Option Subnet-mask 255.255.255.0;

option Domain-name-servers 200.200.200.1;

Range 200.200.200.10 200.200.200.100;

Default-lease-time 21600;

Max-lease-time 23200;

}

4, Service dhcpd restart

5. Add a gateway Record

Route add default GW 192.168.1.2


Relay side:

1. Yum-y Install DHCP

2. Set the kernel parameter configuration file to support IP forwarding

Vim/etc/sysctl.conf

Ip.net.ipv4_forward 1

3. Load configuration file

Sysctl-p

4. Configure the Relay configuration file

Vim/etc/sysconfig/dhcrelay

INTERFACE = "Eth0 eth1"

DHCPServer = "192.168.1.1"

5. Turn on the relay service

Service Dhcrelay Start

Client:

1, the client's network card to obtain the IP mode is set to automatically get

Vim/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth0

Onboot=yes

Bootproto=dhcp

2. Restart the Network Service

Service Network restart


Configuration of the DHCP service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.