Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure DHCP in Linux system

2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the Linux system how to configure DHCP, the article is very detailed, has a certain reference value, interested friends must read it!

Linux system configuration DHCP specific steps Experimental Environment: RHEL Server 5.8

Case 1 (single scope):

The topology diagram of the case (because they are all under vnet1 and not routed, the following figure is shown):

1. To install dhcp, the yum server has been correctly configured by the previous article, so you can install it directly with the yum source, and the terminal executes yum install dhcp.

The following figure shows the correct installation

two。 Edit configuration file / etc/dhcpd.conf initial state, it is empty, can be opened with vim, enter "r / usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample" in the last line mode

As shown below:

The configuration details are as follows:

Ddns-update-style interim; / / configure DHCP and DNS for interactive update mode

Ignore client-updates; / / ignores client updates.

Subnet 192.168.142.0 netmask 255.255.255.0 {/ / define scope

Option routers 192.168.142.20; / / default route

Option subnet-mask 255.255.255.0; / / Subnet mask

Option nis-domain "liuyuan.org"; / / NIS domain name

Option domain-name "liuyuan.org"; / / DNS domain name

Option domain-name-servers 192.168.142.20; / / DNS server address

Option time-offset-18000

# Eastern Standard Time / / set the time offset with Greenwich for the client

# the following two items have been commented out because this experiment is useless

# option ntp-servers / / Network time server address

# option netbios-name-servers / / specify WINS server address

Range dynamic-bootp 192.168.142.20192.168.142.254

/ / dynamically assigned address range

Default-lease-time 21600; / / default lease time

Max-lease-time 43200; / / maximum lease time

Host windosxp {/ / specify a specific host

Hardwareethernet 00VOCVOR 29FDFD 44C8; / / hardware address

Fixed-address 192.168.142.200; / / IP address

}

}

As shown below:

3. Start the dhcp service and set boot up, / etc/init.d/dhcpd restart;chkconfig dhcpd on

4. Test verification (with windows): as shown below:

5. What if our mainframe wants to get 192.168.142.200 every time? In fact, it is also easy, the problem of binding with the address of dhcp is easy to solve.

As can be seen from the figure above, the ip of this test host is 192.168.142.254. We can obtain its MAC address by looking at the / var/lib/dhcpd/dhcpd.lease file, and open the / var/lib/dhcp/dhpcd.lease file as shown below (partial figure):

6. Then bind and modify the configuration file according to the MAC, as shown below:

7. Restart the dhcp service and test it. As shown in the figure below, 192.168.142.200 is correctly obtained and the test is successful.

The above is all the contents of the article "how to configure DHCP in Linux system". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report