Get the App
SLTechnology News&Howtos  ›  Development  › 

How to build DHCP in Linux system

Shulou Source: shulou.com Published: 2022-06-01 22:38:42 09月17日 Update

Linux system how to build DHCP, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Introduction to DHCP: DHCP (Dynamic Host Configuration Protocol), dynamic host configuration protocol, is an application layer protocol.

When we set the client host ip address to dynamic acquisition mode, the DHCP server will assign IP to the client according to the DHCP protocol, so that the client can use this IP to access the Internet.

The predecessor of DHCP is the BOOTP protocol (Bootstrap Protocol). BOOTP was created to automatically assign addresses to devices connected to the network, and was later replaced by DHCP. DHCP is more complex and more powerful than BOOTP.

As you can see later, when displaying DHCP packets with Wireshark filtering, you need to enter the filter condition BOOTP instead of DHCP, but maybe it's because the Wireshark version I used is the older 1.12.9, which I haven't tried in the new version, maybe you can type DHCP to show only the DHCP package.

Specific steps for building DHCP in Linux system: 1. Check the DHCP installation package rpm-Q dhcpd

2. Check the content rpm-ql dhcp installed in the DHPC package.

3. Copy the sample DHPC configuration file provided by the system to cp / usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample / etc/dhcpd.conf in the / etc directory.

4. The declaration is used to describe the division of the network layout in the dhcp server, which is the logical scope of the network setting.

Subnet 192.168.1.0 netmask 255.255.255.0 {. ..

}

Default-lease-time 21600; / default lease time max-lease-time 43200; / maximum default lease time

Option routers 192.168.1.1; / subnet gateway option subnet-mask 255.255.255.0 / subnet mask

Global settings work with the entire configuration file

Ddns-update-style interimdafault-lease-time 21600gentMAXMAXUASE Mustang time 43200 X option domain-name "test.com" option domain-name-servers 192.168.1.1202106.0.20; the IP address of the / DNS server is set using this option

Subnet declares dynamically assigned addresses and network properties set in a subnet

Subnet 192.168.1.0 netmask 255.255.255.0 {

Rang 192.168.1.128 192.168.1.254; / dynamically assign IP address pool option subnet mask 255.255.255.0; / dynamically assign default subnet mask option routers 192.168.1.1; / dynamically assign default gateway

}

Fix IP to a host

Host Server01 {hardwar ethernet 0:0c:c3:22:46:81 / this location is the MAC address fixed-address 192.168.1.11 of the IP host to be fixed; / the IP address option subnet-mask 255.255.2550 to be permanently assigned; option routers 192.168.1.1

}

If a host has multiple network cards (network interface), you need to set the DHCPADRGS= eth0 / eth0 network interface name of the DHCP service in the / etc/sysconfig/dhcp file.

5. View the lease file / var/bin/dhcp/dhcpd.leases of the dhcp server

What are the versions of Linux? the versions of Linux are Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and so on. Among them, Deepin is one of the best-developed Linux distributions in China; UbuntuKylin is a derivative release based on Ubuntu; Manjaro is a Linux release based on Arch; LinuxMint's default Cinnamon desktop is similar to Windows XP's easy-to-use; Ubuntu is the Linux operating system based on desktop applications.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Address assignment dynamic network host service system file server version subnet customer lease release configuration content interface time desktop gateway Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft Shulou Tech Info Apple Xiaomi