Windows Server Core IP Configuration, Part 1

Reading Time: 4 minutes

Networking services are a big part of the services you can make your Server Core box perform. Having properly configured network connections are prerequisites to offering these services, so I feel it's time to explain how to properly configure the networking connections on Server Core installations of Windows Server 2008.

I'll start with configuring the basic IP version 4 settings in the first part of this series. These are the settings you'd find in a full installation when you double click your Network Area Connection, Click on the Properties button and then open the properties for Internet Protocol Version 4 (TCP/IP v4) I'll cover the tabs behind the Advanced button in later parts of this series.

This blog post contains the following items:

 

IPv4 Addressing

To enable traffic over a TCP-IP connection you'd formally only need to supply an IP Address, a Subnet Mask (although this is usually auto-configurable with the use of Network classes) and the address of the nearest router. (called the Default Gateway in Windows)

For client computers you can rely on the Dynamic Host Configuration Protocol (DHCP) to automatically assign IP addresses from a pool of addresses and direct computers to the nearest router using DHCP option 003. Using DHCP for servers is usually not a very good idea and in most Windows Server scenarios not recommended nor supported.

By default Windows Server 2008 Networking Connections are configured to use an IP address, assigned by DHCP. This will enable you to update and rename the server before giving it its firm place in your network.

Setting the IP Address, Subnet Mask and Default Gateway for your IPv4 enabled Network Connection is rather easy using the NetSh command. The command looks like this:

netsh interface ipv4 set address [name=]"IDx" [source=]static [address=]IPAddress [mask=]SubnetMask [gateway=]DefaultGateway

Where:

  • IDx is the Identification of the Networking Interface for which you want to change the address. You can view the identification flags when you use the command

    netsh interface ipv4 show interfaces.

    When you only have one Networking Interface Card (NIC) the IDx of this card will be Local Area Connection.

  • IPAddress is the static IPv4 Address you want to provide to your Network Connection in the form of four bytes separated by dots.
  • SubnetMask is the SubnetMask for the connection, which describes the boundary for the local network on your side of the Default Gateway. The notation of the SubnetMask is also four bytes separated by dots.
  • DefaultGateway is the IPv4 address of the nearest router.

Example:

netsh interface ipv4 set address name="Local Area Connection" source=static address=192.168.1.1 mask=255.255.255.0 gateway=192.168.1.254

or (with the same effect, but shorter)

netsh interface ipv4 set address "Local Area Connection" static 192.168.1.1 255.255.255.0 192.168.1.254

 

 

DNS Settings

On the General tab of the Internet Protocol Version 4 (TCP/IPv4) Properties screen on a full installation of Windows Server 2008 you see two more fields you can enter IPv4 addresses in. By default they are grayed out because you'd be using a DHCP address. When you specify a static address however you end up with empty DNS Server addresses for the Preferred DNS Server and the Alternate DNS Server. In most networking environment this is highly inconvenient.

It is not strictly necessary to set a Primary DNS Server and a Secondary DNS Server. (or Preferred DNS Server and Alternate DNS Server as we seem to call 'em nowadays) For availability reasons in Active Directory environments it is recommended though. Below is a table which shows you the available combinations and their impact:

IP Address Preferred DNS Alternate DNS End result
source=dhcp source=dhcp not configured client settings
source=dhcp source=static not configured client settings (alternative)
source=dhcp source=static configured (added) client settings (alternative)
source=static source=dhcp not configured not recommended
source=static source=static not configured less recommended
source=static source=static configured (added) Recommended Server Core

In order to do set both the Preferred DNS Server and Alternate DNS Server utilize the following two commands:

netsh interface ipv4 set dnsserver [name=]"IDx" [source=]static [address=]IPAddress

netsh interface ipv4 add dnsserver [name=]"IDx" [address=]IPAdress [index=]ListNumber

Where:

  • IDx is the Identification of the Networking Interface for which you want to change the address. You can view the identification flags when you use the commandnetsh interface ipv4 show interfaces.

    When you only have one Networking Interface Card (NIC) the IDx of this card will be Local Area Connection.
  • IPAddress is the static IPv4 Address you want to provide to your Network Connection to use as the DNS server. In the first command this IP Address represents the primary DNS server. In the second command this IP Address represents the secondary DNS server.
  • ListNumber is the position in the DNS server list where you want to add the DNS Server address. The lower the number, the higher the DNS Server is added to the DNS Server list. For a secondary DNS server you can use index 2. For further DNS servers you can add IP addresses with higher index numbers.

Examples:

netsh interface ipv4 set dnsserver name="Local Area Connection" source=static address=192.168.1.254

netsh interface ipv4 add dnsserver name="Local Area Connection" address=192.168.1.253 index=2

or (with the same effect, but shorter)

netsh interface ipv4 set dnsserver "Local Area Connection" static 192.168.1.254

netsh interface ipv4 add dnsserver "Local Area Connection" 192.168.1.253 2

 

 

Concluding

Configuring Server Core to network with your other servers is pretty straightforward. You can configure the settings you see on the General tab of the Internet Protocol Version 4 (TCP/IPv4) Properties screen in a full installation of Windows Server 2008 with the use of Netsh.exe.

Please remember to set the Preferred DNS Server and if applicable add the Alternate DNS Server when you specify a static IP Address.

Join me in Part 2, where I'll dive a bit deeper into Name Resolution on Server Core, since this raises a lot of questions on the Microsoft Forums.

Further reading

Exchange Server 2003 and Exchange 2000 Server require NetBIOS name resolution
Server Core Installation Option of Windows Server 2008 Step-By-Step Guide
Configuring Windows Server 2008 Server Core Basic Networking Settings
Server Core: Setting a Static IP address
LeeDesmond’s blog » Still Very Much Alive and Kicking – netsh
"Obscurum per Obscurius" – Automate Network Adapter Configuration using NETSH
Server Core – Initial Configuration
Setup Server Core onto the Network and Join a domain
Windows Command Line Tools
The power of "netsh"
Set Your IP with a Bat File:D
Configuring DHCP or Static IP From the Command Line

Disclaimer Beta Software

The information on this webpage applies to software from Microsoft that was in testing phase but utilizable by experienced users by the time the webpage was written. This software has not been released for sale, distribution or usage for the general public. The information on this webpage and the beta software are provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose.

One Response to Windows Server Core IP Configuration, Part 1

  1.  

    Now, it's easy, thank you so much.

leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.