- DHCP Concepts and principles
- DHCP service role
- Automatically assign addresses to a large number of clients, providing centralized management
- Reduce management and maintenance costs and improve network configuration efficiency
- The address information that can be assigned mainly includes:
- IP address, subnet mask of the network card
- The corresponding network address
- Default gateway Address
- DNS server address
- Boot file, TFTP server address
- the principle of DHCP
- Clients looking for servers
Client–dhcpdiscovery
If not, 9 seconds, 13 seconds, 16 seconds after 1 seconds of re-sending.
- Server provides address
Server–dhcpoffer
Provide available IP, lease information, server address, etc.
- Accept and broadcast
Client–dhcprequest
Declare the DHCP server of your choice
ARP broadcast, testing the DHCP server of your choice
- Server Acknowledgement
Client–dhcprequest
Server–dhcpack
All network parameters are included.
===========================================================
- Log back in with the client
Client–dhcprequest
Application, continue source use assigned IP address
- Update lease
8 Hours – 4 hours – 2 hours
Client–dhcpdiscovery
- DHCP-related files
- rhel6 DHCP package
dhcp-4.1.1-3.4.p1.el6.x86_64.rpm
- DHCP Related configuration
port number: IPv4 udp67, udp68
IPv6 udp546, udp547
service Name: DHCPD (main program) or Dhcrelay (relay)
Master profile:/etc/dhcp/dhcpd.conf
P style= "text-align:justify" > template file:/USR/SHARE/DOC/DHCP-4.1.1/ Dhcpd.conf.sample trunk configuration file :/etc/sysconfig/dhcrelay
- DHCP configuration file resolution.
Option Domain-name "example.org";
Option Domain-name-servers ns1.example.org, ns2.example.org;
Default-lease-time 600;
Max-lease-time 7200;
#ddns-update-style None;
Subnet 10.5.5.0 netmask 255.255.255.224 {
Range 10.5.5.26 10.5.5.30;
Option Domain-name-servers ns1.internal.example.org;
Option Domain-name "internal.example.org";
Option routers 10.5.5.1;
Option Broadcast-address 10.5.5.31;
Default-lease-time 600;
Max-lease-time 7200;
}
Host Passacaglia {
Hardware Ethernet 0:0:c0:5d:bd:95;
FileName "Vmunix.passacaglia";
Server-name "toccata.fugue.com";
}
Host Fantasia {
Hardware Ethernet 08:00:07:26:C0:A5;
Fixed-address fantasia.fugue.com;
}
Class "Foo" {
Match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
}
Shared-network 224-29 {
Subnet 10.17.224.0 netmask 255.255.255.0 {
option routers rtr-224.example.org;
}
Subnet 10.0.29.0 netmask 255.255.255.0 {
option routers rtr-29.example.org;
}
Pool {
Allow members of "Foo";
Range 10.17.224.10 10.17.224.250;
}
Pool {
Deny members of "Foo";
Range 10.0.29.10 10.0.29.230;
}
}
Option Domain-name setting the DNS domain
Option Domain-name-server Setting the DNS server address
Default-lease-time Set default lease time in seconds
Max-lease-time Setting the maximum lease time in seconds
Log-facility Specifying a log device
Ddns-update-style To configure how DNS is updated
Subnet network Segment declaration, acting on the entire subnet segment:
Range sets the pool of IP addresses for allocation
Option Subnet-mask to set the subnet mask for the client
The option routers parameter sets the client's default gateway address
Option Broadcast-address Setting the client broadcast address
The host hosts a declaration that acts on a host computer:
Hardware Ethernet Set the destination host's MAC address
Fixed-address set to its assigned reserved IP
Restart the service for the modified configuration to take effect
#server dhcpd Restart
Modify the NIC configuration to set up automatic DHCP assignment
#vim/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0
Onboot=yes
Bootproto=dhcp
#ifdown eth0
#ifup eth0
Note: After the configuration is complete, remember to close the SELinux and firewall
- DHCP server-side configuration
- DHCP Client Configuration
- case: DHCP relay functionality
Host A has an IP address of 192.168.1.1, and the gateway is 192.168.1.2
Host B's IP address is eth0:192.168.1.2,eth1:200.200.200.2
Host C network adapter set to DHCP
1, host a operation steps are as follows:
#yum –y Install DHCP
#cp???? /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf
#vim/etc/dhcp/dhcpd.conf
#service DHCPD Start
#vim/etc/sysctl.conf
#打开网络转发功能
- Host B steps as follows:
#yum –y Install DHCP
#vim/etc/sysconfig/dhcrelay
#service Dhcrelay Start
- Host C operates as follows:
#vim/etc/sysconfig/network-scripts/ifcfg-eth0
#设置为DHCP
- DHCP host address reserved
Host A's IP address is 192.168.1.1
Host B NIC is set to DHCP
Host A and Host B are in the same network segment
1, the operating procedure of host A is as follows:
#yum –y Install DHCP
#cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample
#vim/etc/dhcp/dhcpd.conf
Bind MAC Address
#service dhcpd Restart
2, the operation of Host B is as follows:
#vim/etc/sysconfig/network-scripts/ifcfg-eth0
- DHCP Hyper-scope
Description: A superscope is a management feature in a DHCP service that uses a superscope to combine multiple scopes into a single administrative entity.
Test Preparation: Host a network card eth0 and Host B network card eth0 in the same network segment, Host C network card eth1 and Host B network card eth1 in the same network segment , hosts A, B, and C Turn off firewalls and selinux.
- The operation of Host B is as follows:
#vim/etc/sysconfig/network-scripts/ifcfg-eth0
#vim/etc/sysconfig/network-scripts/ifcfg-eth1
#yum –y Install DHCP
#cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf
#vim/etc/dhcp/dhcpd.conf
#service DHCPD Start
- Host A's network card settings
#vim/etc/sysconfig/network-scripts/ Ifcfg-eth0
#ifdown eth0
#ifup eth0
results such as
- Network card settings for Host C
#ifdown eth0
#ifup eth0
Results
Summary: using the method above, in two network segments assigned IP address, do not need to do DHCP relay, the only problem is to connect two network segments of the host to have enough network card, that is, a network card corresponding to a segment
DHCP services in a detailed