In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Build dhcp server on Centos8
First of all, my environment is a local VMware virtual machine, so turn off the dhcp service in VMware first.
Turn off the firewall, turn off selinux, which must be turned off:
Systemctl stop firewalld
Setenforce 0
Install the dhcp-server side on centos8
[root@Centos8 ~] # yum install dhcp-server.x86_64
View installed packages and files
[root@Centos8 ~] # rpm-ql dhcp-server / etc/NetworkManager/etc/NetworkManager/dispatcher.d/etc/NetworkManager/dispatcher.d/12-dhcpd/etc/dhcp # client / etc/dhcp/dhcpd.conf # dhcp configuration file (empty file) / etc/dhcp/dhcpd6.conf # ipv6 configuration File / etc/openldap/schema/etc/openldap/schema/dhcp.schema/etc/sysconfig/dhcpd/usr/bin/omshell/usr/lib/.build-id/usr/lib/.build-id/61/usr/lib/.build-id/61/6771248bc042fe96877bd9496ad99a4a4817fc/usr/lib/.build-id/e0/usr/lib/.build-id/e0/17e374d1a55a7254398988114fdd6a0bd63df3/usr/lib/systemd/system/dhcpd.service/usr/ Lib/systemd/system/dhcpd6.service/usr/sbin/dhcpd # server side / usr/share/doc/dhcp-server/usr/share/doc/dhcp-server/dhcp-lease-list.pl/usr/share/doc/dhcp-server/dhcpd.conf.example # example configuration file / usr/share/doc/dhcp-server/dhcpd6.conf.example/usr/share/ Doc/dhcp-server/ldap/usr/share/doc/dhcp-server/ldap/README.ldap/usr/share/doc/dhcp-server/ldap/dhcp.schema/usr/share/doc/dhcp-server/ldap/dhcpd-conf-to-ldap/usr/share/man/man1/omshell.1.gz/usr/share/man/man5/dhcpd.conf.5.gz/usr/share/man/man5/dhcpd.leases.5.gz/usr/share/man/man8/dhcpd.8.gz/ Var/lib/dhcpd/var/lib/dhcpd/dhcpd.leases # address assignment record / var/lib/dhcpd/dhcpd6.leases [root@Centos8 ~] #
Then start the dhcp service
[root@Centos8 ~] # systemctl start dhcpd.service
It is found that the startup error occurs because dhcp refuses to start if it does not configure the dhcp rules for this IP address range.
View the configuration file:
[root@Centos8] # vim / etc/dhcp/dhcpd.conf## DHCP Server Configuration file.# see / usr/share/doc/dhcp-server/dhcpd.conf.example# see dhcpd.conf (5) man page#
The dhcp default configuration file is empty, but it says look at the / usr/share/doc/dhcp-server/dhcpd.conf.example file, which is some example of dhcp configuration.
[root@Centos8 ~] # cp/ usr/share/doc/dhcp-server/dhcpd.conf.example / etc/dhcp/dhcpd.conf
Directly replace the configuration file and view it again:
[root@Centos8 ~] # vim / etc/dhcp/dhcpd.conf# dhcpd.conf# where both the global statement block and the subnet statement block can make the configuration effective, and the subnet statement block takes precedence over the global statement block: # global statement block: # option definitions common to all supported networks...# specifies to get the host domain suffix: option domain-name "wj02.com"; # specifies DNS. Optional option domain-name-servers 180.76.76.76, 119.29.29.29 The lease term of # ip (in seconds): default-lease-time 86400; # default is 600s. The client will renew the lease after half of the lease term, that is, 300s. If the suite is too short, it will take up a lot of network bandwidth. It is recommended to change it for a longer time. Here it is changed to 86400s, one day. # maximum lease time max-lease-time 100000bot. LogMobility local7;...#subnet configuration # specify the network segment subnet 192.168.38.0 netmask 255.255.255.0 {# specify the assigned ip range, you can skip some addresses range 192.168.38.10 192.168.38.120; range 192.168.38.150 192.168.38.254; # specify gateway option routers 192.168.38.2 } # assigning a fixed ip to a mac address has the same effect as statically obtaining host test {hardware ethernet 00host test 0cVV 29VV 584fRV 12; fixed-address 192.168.39.102;} # assigning 192.168.39.120 to the mac address of 00:0c:29:58:4f:12.
Dhcp also has a syntax check function:
Dhcpd-t-cf / etc/dhcp/dhcpd.conf
Of course, if the grammar is wrong, the startup will also report an error, which is not important.
After the configuration file has been modified, restart the dhcp service
[root@Centos8 ~] # systemctl start dhcpd
Start successfully.
Get ip on the client side
Dhclient-d
Because I bound the mac address in the configuration file, this server should be assigned the ip of 192.168.38.102
So far, the dhcp server has been built successfully.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.