Windows Server Core IP Configuration, Part 2

In the first part of this series I explored the basic settings of IPv4 on Server Core installations. Now it's time to dive a little deeper and explore the tabs behind the Advanced button on the General tab of the Internet Protocol Version 4 (IPv4) Properties screen.

I mentioned being able to let IP traffic flow isn't very useful when you don't have proper name resolution. The time were we knew and could remember each others IP addresses is long gone and since then several solutions have been invented and used to translate names in IPv4 addresses to access resources using common names.

In this part you'll find how to:

 

The Hosts file

Traditionally Windows contains a hosts file. You can use this file as a table to translate hostnames to IP addresses. The Hosts file is actually the oldest known method of name resolution in the computing history and was first used in the early DARPA days. (People actually exchanged hosts files back then!)

Nowadays you can still use the Hosts file to do some basic name resolution. I find it's specifically helpful in certain test scenario's. One example would be to override the information from other name resolution protocols (like DNS) in cases with multiple host headers in IIS.

Note:
The information in the Hosts file affect name resolution for the whole system, not just one Networking connection and can contain more than mere IPv4 addresses.

Modifying the hosts file

To modify your hosts file in Server Core simply type:

 

notepad.exe C:\windows\system32\drivers\etc\hosts

 

At the bottom of the document you can add hostnames, domainnames and other names you want to have translated to specific IP addresses, separated by a tab. When you're done simply safe the file.

 

Configure WINS Servers

Windows Internet Naming Services (WINS) was the most commonly used name resolution method back in the Windows NT days. Nowadays it's mainly used to populate freshly introduced Windows Server 2003 DNS Servers in such environments and in Exchange Server environments, since Exchange 2000 Server and Exchange Server 2003 both need it.

Setting the Primary WINS Server

You can simply add a WINS Server to your IPv4 address configuration by typing the following command on the console of your Server Core box:

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

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 to use as the primary WINS server.

Example:

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

or (with the same effect, but shorter)

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

Setting the Secondary WINS Server (and onward)

You can also add a secondary WINS server by adding a WINS server to the list of WINS servers. You can add even more WINS servers if you feel like it! To add a secondary WINS server type the following command:

