Computer and IT knowledge - things to know
windows server - how to change a subnet mask of a dhcp scope
for example change subnet mask from a scope 172.16.0.0/16 to 172.16.99.0/24
1) export to xml file using powershell
Export-DhcpServer -Computername <name of computer> -Leases -File C:\export_dhcpserver.xml -verbose
<name of computer could be 127.0.0.1 or localhost if do export the configuration directly from the server>
2) make a copy of the exported file, name it: import_dhcpserver.xml
3) edit the import_dhcpserver.xml file and replace the dhcp scope section,
and all lease entries that reference to the section name:
3.1) dhcp scope section, change the ScopeId + the subnet mask
<Scopes>
<Scope>
<ScopeId>172.16.99.0</ScopeId>
<Name>intern</Name>
<SubnetMask>255.255.255.0</SubnetMask> #change subnet mask here
<StartRange>172.16.99.1</StartRange>
3.2) dhcp lease entrie, make sure to change the ScopeId to the new scope id
<Lease>
<IPAddress>172.16.99.177</IPAddress>
<ScopeId>172.16.99.0</ScopeId> #change the scope ip here
4) delete the scope id(s) from the dhcp server, using the dhcp admin tool
5) now import the new file:
Import-DhcpServer -Computername <name of computer> -Leases -File C:\import_dhcpserver.xml -BackupPath C:\dhcpbackup\ -Verbose
6) Restart both DHCP client and Server services
7) check the dhcp tool if everything looks fine
computer2know :: thank you for your visit :: have a nice day :: © 2024