Understanding and learning about DHCP Service-Linux general technology-Linux technology and application information. The following is a detailed description. [I = s] This post was last edited by john1988
DHCP Service
I. Basic knowledge about DHCP
1. What is DHCP?
DHCP (Dynamic Host Configuration Protocol) is a seed protocol at the TCP/IP application layer. It is used to provide services for automatically allocating IP configuration information.
2. DHCP Architecture
(1) DHCP server: a device that runs the DHCP protocol and server software.
(2) DHCP Client: runs the DHCP protocol and automatically obtains IP addresses.
3. How DHCP works
(1) Lease Generation Process
....
(2) Lease update process
-Automatic update
A. Lease 50%
B. Lease 87.5%
-Manual Update
A. windows client c: \> ipconfig/renew
B. Linux client: # dhclient
4. Deploy DHCP servers
(1) Non-Route Network
(2) routing network
-DHCP relay proxy
-Use a router that supports DHCP broadcast.
-One DHCP server is deployed for each broadcast domain.
Ii. install and configure the DHCP server
1. Configure the IP address of the DHCP server
# Netconfig-d eth0
2. Install the DHCP server software package
(1) RPM Installation Method
# Rpm-ivh dhcp-3.0pl1.i386.rpm
(2) Compilation and installation methods
# Tar-xzvf dhcp-3.0.3.tar.gz
# Cd dhcp-3.0.3
#./Configure
# Make
# Make install
3. Modify the/etc/dhcpd. conf file
# Vi/etc/dhcpd. conf
(1) Configure DHCP dynamic updates
-Ddns-update-style none/interim; // specifies the dynamic update type.
-Key "name" {// define the key
Algorithm hmac-md5; // specifies the encryption algorithm
Secret "... ciphertext..."; // specifies the key
};
-Zone region name {// defines the dynamically updated region name
Primary IP address; // specify the DNS server address
Key "key name"; // specify the dynamic update key
}
(2) configure the configuration options assigned by DHCP
-Option routers IP Address [,...];
Define the gateway address
-Option domain-name-servers IP Address [,...];
Define DNS server address
-Option domain-name "region name ";
Define suffix Domain Name
(3) Configure DHCP Scope
-Subnet network No. netmask mask {
.........
} // Define the scope
-Starting IP address of range, ending IP address;
Define the allocated address range, which must be included in the subnet Declaration
-Shared-network name {
.....
Subnet ...{
....
}
Subnet ...{
...
}
.......
}
Defines a super scope to allocate IP addresses of multiple CIDR blocks.
(4) configure the lease period
-Default-lease-time number;
Define default lease period
-Max-lease-time number;
Define the maximum lease period
(5) Configure to retain the host
-Host name {
Hardware ethernet mac address; // specifies the mac address of the reserved host
Fixed-address IP address; // specify the IP address reserved for the host
}
File instance:
Ddns-update-style none;
Default-lease-time 3600;
Max-lease-time 7200;
Subnet 192.168.1.0 netmask 255.255.255.0 {
Range 192.168.1.2 192.168.1.254;
Option routers 192.168.1.1;
Option domain-name-servers 202.102.192.68;
}
4. Create a lease Database
(1) the dhcp server software installed by rpm will automatically create dhcpd. leases under/var/lib/dhcp
(2) For the dhcp server installed in compiling mode, you must manually create dhcpd. leases under/var/state/dhcp.
5. Start the DHCP service
(1) DHCP server installed in rpm Mode
# Ntsysv -- level 345 // set Automatic Start
# Service dhcpd start // Manual start
(2) DHCP server installed in compilation Mode
# Vi/etc/rc. d/rc. local // set Automatic Start
......
Dhcpd
# Dhcpd // Manual start
Note: The Daemon name of the dhcp server is dhcpd and the working port is udp/67.
3. Configure the DHCP Client
1. Windows Client
...
2. Linux Client
# Netconfig-d ethX
Note:-the linux client uses the dhclient script to request an update from the dhcp server.
-The linux client can use the dhclient-r command to release the lease.
-Modify the DHCPDARGS option in the/etc/sysconfig/dhcpd file to specify the interface name bound to the DHCP server.
-Linux can be used as a dhcp relay proxy. The configuration method is as follows:
A. Configure static IP addresses
B. Install dhcp Software
C. Configure the Relay Service
# Vi/etc/sysconfig/dhcrelay
INTERFACES = "interface name"
DHCPSERVERS = "ip address"
D. Start the relay proxy service.
# Service dhcrelay start
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