netsh interface ipv4 add winsserver [name=]"IDx"
[address=]
IPAddress [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 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 to use as the primary WINS server.
  • ListNumber is the number in the list where you want to add the WINS server. The default WINS server you set with the set winsserver command has listnumber 1. You can start adding WINS servers from number 2 onward. Every WINS server with an index number 2 and higher are considered Secondary WINS Servers.

 

Example:

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

or (with the same effect, but shorter)

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

 

Configuring NetBIOS over TCPIP

In Server Core installations of Windows Server 2008 NetBIOS over TCP/IP (NetBT) is enabled by default when you configure IPv4 manually.  You can disable it by editing the registry. The NetBIOS over TCP/IP setting is stored in the following location:

HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces

Underneath this location you'll find a registry key (depicted as a folder) starting with tcpip_ followed by a GUID for every network connection. Find the network connection for which you want to disable NetBIOS over TCP/IP. (NetBT) In the value you'd find a REG_DWORD value named NetBiosOptions.  This value would have a value of 2. (enabled)

To disable NetBIOS over TCP/IP change the value to 0. (disabled)

 

Configuring DNS Servers

The Domain Naming System (DNS) is the most commonly used name resolution system in the world at this moment. Unlike WINS it's hierarchical, which means it uses a tree-like model consisting of root level domains, domain names and host names. A DNS server near you can look up information on names for you. Depending on its configuration it knows about the local network and can question other DNS servers on information for other networks. The Wikipedia entry explains this very well.

When your Windows Server 2008 box won't act as a Domain Naming System (DNS) server, you need to specify a DNS Server address to your network connection in order to:

  • Browse the Internet (unless you use a proxy in your network)
  • Join an Active Directory domain

Note:
It's possible to configure DNS Servers using Group Policies in Active Directory environments, but since you need a working name resolution method before you can actually join a domain this is not a very efficient method.

It is a best practice to add the IPv4 addresses of two DNS Servers to the configuration of your network connections: A primary DNS server and a secondary DNS server. In order to do so 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 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 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

Configuring DNS Suffixes

In order to make your Windows Server 2008 Server Core boxes be found on the network and make your Server Core boxes find other servers in a complex networking infrastructure you might have to make some adjustments in the DNS Suffix and the DNS Suffixes search list. A DNS Suffix is the part of the DNS name behind the hostname part. It defines the place in the DNS hierarchy of hosts.

Note:
When you join your Server Core box to an Active Directory domain  you probably won't have any problems with DNS Suffixes.

Unfortunately I didn't find a way to change or add DNS Suffixes to Network Connections in Server Core using NetSh. Luckily we can use the Registry Editing tools and alternatively we can use Group policies.

Using Registry Editing tools

The primary DNS suffix is stored in the registry in the following location:

HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

You might want to change the values for the following registry keys:

  • Domain (REG_SZ)
    This value contains the DNS Suffix for the Network Connection on your Server Core box. Changing it will immediately change your DNS Suffix.
  • SearchList (REG_SZ)
    This value contains the DNS Suffix search order list. You can add DNS Suffixes here to use when searching other servers.

Using Group Policy

You can use Group Policies with an Active Directory source, when your Server Core box is joined to a domain. Alternatively you can change the Local Policies with ease, although it won't be pretty security-wise. To change the DNS Suffix and DNS Suffix Search order perform the following clicks:

  1. Log on to a Windows Vista or Windows Server 2008 box with an Administrator account with the exact same password as the Administrator account on the Server Core box
  2. Run gpedit.msc
  3. Open the Computer Policy
  4. (Open Policies)
  5. Open Administrative Templates
  6. Open Network
  7. Open DNS Client
  8. Double click the "Primary DNS Suffix" policy
  9. Enable the "Primary DNS Suffix" policy and type your suffix
  10. Press OK
  11. Open the "DNS Suffix Search Order" policy
  12. Enable the "DNS Suffix Search Order" and type your suffixes
  13. Press OK
  14. Log on the Server Core box
  15. Perform the following command:gpupdate

    The settings from your Local Policy should take effect.

You might want to consider running ipconfig /registerdns after changing the Primary DNS Suffix.

 

Configuring DNS Registration

On a full installation of Windows Server 2008 there are a few options for DNS registration on the DNS tab of the advanced properties of the IP version4 configuration of a Network Connection.

In Server Core you can achieve these settings as well, but only when you set the DNS Server. (fortunately you can set it as many times as you like) Also, you have to specify DNS Suffixes first.  When you set the DNS Server you can optionally use the register= switch at the end of the command. The three switch options are none, primary and both.

  • None
    Specifying Register=None would result in your Server Core box not registering its DNS name with any of its DNS suffixes. This effectively disables Dynamic DNS Registration.
  • Primary
    With Register=Primary your Server Core installation will register its hostname together with its primary DNS suffix with the DNS Server you set.
  • Both
    When you tell your Server Core box to Register=Both it will register its hostname with its primary DNS suffix and the connection specific DNS suffix with the DNS Server you set.

 

Concluding

In this part I've shown you how to configure the settings you find on the tabs of the Advanced Properties of your IPv4 Settings, which mostly relate to name resolution.

Name resolution is pretty essential in a Windows environment, so please configure it well.

Further reading

Wikipedia on Domain name system
TechNet Forums – Change Primary DNS Suffix
TechNet Forums – Configuring NetBIOS over TCP/IP
TechNet Forums – Configuring Jumbo Packets and other MTU settings
TechNet Forums – NETSH problems
Netsh commands
NetBIOS over TCP/IP Name Resolution and WINS
Exchange Server 2003 and Exchange 2000 Server require NetBIOS name resolution

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.

2 Responses to Windows Server Core IP Configuration, Part 2

  1.  

    Hi,

    thanks for the crystal clear information on how to configure networking in Server Core. With respect to disable NetBIOS over TCPIP, you can do that with WMIC command:
    wmic nicconfig get caption,index,TcpipNetbiosOptions
    will give you all settings.
    wmic nicconfig where index=1 call SetTcpipNetbios 2
    will disable Netbios over TCP/IP

    Cheers,
    Jaap Wesselius

  2.  

    Thanx for the input, Jaap!

    Of course a couple of ways exist to tackle these problems and surely there's no one best way to do this.