Dark Developments Where Knowledge Meets Power

23Aug/110

WIN2008 – Network Interfaces: Static, DHCP & Rename

Windows Server 2008 - Network Interfaces: Static, DHCP & Rename
The best practice regarding IP's for servers is providing them with a static IP. Preferred in a different range than the clients or an IP out of the DHCP-scope, if it isn't possible to comply with one of these two I suggest you define a static IP on the server and exclude or reserve that IP in the DHCP-server for the server in question.

Using the Graphical User Interface
Defining a static IP using the GUI is pretty straight forward. First go to the Network and Sharing Center and select the Manage network connections. Finally right-click on the interface and select Properties.

Scroll down to the IPv4 and select Properties. When using a static IP select to option 'Use the following IP address' and provide the IP-address, subnet mask and Default gateway. You can also define the DNS server by selecting 'Use the following DNS server addresses' and insert one or more DNS server IP-addresses.

Enabling DHCP again for the IP address and DNS can be accomplished by selecting 'Obtain an IP address automaticly' and 'Obtain DNS server address automaticly'.

It is also possible to rename the interface by right clicking the interface and selecting Rename.

Using the CLI
The above can also be done by using the command line interface for example when running a Server Core version of Windows Server or just because you don't want to use the GUI.

First of is getting an overview of the interfaces that are available for IPv4, this can be done by running netsh interface ipv4 show interfaces. You'll get an overview of the current interfaces index, status, name, ... The second part is defining the static IP, this can be accomplished by running netsh interface ipv4 set address. The third command is setting the static DNS by running netsh interface set dns.

Select All Code:
1
2
3
netsh interface ipv4 show interfaces
netsh interface ipv4 set address name="interfacename" source=static address=IPADDRESS mask=SUBNETMASK gateway=GATEWAY
netsh interface ipv4 add dnsserver name="interfacename" address=DNSSERVER index=INDEX

Select All Code:
1
2
3
netsh interface ipv4 show interfaces
netsh interface ip set address name="interfacename" static ipaddress subnetmask gateway
netsh interface ip set dns "interfacename" static dnsserver

DHCP can be enabled for IP and DNS by using netsh as following.

Select All Code:
1
2
netsh interface ip set address "interfacename" dhcp
netsh interface ip set dns "interfacename" dhcp

It is also possible that you want to rename the interface name. This can be accomplished using the following command.

Select All Code:
1
netsh interface set interface name="interfacename" newname="newname"

Print Friendly
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.