DHCP reservation allows you to reserve an IP address for a specific device by its physical (MAC) address. Such a device will receive the same IP address from the DHCP server, and it will never change. In this article, we’ll look at how to create and manage DHCP reservations on a Windows Server host.
Some devices on your network, which are used by other users and services (servers, printers, scanners, routers, switches, storage device, etc.), require a fixed static IP that should not change. There are two ways to assign a specific IP address to a device on a TCP/IP network:
- Manually set a static IP address in the device settings;
- Reserve an IP address for the device on the DHCP server.
The centralized reservation of IP addresses on the DHCP server allows you to manage the IP addresses of the devices on your network from a single console. There is also no need to log on to each device locally and manually set the IP parameters for the network adapter.
Adding DHCP Reservation on Windows Server
The Windows Server DHCP Server role is used to assign dynamic IP addresses to client devices.
Use the DHCP console to manage this role. You can run the console from System Manager > Tools > DHCP or by using the dhcpmgmt.msc command.
Assuming your DHCP server already has configured scopes for which you want to create IP reservations. Expand your IPv4 scope in the DHCP console where you want to create the reservation.
You can create a new DHCP reservation from any leased IP address or create a new entry manually.
If the DHCP server client has already received a dynamic IP address from your DHCP server, you can reserve this address.
- Expand the Address Leases section;
- Find the DHCP client you need in the list (currently issued dynamic IP addresses have a lease expiration date);
- Right-click on the item and select Add to Reservation.
- The current IP address will be reserved for this device’s MAC address;
- In the Reservations section, a new entry will be created for your device.
You can also create a DHCP reservation manually. To do this, you will need to get the hardware (MAC) address of the device’s network adapter. On Windows you can find your MAC address with the command:
Ipconfig /all
In this example, the Physical Address is 08-3E-8E-AA-F3-0D. Copy this value.
Right-click on the Reservations section in the DHCP console and select New Reservation.
Specify the new reservation settings:
- Reservation name: type the network name of the device;
- IP address: set the device’s IP address from your DHCP scope;
- MAC address: paste the physical adapter address you just got;
- Descriptions: provide a device (optional).
Click the Add button to create a new reservation.
If you entered the MAC address in the wrong format, an error will appear “The Unique Identifier you have entered may not be correct. Do you want to use this Identifier anyway?”. Double-check the MAC address in this case.
You will need to reboot your device to obtain a reserved IP address. Or run the following commands to release the old IP and get a new one from DHCP server.
ipconfig /release ipconfig /renew
You can manage your reserved IP addresses from in Reservation section. This is where you can delete or change any of the DHCP reservation settings.
Managing DHCP Reservations with PowerShell
You can also create, modify, and delete reservations on the DHCP server from the PowerShell command line.
The Add-DhcpServerv4Reservation cmdlet is used to create DHCP reservations.
The following command will reserve the leased IP address for a device that has already received an IP address from your DHCP server:
Get-DhcpServerv4Lease -IPAddress 192.168.1.50| Add-DhcpServerv4Reservation
If you need to create a new DHCP reservation for a specific MAC address, use the command:
Add-DhcpServerv4Reservation -ScopeId 192.168.1.0 -IPAddress 192.168.1.51 - ClientId "00-0C-29-05-8B-7E" -Description "Boss_laptop"
Hint. You can find out the MAC address on a Windows computer using the command:
Get-NetIPConfiguration | select @{n=’ipv4address’;e={$_.ipv4address[0]}}, @{n=’macaddress’; e={$_.netadapter.macaddress}}
To create multiple DHCP reservations in bulk, create a CSV file containing the Scope ID, Client Name, MAC, and the required IP address:
ScopeId,Name,ClientId,IPAddress 192.168.1.0,computer1,08-3E-8E-AA-F3-1D,192.168.1.56 192.168.1.0,computer2,08-3E-8E-AA-F3-2D,192.168.1.57 192.168.1.0,computer3,08-3E-8E-AA-F3-3D,192.168.1.58
Then run the command to create DHCP reservations for all devices in this file:
Import-Csv –Path C:\PS\dhcpreservations.csv | Add-DhcpServerv4Reservation -ComputerName nydhcp.theitbros.com
You can change DHCP reservation settings with Set-DhcpServerv4Reservation cmdlet. For example, you can replace the MAC address for a reservation:
Get-DhcpServerv4Reservation -IPAddress 192.168.50.56 | Set-DhcpServerv4Reservation -ClientId "00-0C-29-05-8B-7E" -Verbose
In order to remove the specific DHCP reservation, run the command:
Get-DhcpServerv4Reservation -IPAddress 192.168.50.56| Remove-DhcpServerv4Reservation
1 comment
nie wiem dalej jak to zrobic