Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


July 2008

Fine-tune Server Core’s IP Stack with Netsh

A familiar tool helps you do the necessary tinkering
RSS
Subscribe to Windows IT Pro | See More Utilities Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Executive Summary:

To get Server Core’s network stack set up, you can use the Netsh utility, which has gone through some recent changes. Here’s how to use the latest incarnation.

If you’re like me, you’re excited about the prospect of Server Core, Windows Server 2008’s GUI-less alternative. In this space, I’ve tackled a few aspects of Server Core configuration. Now, it’s time to get Server Core’s network stack set up. To do that, I’ll use Netsh, a tool that I’ve described in the past but that’s changed enough to warrant a new look.

IP and DNS
Netsh can accomplish many tasks, and one of those is to set a system’s IP address and DNS servers. Like the IPv4 Properties GUI that you’ll find in the full Server 2008 installation, Netsh lets you choose to either assign a static IP address or get IP information from a DHCP server. Using DHCP makes for a simpler command, so let’s start with that:

netsh int ip set address “<adapter name>” dhcp
  [store=active|persistent]

store= parameter is new to Server 2008 and Windows Vista—store=active makes this change to the TCP/IP stack but undoes it at the next reboot, and the default store=persistent makes the change permanent. For example, to configure a Server Core system to get an IP address for an Ethernet adapter from a DHCP server, you’d type
netsh int ip set address “local area connection” dhcp

DHCP is the default setting, so it’s more likely that you’ll want to set a static IP address. To do so, assemble a Netsh command as follows:
netsh int ip set address “<adapter name>” static <IP
  address> <netmask> [<gateway IP address> [<metric>]]

Notice that the gateway is now optional. Some older versions of Netsh complained if you left the default gateway’s IP address off a Netsh command. For example, to assign a static IP address of 192.168.2.2 on a /24 network with a default gateway address of 192.168.2.1, you’d type

netsh int ip set address “local area connection” static
  192.168.2.2 255.255.255.0 192.168.2.1
Here, I specified a default gateway but not a gateway metric; again, earlier versions of Netsh wouldn’t have allowed that. Also, I specified the network interface’s entire name—“local area connection.” Previously, I’ve advised people to shorten “local area connection” to “local” to save typing time and to avoid the need for quotation marks, but I fear that the days of abbreviating network interface names are gone forever. Server 2008’s insistence on IPv6 means that every NIC has at least one tunnel adapter with a name such as “local area connection 8.” Therefore, you must specify the full adapter name of “local area connection”; otherwise, Netsh might get confused and assign that IP address to your tunnel adapter rather than the NIC for which you intended it.

First, Second, Third…
Finally, you’ll want to specify one or more DNS servers’ IP addresses that your Server Core system can use for resolving names. Netsh can do that, but the syntax is a bit unexpected: You use netsh int ip set dns to set the preferred DNS server and netsh int ip add dns to specify your additional choices. The syntax for setting the first DNS server is easier than for setting the IP address:

netsh int ip set dns “<adapter name>” static <IP address> | dhcp
For example, to give your Server Core system a preferred DNS server with an IP address of 10.50.50.4, you’d type
netsh int ip set dns “local area connection” static 10.50.50.4

To add subsequent DNS servers to search, you’d use the syntax

netsh int ip add dns “<adapter name>” <IP address>
No static keyword is necessary in this command; you can’t tell your system to accept a statically assigned, preferred DNS address but then get the subsequent DNS server IP addresses from DHCP. So, for example, to tell your Server Core system to look to the DNS server at 10.50.50.1 when the DNS server at 10.50.50.4 doesn’t respond, you would type
netsh int ip add dns “local area connection” 10.50.50.1
Assemble a Batch File
By now, you’re pretty far along in the process of setting up your Server Core system. I recommend assembling a batch file that contains all your setup commands—it would be a great tool either for rebuilding after a disaster or building a test network that parallels your real network!

End of Article



Reader Comments

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

WinInfo Short Takes: Week of November 23, 2009

An often irreverent look at some of the week's other news, including some post-PDC some soul searching, a Google Chrome OS announcement and a Microsoft response, Windows 7 off to a supposedly strong start, the Jonas Brothers and Xbox 360, and so much more ...

2009 Windows IT Pro Editors' Best and Community Choice Awards

Picking a favorite product from an impressive crowd of competitive offerings is never an easy task, and such was the case with our Editors' Best and Community Choice awards this year. ...


Related Events Deep Dive into Windows Server 2008 R2 presented by John Savill

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement