Windows Server 2008: Configuring DNS, DHCP, and Host Name for a Static IP Address
In a Windows Server 2008 network environment, it is common to have a domain controller that also functions as a DHCP server. In such a scenario, you may encounter situations where you need to assign a static IP address to a machine while ensuring that it also has a host name and DNS registration. In this article, we will walk you through the steps to configure DNS, DHCP, and host name for a machine with a static IP address.
Prerequisites
Before we begin, ensure the following prerequisites are met:
- A Windows Server 2008 domain controller with DHCP server role installed
- A machine with a static IP address (e.g., 192.168.10.201) that needs to be registered with DNS and assigned a host name
- Access to the Server Manager console on the domain controller and the machine with the static IP address
Configuring DHCP
First, let's configure the DHCP server to exclude the static IP address from the DHCP pool. This will ensure that the static IP address is not accidentally assigned to another machine:
# Open DHCP Manager
Start-Process dhcp.msc
Expand the DHCP server
Expand-DhcpServerScope -Name ""
Exclude the static IP address from the DHCP pool
Add-DhcpExclusion -ScopeID "
Configuring Host Name and DNS Registration
Next, we will configure the machine with the static IP address to register its host name with DNS:
# Open an elevated PowerShell console on the machine with the static IP address
Start-Process powershell.exe -ArgumentList "-ExecutionPolicy Bypass -File C:\path\to\script.ps1" -Verb RunAs
Set the host name
[System.Environment]::SetEnvironmentVariable("ComputerName", "SE-Machine", "Machine")
Renew DHCP lease and register host name with DNS
ipconfig /release
ipconfig /renew
Verifying the Configuration
To verify the configuration, open a command prompt on the domain controller and run the following command:
nslookup SE-Machine
The output should display the IP address (192.168.10.201) associated with the host name (SE-Machine).
In this article, we learned how to configure DNS, DHCP, and host name for a machine with a static IP address in a Windows Server 2008 network environment. We first excluded the static IP address from the DHCP pool to prevent conflicts. Then, we configured the machine to register its host name with DNS.