DHCP server bulk configuration reserved address _win server via batch processing

Source: Internet
Author: User
Tags ming reserved
In everyone's mind, DHCP gets the address is a lease, the lease is, the client will regain the IP address, when the IP address obtained is likely to change compared to the original, which is very detrimental to network management. With static IP, the address will not change, but to modify up to each machine to row a little trouble, error prone.

In fact, DHCP generally have address reserved address function, can let the client assign to a fixed IP address, in the network using DHCP, this can bring great convenience to the intranet management. But keep the address configuration is a bit of trouble, to configure the number of less good to say, if more, but it is a trouble ah. Let's give the trouble to the batch. Ha ha
The environment described in this article is Windows Server 2003 R2 and is also applicable to server 2008/2012



1. The IP address and MAC address of all clients in intranet should be counted first.

Department Name IP Address MAC address
Management level Liang 192.168.1.10 00-0b-2f-49-d6-65
Liangwenting 192.168.1.11 00-e0-66-02-f5-4c
Zeng Chunmei 192.168.1.12 00-e0-66-06-07-5d
Lu Yanxuan 192.168.1.13 00-e0-66-06-4a-37
Lin Xiaojie 192.168.1.14 00-e0-66-02-29-5e
Yang Jiahua 192.168.1.15 00-e0-66-17-16-41
Service Li 192.168.1.16 00-e0-66-02-e8-86
Liang Yuting 192.168.1.17 00-e0-66-02-dd-70
Panry Month 192.168.1.18 00-e0-4c-41-14-f1
Chenhuijuan 192.168.1.19 00-e0-66-02-f4-22
Liu Mihong 192.168.1.20 00-e0-66-06-0a-2a
Commerce Shijian 192.168.1.21 00-e0-66-02-f3-4c
Lin Liying 192.168.1.22 00-e0-66-02-db-a2
Promote Su Wenfeng 192.168.1.23 54-04-a6-66-bd-bd
Zhongwen 192.168.1.24 00-30-67-ba-0c-ac
Dengxuefeng 192.168.1.25 00-e0-62-0b-1f-6c
Zhang Guiwei 192.168.1.26 Bc-ae-c5-5d-65-c0

2. According to the statistics of each client user's name, MAC address, to assign the IP address, computer user's name, made a batch file. Take the following batch as an example, 192.168.1.249 is the DHCP server, 192.168.1.0 is the scope, 192.168.1.12 is the address, 00e06602f54c this is the MAC address, PC012 is the name, followed by the computer users. The order is to assign the 192.168.1.12 to the 00e06602f54c machine.

Copy Code code as follows:

netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.12 00e06602f54c PC012 Liu Zhixian BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.13 00e06602d6e9 PC013 Liangwenting BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.14 00e06606075d PC014 Zeng Chunmei BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.15 00e06602e5ea PC015 Tan Xue BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.16 00e066064e4d PC016 Chenhan BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.17 00e06602f190 PC017 Li Yu Ming BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.18 00e06606076b PC018 Pan Hui BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.19 00e06602df8b PC019 Ye Jiankun BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.20 00e066064e4f PC020 She Shuhong BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.21 00e06602f355 PC021 Li Cheng Original BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.22 00e04c4111ac PC022 Anissa BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.23 00e06602f03c PC023 Liu Yafan BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.24 00e0660645ce PC024 li Quantum BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.25 00e0660645d0 PC025 Deng National flower BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.26 00e06602f193 PC026 Zhang Ming Airways BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.27 00e0620b228f PC027 Zhongjuan BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.28 00e06602deca PC028 Ning Yali BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.29 00e06602f404 PC029 Tan Danping BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.30 00e0620b2320 PC030 Li BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.31 00e06602f422 PC031 mui Fa Jong BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.32 00e066064a37 PC032 Lu Yanxuan BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.33 00e04c4114f1 PC033 Liu Yuling BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.34 000b2f49d665 PC034 Liang BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.35 00e06602e886 PC035 Liu Yanfeng BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.36 00e0620b2039 PC036 Deng BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.37 00e06619def4 PC037 Moruland BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.38 00e0620b226d PC038 paint Wave BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.39 00e06602b01e PC039 Penjana BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.40 00e04c4111b3 PC040 Feng Jingjing BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.41 00e06602df8c PC041 Zhou BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.42 00e0660d71d9 PC042 Chu Jin BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.43 00e06619dee9 PC043 Chen Yong BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.44 00e0660652cd PC044 Shaiwa BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.45 bcaec55d65de PC045 Huang BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.46 bcaec55d65c0 PC046 Zhang Guiwei BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.47 20cf3020da33 PC047 Cai Zexin BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.48 00e04cd92540 PC048 Li Xiang BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.49 00e04c4111a8 PC049 Rolu BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.50 00e0620b1f6c PC050 Guankaijie BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.51 00e0620b2280 PC051 Sheikang BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.52 00e04cd91f45 PC052 Wang Xiaoping BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.53 00e06602d9f5 PC053 Xu Zhenfei BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.54 00e06602e014 PC054 Cao June BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.55 00e06602f34c PC055 Shijian BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.56 00e04c411186 PC056 Zhao Anrong BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.57 00e06619e09c PC057 Fly Ma Yan
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.58 00e06602f1bc PC058 Cheiahui BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.59 00e06619df0d PC059 Chen Kai BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.60 00e06602decd PC060 Shizong BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.61 00e06602ddd5 PC061 Feng BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.62 00e04c096398 PC062 Zhou Liu BOTH
netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.63 00e06602dba2 PC063 Cheroux Strong BOTH




The commands for this batch are implemented through the Netsh DHCP server scope add reservedip command

the explanation for the order is from Microsoft's website
===================================================================================
Add ReservedIP
Retains an IP address for use in the media access control (MAC) address specified in the current scope.
Grammar
Add reservedipreservedipmacaddress [ClientName] [ClientComment] [{DHCP | BOOTP | BOTH}]
Parameters
ReservedIP
Necessary. Specifies the IP address to retain.
MACAddress
Necessary. Specifies the physical hardware or MAC address to associate with the reserved IP address.
ClientName
Specifies the name of the client to associate with the reserved client item. If not specified, the client name will not be associated with the reserved client item.
ClientComment
Specifies the client comment to associate with the reserved client item. If not specified, there will be no client comments associated with the reserved client item.
{DHCP | bootp| BOTH}
Specifies the type of client to associate with the reserved client item. The default value is DHCP.
====================================================================================

3. Set up a scope on the server, and then run batch processing, a cup of coffee waiting to complete the line





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.