Configuring a DHCP Reservation
DHCP enables you to create an IP address reservation which means you can create an IP configuration for a specific host. If you need to change a host's IP address later, you can just change the DHCP reservation (and refresh the DHCP lease on the host). You might have, for example, a printer that gets its IP configuration via DHCP.
For more information on DHCP reservations, see:
Getting ready
You run this recipe on SRV2.
This host is a domain-joined server on which you have loaded both PowerShell 7 and VS Code. In "Configuring IP Addressing," you configured the NIC in this host to have a static IP address. Later, in "Using DHCP," you gave SRV2
a DHCP address.
How to do it...
- Importing the DHCP Server module explicitly
Import-Module -Name DHCPServer
- Getting NIC's MAC Address for NIC in
SRV2
$SB = {Get-NetAdapter -Name 'Ethernet'}
$Nic = Invoke-command -ComputerName SRV2 -ScriptBlock $SB
$MAC = $Nic.MacAddress...