Assigning a Static IP Address to a Domain on Windows Server 2022 IIS
In this article, we will discuss the process of assigning a static IP address to a domain on Windows Server 2022 IIS. This is a crucial step in setting up a web server, as it ensures that the server can be accessed consistently and reliably. We will cover the following topics:
- Prerequisites
- Assigning a static IP address to IIS
- Configuring DNS
- Testing the configuration
Prerequisites
Before we begin, it is assumed that you have already installed the following components on your Windows Server 2022 machine:
- Internet Information Services (IIS)
- DNS Server
- DHCP Server
- Active Directory
Assigning a static IP address to IIS
To assign a static IP address to IIS, follow these steps:
- Open the Server Manager and click on Local Server.
- Enter the static IP address and subnet mask in the IPv4 address and Subnet mask fields, respectively.
- Click on the OK button to apply the changes.
# Example PowerShell script to assign a static IP address to IIS
New-NetIPAddress -IPAddress 192.168.1.100 -PrefixLength 24 -InterfaceIndex 12
Configuring DNS
Once the static IP address has been assigned to IIS, the next step is to configure DNS. This involves creating a new forward lookup zone and adding a new host (A) record for the domain. Follow these steps:
- Open the DNS Manager and right-click on Forward Lookup Zones.
- Select New Zone and follow the prompts to create a new primary zone.
- Once the new zone has been created, right-click on it and select New Host (A or AAAA).
- Enter the host name and IP address for the domain, then click on the Add Host button.
# Example PowerShell script to create a new forward lookup zone and add a host (A) record
Add-DnsServerPrimaryZone -Name "example.com" -ReplicationScope Forest
Add-DnsServerResourceRecordA -Name "www" -IPv4Address "192.168.1.100" -ZoneName "example.com"
Testing the configuration
To test the configuration, open a web browser and enter the domain name in the address bar. The default IIS welcome page should be displayed, indicating that the configuration has been successful.
References
- Understanding TCP/IP version 4 (IPv4) and version 6 (IPv6) addressing
- Add-DnsServerPrimaryZone
- Add-DnsServerResourceRecordA
This article has provided a detailed overview of the process of assigning a static IP address to a domain on Windows Server 2022 IIS. By following the steps outlined above, you can ensure that your web server is accessible and reliable.