Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to set up Linux-DHCP Server

Shulou Source: shulou.com Published: 2022-06-01 03:39:23 09月30日 Update

This article introduces you how to set up a Linux-DHCP server, the content is very detailed, interested friends can refer to, hope to be helpful to you.

DHCP server:

Function: provide dynamic ip to every host in the LAN

Mode of communication:

Client: use 255.255.255.255 to broadcast the same DHCP client to send DCHP Discover packets.

DHCP: after receiving the packet data, send back a DHCP offer packet with the IP,MASK,NETWORK, gateway, etc., which DHCP gives to the client, as well as the lease date.

Client: after receiving the message, send a DHCP request packet for confirmation.

DHCP: after receiving the message, reconfirm it.

Install DHCP:

Yum search dhcpd

Yum install dhcpd

View the installed files:

Rpm-ql dhcpd

Edit / etc/dhcp/dhcpd.conf file

7 option domain-name "localhost"; set the domain name of this machine

8 option domain-name-servers 192.168.29.0,192.168.29.100; set DNS server IP

nine

10 default-lease-time 600; default lease time

11 max-lease-time 7200; maximum lease time in seconds

23 log-facility local7

28 subnet 192.168.29.0 netmask 255.255.255.0 {

29}

32 subnet NETWOEK NETMASK Subnet Mask

33 subnet 192.168.29.0 netmask 255.255.255.0 {

34 range 192.168.29.100 192.168.29.150; assign ip range

35 option routers 192.168.29.2; Gateway

38}

"host assigns ip to fixed hosts"

65 host RedHatserver {host "character creation"

66 hardware ethernet 00VOCVERV 29VOV 4BRO BRV 1BRU 6A; "assign MAC of the host"

67 fixed-address 192.168.29.250; ip

68 option routers 192.168.29.3; Gateway

69 option domain-name "you"; domain name

70 option domain-name-servers 114.114.114.1148.8.8; DNS server address

71}

The configuration file takes effect from local to global.

Default-lease-time 600

Max-lease-time 7200; it can also be set for a particular host

Client:

Configuration / etc/sysconfig/network-script/ifcfg-eth0 file

Put BOOTPROTO=dhcp in it

If the virtual machine is configured as a DHCP server, the appeal settings are the same, but:

And make sure

The client needs to set up the figure as above.

The server starts the DHCP service:

Service dhcpd start

Or / etc/rc.d/init.d/dhcpd start

Dynamic ip can be obtained when the client is booted normally.

On how to build a Linux-DHCP server to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Services servers clients hosts clients files gateways assignments configurations content dynamic domain names time more messages leases help good maximum dedicated to Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MySQL Docker vpn Apple