DHCP server establishment and main file configuration

dhcp, the dynamic host setting protocol, is a local area network network protocol that uses the UDP protocol. The main purpose is to quickly and automatically assign IP addresses to the network. DHCP can help us assign IP addresses and related IP information to computers in the network.

dhcp can also configure the correct subnet mask, default gateway and DNS server information on the device. Because of these capabilities, almost every device connected to the network is now configured with DHCP.

DHCP is usually used in large-scale local area network environments. Its main function is to centrally manage and allocate IP addresses, so that hosts in the network environment can dynamically obtain IP addresses, Gateway addresses, DNS server addresses and other information, and can improve the use of addresses. Rate.

1. Preparation work

 Before starting the service, both the firewall and SElinux need to be turned off.

systemctl stop firewalld
setenforce 0

1. Turn off the DHCP service that comes with the virtual machine (enabled by default)

 2. Configure network card files

vi /etc/sysconfig/network-scripts/ifcfg-ens33

 3. Install the DHCP service (configure the yum source, see the first work)

yum -y install dhcp

2. Configure the main configuration files

Main configuration file: /etc/dhcp/dhcpd.conf

Copy /usr/share/doc/dhcp-4.2.5 (version is not unique)/dhcpd.conf.example to /etc/dhcp/dhcpd.con and overwrite it

cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf

Configure the /etc/dhcp/dhcpd.conf file

vim /etc/dhcp/dhcpd.conf

 

 

Finally start the DHCP service and auto-start at boot

systemctl enable dhcpd ##开机自启dhcp服务
systemctl start dhcpd ##开启dhcp服务


PS: In vmware, use the host-only mode for experiments. Use the local dhcp service of the host-only mode network card in the virtual network editor to assign the IP address to the virtual machine. The server and client must use the same network card and be on the same network segment. 

Guess you like

Origin blog.csdn.net/m0_74090215/article/details/130586962