Batch configuration of reserved IP addresses for DHCP servers

Source: Internet
Author: User
Tags microsoft website

In everyone's impression, the IP address obtained by DHCP has a lease. Once the lease arrives, the client will obtain the IP address again, at this time, the obtained IP address may change compared with the original one, which is unfavorable to network management. If a static IP address is used, the address will not change if the IP address is not moved. However, it is troublesome to change the IP address of each server, which is prone to errors.

In fact, DHCP generally provides the address retention function, which allows the client to allocate a fixed IP address. When DHCP is used in the network, this can greatly facilitate Intranet management. However, it is a little troublesome to keep the Address Configuration. It is a little complicated to say that there are too many configurations. In this case, let's handle the trouble. Haha
The environment described in this article is Windows Server 2003 R2, which is also applicable to Server 2008/2012

1. Calculate the IP addresses and MAC addresses of all clients on the Intranet.

Department Name IP address MAC address
Management Layer Liang xiaoting 192.168.1.10 00-0b-2f-49-d6-65
Liang wenting 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 Department Li Wei 192.168.1.16 00-e0-66-02-e8-86
Liang Yuting 192.168.1.17 00-e0-66-02-dd-70
Pan ruiyue 192.168.1.18 00-e0-4c-41-14-f1
Chen huijuan 192.168.1.19 00-e0-66-02-f4-22
Liu meihong 192.168.1.20 00-e0-66-06-0a-2a
Ministry of Commerce Zhai yejiang 192.168.1.21 00-e0-66-02-f3-4c
Lin liying 192.168.1.22 00-e0-66-02-db-a2
Promotion Su wenfeng 192.168.1.23 54-04-a6-66-bd-bd
Zhong Wen 192.168.1.24 00-30-67-ba-0c-ac
Deng Xuefeng 192.168.1.25 00-e0-62-0b-1f-6c
Zhang guwei 192.168.1.26 Bc-ae-c5-5d-65-c0

2. collect statistics on the name of each client user, MAC address, IP address to be allocated, and the name of the computer user to create a batch file. The following batch processing is used 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 is the MAC address, PC012 is the name, and the computer user is later. This command is to assign 192.168.1.12 to the machine of 00e06602f54c.

Copy codeThe Code is 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 Liang wenting 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 Xuefeng BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.16 00e066064e4d PC016 Chen Han BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.17 00e06602f190 PC017 Li Xiaoming 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 Xie Xiuhong 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 Huang Lijuan BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.23 00e06602f03c PC023 Liu caifan 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 Guohua BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.26 00e06602f193 PC026 Zhang minghang 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 Wei BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.31 00e06602f422 PC031 Zhongmei 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 xiaoting BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.35 00e06602e886 PC035 Liu yangfeng BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.36 00e0620b2039 PC036 Deng xiaofang BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.37 00e06619def4 PC037 morulan BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.38 00e0620b226d PC038 lacquer wave BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.39 00e06602b01e PC039 Peng Yana 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 Guoxiang BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.42 00e0660d71d9 PC042 Qiu Jin BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.43 00e06619dee9 PC043 Chen Yongxing BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.44 00e0660652cd PC044 Xia Yihua BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.45 bcaec55d65de PC045 Huang guorui BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.46 bcaec55d65c0 PC046 Zhang Guowei 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 Luo Lu BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.50 00e0620b1f6c PC050 close jieboth
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.51 00e0620b2280 PC051 Xie Kang Hui 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 Jun BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.55 00e06602f34c PC055 Zhai yejiang 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 Ma yanfei BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.58 00e06602f1bc PC058 Xie yahui 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 Xue zhongboth
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.61 00e06602ddd5 PC061 Feng manzhen BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.62 00e04c096398 PC062 weekly Liu BOTH
Netsh dhcp server 192.168.1.249 scope 192.168.1.0 add reservedip 192.168.1.63 00e06602dba2 PC063 Xie luqiang BOTH

The batch processing command is implemented through the Netsh DHCP server scope add reservedip command

The command explanation is taken from the official Microsoft website.
========================================================== ========================================================== ===
Add reservedip
Retain an IP address for the Media Access Control (MAC) address specified in the current scope.
Syntax
Add reservedipReservedIPMACAddress [ClientName] [ClientComment] [{DHCP | BOOTP | BOTH}]
Parameters
ReservedIP
Required. The IP address to be retained.
MACAddress
Required. Specify the physical hardware or MAC address associated with the reserved IP address.
ClientName
Specifies the name of the client to be associated with the remaining client items. If this parameter is not specified, no client name is associated with the reserved client name.
ClientComment
Specifies the client comments associated with the client items to be retained. If this parameter is not specified, no client comments are associated with the reserved client.
{DHCP | BOOTP | BOTH}
Specifies the client type to be associated with the reserved client items. The default value is DHCP.
========================================================== ========================================================== ====

3. Create a scope on the server, and then run the batch processing. Just wait for a cup of coffee to finish.

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.