Procedure and Code for configuring DHCP on the command line

Source: Internet
Author: User

I believe many of my friends are familiar with the command line. How can I configure DHCP using the command line? I don't know if this method is always used. Let's take a closer look.

In some settings, we can skip this step. Here we will explain how to use the command line to set DHCP. A windows 2000 server is installed in a single-host environment. Let's configure a dhcp server using the command line.

1. First enter the command line dhcp Configuration Mode

 
 
  1. F: \> netsh
  2. Netsh> dhcp
  3. Dhcp> server 192.168.0.1 // 192.168.0.1 is the address of the DHCP server you want to manage
  4. Dhcp server>

2,

 
 
  1. dhcp server>show scope 

Total number of scopes: 0

The command is successfully completed. Check the scope configuration on the target. At this time, there is no scope.

3. Use the command line to add a scope

 
 
  1. dhcp server>add scope 192.168.0.0 255.255.255.0 192.168.0.0 MyComment 

Okay, let's check dhcp in mmc and see what changes have taken place. Let's look at the large blue exclamation point scope. We didn't worry about any configuration in it. Let's continue, I am just panicking for a long time, a waste of time)

4,

 
 
  1. dhcp server>scope 192.168.0.1 

Change the context of the current scope to the 192.168.0.1 scope.

5,

 
 
  1. dhcp server scope>add iprange 192.168.0.2 192.168.0.254 DHCP 

Use the command line to add an allocated address range

6,

 
 
  1. dhcp server scope>add excluderange 192.168.0.1 192.168.0.1  
  2.  
  3. dhcp server scope>add excluderange 192.168.0.241 192.168.0.254 

Add two exclusion ranges: 192.168.0.1, 192.168.0.241-192.168.0.254

7,

 
 
  1. dhcp server scope>add reservedip 192.168.0.240 08002b30369B Mr.Wu Mr.wu both 

Add a retained ip address for MAC 08002b30824b. The retained ip address is called Mr. Wu.

8,

 
 
  1. dhcp server scope>set optionvalue 003 ipaddress 192.168.0.1  
  2.  
  3. dhcp server scope>set optionvalue 006 ipaddress 192.168.0.1 

Add two scope options 003 and 006 to this scope.

9. dhcp server scope> set reservedoptionvalue 192.168.0.240 003 ipaddress 192.168.0.1

Set the range option 003 for the reserved address 192.168.0.240

Now the configuration of scope 192.168.0.0 is complete. You can configure other selected projects as needed.

In mmc, refresh scope 192.168.0.0. Everything is normal.

10. Configure two scope 192.168.1.0 and 192.168.2.0 in the same way.

11. Use the command line to configure superscope

 
 
  1. F:\>netsh  
  2. netsh>dhcp  
  3. dhcp>server 192.168.0.1  
  4. dhcp server>scopt 192.168.0.0  
  5. dhcp server scope>set superscope 192.168.0-192.168.2 1  
  6.  
  7. F:\>netsh  
  8. netsh>dhcp  
  9. dhcp>server 192.168.0.1  
  10. dhcp server>scopt 192.168.1.0  
  11. dhcp server scope>set superscope 192.168.0-192.168.2 1 

Refresh the DHCP server and see what else is there.

12. Add a class

 
 
  1. Dhcp server> add class workgroup1 workgroup1 ClassForWorkgroup1 0 so that a user class is added.

13. Add and configure multicast Scope

 
 
  1. dhcp server>add mscope 224.0.0.0 mscope 40  
  2. dhcp server>mscope 224.0.0.0  
  3. dhcp server mscope>add iprange 224.0.0.1 224.0.0.10  
  4. dhcp server mscope>add excluderange 224.0.0.1 224.0.0.1 

14. dump Problems

 
 
  1. netsh dhcp server 192.168.0.1 dump >>e:\101.txt 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.