Linux_DHCP service configuration deployment

First, what is DHCP:

(DynamicHost Configuration Protocol) Dynamic Host Configuration Protocol, is a local area network protocol, the UDP protocol work, DHCP has three ports,

  DHCPServer : 67

  DHCP Client : 68

  DHCPv6 Client:546

That is automatically assigned to the correct network parameters to the domain of each computer, so that the client computer can automatically set the parameter value good web immediately at boot time,

These parameter values ​​may include IP, netmask, network, gateway address to the DNS and the like.

Two, DHCP works:

1, looking server, client sends a packet to discover a local area network;

2, provide the IP address lease, discover packet is received after the server end, choose a front vacant IP, offer a response to the client packet

3, the client receives multiple server-side offer packet client, choose which offer1 the first to arrive, and sends a request packet LAN, to announce it specifies that all server IP address of that station;

4, when the server receives the request request packet, it will give the client an ACK response, confirm ip lease to take effect

dhcp

 

Three, DHCP configuration:

Environment Introduction: Linux_DNS: 192.168.200.103 -> DNS server

                  Linux_DHCP: 192.168.200.101 -> DHCP server

                  Windows 7 -> tester

 

Client: port number 68-> Using UDP protocol

Services: Port number 67-> Using UDP protocol

UDP for sending small data packets, and the higher the failure requirements; because no three-way handshake

All DHCP configuration file: /etc/dhcpd.conf

Configuring DHCP server:

dhcp configuration file path: /usr/share/doc/dhcp-4.2.5

 

[Root @ linuxMA ~] # yum -y install dhcp> See installation package dhcp

[Root @ linuxMA ~] # cd / etc / dhcp / -> switching to the / etc / dhcp directory 

 

 

 

[root @ linuxMA dhcp] # cp -r /usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf
cp: overwrite "/etc/dhcp/dhcpd.conf"? y -> Profiles to Copy

[Root @ linuxMA dhcp] # vim /etc/dhcp/dhcpd.conf -> Edit Profile

subnet 192.168.200.0 netmask 255.255.255.0 {- IP address> sub-network address, not native

option routers 192.168.200.1; -> Configure Gateway

option subnet-mask 255.255.255.0; -> configuration Subnet

default-lease-time 3600; -> default lease time

max-lease-time 7200; -> maximum lease time

option broadcast-address 192.168.200.255; -> configuration broadcast address

option domain-name-servers 192.168.200.103; -> address configuration dns

option domain-name "baidu.com"; -> Configure domain name suffix 

range 192.168.200.50 192.168.200.60; -> address allocation section configured dhcp

log-facility local7; -> Description where to dispatch log

#tail -f /var/log/boot.log -> view the log change by tail

# Ddns-update-style none; -> Dynamic dns

}

 

[Root @ linuxMA ~] # systemctl dhcpd start -> start dhcpd service

[root @ localhost ~] # netstat -lnptu | grep dhcp -> check whether a successful start
udp 0 0 0.0.0.0:67 0.0.0.0:* 2371 / dhcpd

[Root @ linuxMA ~] # ps aux | grep dhcp -> View dhcp process

root 717 0.0 0.2 107380 5456 ? S 14:03 0:00 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-ens37.pid -lf /var/lib/NetworkManager/dhclient-69e8b95d-22b6-3e47-946f-f5bf064e140d-ens37.lease -cf /var/lib/NetworkManager/dhclient-ens37.conf ens37
root 2315 0.0 0.2 151896 5484 pts/0 S+ 15:26 0:00 vim dhcpd.conf
dhcpd 2371 0.0 0.4 110496 8264 ? Ss 15:31 0:00 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid
root 2404 0.0 0.0 112720 984 pts/1 R+ 16:14 0:00 grep --color=auto dhcp

 

[Root @ linuxMA ~] # systemctl force-reload dhcpd -> re-read the configuration file

[Root @ linuxMA ~] # systemctl restart dhcpd -> Restart dhcpd service

 

Verify the effect of:

 

 

 

To test whether the allocation of IP can be used

 

 

 

Assigned to test whether DNS can use

 

 

 

Guess you like

Origin www.cnblogs.com/linuxMA/p/11535224.html