In this tutorial, I will explain how to configure an IP address on a network card on a Windows server.
This operation is not complicated, but there are several solutions to achieve the same result that we will see in this tutorial.
Use sconfig to configure an IP address
sconfig for ServerConfig is a command line utility that allows you to configure a Windows server, it is available on core versions and with graphical interface.
From a CMD or PowerShell window enter the sconfig command and validate by pressing the Enter key.
As you can see from the screenshot below, sconfig allows to configure several server elements before a wizard.
It is possible that depending on the version of your Windows Server, the number of choices are different
To access the network configuration enter the number 8.
The list of network cards is displayed.
Enter the number of the card you wish to configure.
The network card settings appear, with a new option menu for editing the configuration.
To configure the IP address and default gateway, enter option number 1.
The first thing asked is the type of configuration, DHCP or Static IP, enter s for a static configuration.
I will not show you the steps one by one, the wizard will ask you to enter the IP address, the subnet mask and the default gateway, validate each entry by pressing the enter key on the keyboard.
Once the default gateway has been validated, the configuration is applied and you return to the network card configuration menu.
Now enter option 2 to configure DNS servers.
Enter the ip address of the primary server and validate with Enter.
Do the same for the auxiliary server.
You know how to configure an IP address with the sconfig utility.
Personally, this is the solution I prefer because it is the fastest.
Configure an IP address through the GUI
“Classic” solution, via the server’s graphical interface, it’s the same as for a desktop version of Windows (10/11).
The longest is to open the different windows to get to the list of network cards.
For this, there are several solutions, the fastest is to go through the server manager, from the Local server view, click on the configuration of one of the server cards.
Otherwise, you can go through the control panel -> Network and Sharing Center then click on Change card settings.
Through the graphical interface, it is possible to access the list of cards or the properties of the card by yet another path.
We finally arrive on the list of network cards, right-click on the card to configure and click on Properties 1.
In the items, select Internet Protocol Version 4 (TCP/IPv4) 1 and click the Properties button 2.
The IPv4 properties opens, modify the IP parameters according to your needs and click on OK to validate.
Use PowerShell to configure an IP address
It is also possible to use PowerShell to configure the IP address of a network card, I wrote a dedicated tutorial available here: PowerShell: configure an IP address
Use netsh to configure an IP address
Last solution that we will see in this tutorial is netsh, which is a command line utility.
To start, open a command prompt or PowerShell as an administrator.
The first step will be to list the network cards:
netsh interface ipv4 show config
We will work on the interface named Ethernet0
The first command that I will give you will allow you to configure the IP address, the subnet mask and the default gateway.
netsh interface ipv4 set address name="INTERFACE_NAME" static IP_ADR SUBNET_MASK GATEWAY
Which give :
netsh interface ipv4 set address name"Ethernet0" static 192.168.100.6 255.255.255.0 192.168.100.253
The order has no return if everything went well.
To configure Primary DNS:
netsh interface ipv4 set dns name="INTERFACE_NAME" static DNS_SERVER_IP
To configure Alternate DNS:
netsh interface ipv4 set dns name="INTERFACE_NAME" static DNS_SERVER_IP index=2
Which gives me for my network card:
netsh interface ipv4 set dns name="Ethernet0" static 126.96.36.199 netsh interface ipv4 set dns name="Ethernet0" static 188.8.131.52 index=2
For DNS configuration, there is another command syntax for versions from 2016.
netsh interface ipv4 add dnsserver name="INTERFACE_NAME" address=DNS_SERVER_IP index=1 netsh interface ipv4 add dnsserver name="INTERFACE_NAME" address=DNS_SERVER_IP index=2
Which give :
netsh interface ipv4 add dnsserver name="Ethernet0" address=184.108.40.206 index=1 netsh interface ipv4 add dnsserver name="Ethernet0" address=220.127.116.11 index=2
All you have to do is choose the solution that best suits you to configure the ip address of the network cards on your servers.