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 set up DHCP server and obtain IP address and related operations automatically

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Theoretical knowledge related to DHCP Services

DHCP services are divided into the following three points

IP address (example: 192.168.1.0) subnet mask (example: 255.255.255.0) gateway

Benefits of DHCP services:

Reduce the workload of administrators to avoid typing errors may avoid IP conflicts improve the utilization of IP addresses to facilitate client configuration

How DHCP services are allocated:

Automatic allocation: permanently use manual allocation after assigning an IP address: the DCHP server administrator specifically specifies the dynamic allocation of IP addresses: release the IP after use for other clients

DHCP lease process (four steps):

1. Client request IP (Discover): the client sends the DHCP request IP address in the form of a broadcast

Source IP address: 0.0.0.0

Destination IP address: 255.255.255.255

two。 Server response (Offer): the DHCP server responds to the client's broadcast

Source IP address: 192.168.10.10

Destination IP address: 255.255.255.255

Provide IP address: 192.168.10.101

3. Client selects IP (Request): client broadcasts select DHCP server (for example, 192.168.10.10)

Source IP address: 0.0.0.0

Destination IP address: 255.255.255.255

Lease term: 8 days

4. Server confirm lease (Ack): server confirmation

Client restart:

Send DHCP Request request packet with IP address (get two results Ack/N Ack) IP address is not assigned to use, send DHCP Ack confirmation message (client continues to use pre-restart IP address) IP address is assigned to other clients for use (send DHCP N Ack denial message, client resend DHCP Discover)

Important: the general renewal time is generally 50% of the lease term (4 days in the case of 8 days)

Set up the operation of DHCP service on the virtual machine

We use Server2016 as the server and Win10 as the client

First, we set the network adapter for the two virtual machines, as shown in the figure (both set to host-only mode)

At the same time, you need to make sure that the status of the network IPv4 is shown in the figure (to obtain the IP address status automatically)

When all the above are ready, click Service Manager on the start menu to enter the interface shown below:

Click to add roles and functions after the interface is fully loaded Click in and click next according to the boot →. By default, choose role-based or feature-based installation → in the installation type. Enter the server selection (if you have multiple hosts, be sure to choose your own host). After the next step, enter select server role, check DHCP server, select add function →, and enter the next step to select whether other features need to be added. Do not add to the next step → for viewing notes, select the next step → to confirm the installation (click close after the installation is complete)

At this time, it should be noted that the network status of Server2016 does not have an IP address. At this time, you need to set an IP address and obtain the subnet mask as shown below (for example: IP address: 192.168.100.100 subnet mask: 255.255.255.0)

After all the above steps are completed, the DHCP server will be built, and a DHCP prompt box will appear in the service manager home page interface.

Click the start menu-Windows Management tools-DHCP, and get the interface as shown in the following figure

Right-click IPv4 to select the new scope, enter the wizard, set the name and go to the next step, enter the server configuration settings of DHCP, start with IP address: 192.168.100.50 end IP address: 192.168.100.80, get the subnet mask and length, and go to the next step to add exclusion and delay (IP addresses in the listed range will not be assigned, in order to avoid repeated conflicts of IP addresses) Start IP address: 192.168.100.55 end IP address: 192.168.100.60 Click to add to the next step, lease term (default 8 days), go to the next step to configure DHCP option Select now configuration to enter the next step, default gateway IP address 192.168.100.1 click to add, enter the next step to add DNS server IP address 192.168.100.100, the system will indicate that it is not found after search Click Yes to continue to add and enter the WINS server configuration. You can skip this step because you do not need it for the time being. Go to the next step and choose to activate it now. At this time, the scope creation is complete.

The allow and deny in the drop-down menu in the filter represent the access whitelist and blacklist, respectively

The above building process is completed on the virtual machine Sever2016.

Later, you need to switch to the win10 client to obtain the address:

1. The operation of automatically obtaining IP address: instruct cmd, run the input command as administrator: enter ipconfig/renew to get the new address, and get the subnet mask and gateway.

Enter the command at this time: ipconfig/all can query the assigned address. The DNS server address is 192.168.100.100 set at that time.

two。 Specify a fixed IP address:

Go back to the server server2016, right-click on the DHCP interface and select New retention, and retain the name (for example: boss). Enter 192.168.100.88 IP address (run cmd and enter the instruction arp-a to see the MAC address of the other party, as shown in the following figure).

When you enter the win10 client instruction interface, you can see that the MAC address is the same.

Follow the above steps to copy and paste the address into the MAC address bar in the new reservation. Select both types and click add. At this time, a boss-specific address will appear in the reservation interface. At this time, we go to the client interface to see if we can get it.

If you continue to use the ipconfig instruction, you will still get the 192.168.100.50 address. If you want to switch to the 192.168.100.88 address now, enter the instruction ipconfig/release (release) to release the original address back to the address pool. At this time, you will get the 192.168.100.88 IP address when you enter ipconfig/renew to get the address back.

Black and white list settings:

Allow: for only allow (whitelist), only this host is allowed to come to me to get the IP address, other hosts are not allowed.

Reject: to reject only (blacklist), hosts on the list are forbidden to obtain IP addresses from me.

Right-click reject, select New filter, then pop up the prompt box and ask to enter the MAC address of the customer who does not receive DHCP service, paste the MAC address we just copied again, describe blocking, and click add. This time is not over, there is a downward arrow at the reject character, right-click reject hit to enable, the arrow disappears, and the function takes effect. At this time, go back to the win10 client input: ipconfig/release release, and then enter: ipconfig/renew hit enter when the address cannot be obtained, as shown in the following figure

Question: is it okay if the address entered in the rejection is re-entered into the permission?

Answer: no

Because entering the same MAC address for a new filter in allow will pop out that the address is already included in a list and cannot be added, as shown in the following figure

If we want to set the blocked address to allow, the method is very simple. Find the address in the rejection, right-click, click "move to allow", and automatically jump to the allowed list.

At this time, go back to the win10 client interface command and enter: ipconfig, the IP address obtained at this time is 169.254.119.212, which is when there is no address, the protocol will assign you an address, which is actually no address (169.254. The number field is a non-address field) as shown in the following figure

This is the whole process of building a DHCP server and how the client automatically obtains the IP address and other related operation settings.

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

Servers

Wechat

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

12
Report