Quickly change IP configuration with netsh

If the computer on a network is not configured to receive IP addresses dynamically from a DHCP server, the IP address has to be changed manually. A netsh configuration file can help change the IP address with minimum manual intervention. Netsh allows users to change the TCP/IP parameters from the command line. With the change in the environmental settings in the computer, netsh can configure the files to change the TCP/IP settings of the new environment automatically. This can reduce the time and effort spent inputting the entire network configuration of the computer. Changing the IP address configuration with netsh is quick and easy.

Sometimes it happens that your status is not systematically set as DHCP client, depending on the environment in which it operates. It becomes cumbersome to constantly change the TCP/IP parameters. Consider a simple example:

Environment 1: Office. The parameters are:

IP Address: 10.21.45.87 / 16

Gateway: 10.21.47.100

DNS: 10.21.48.127

WINS: 10.21.48.128

Environment 2: Main Client at which it moves 2 to 3 times per week.

IP Address: 192.168.27.101 / 24

Gateway: 192.168.27.100

DNS: 192.168.27.100

Environment 3: Home: DHCP client

We can note that changing environment is not an easy task. Fortunately, there is a feature of Windows that will simplify our task.

As you already know, netsh allows you to change most TCP/IP parameters via the command line.

So we will simply configure the environments that are mostly used.

Start with the "office" environment in the example above. We will of course enter the settings, step by step. When the NIC is configured, open a command prompt and simply type:

netsh -c interface dump >officet

This is the first step: you just created a netsh configuration file.

For the client configuration, the procedure is the same:

Configure the network card with the correct parameters

Open a command prompt

netsh -c interface dump >client

And finally, the home setup:

Configure the DHCP client card

Open a command prompt

taper netsh -c interface dump >homet

How to move from one configuration to another? Just call the corresponding configuration file:

Office:

Open a command prompt

Type netsh -f officet

Client:

Open a command prompt

Type netsh -f client

Home:

Open a command prompt

Type netsh -f homet

The benefits:

Spread the love

Leave a Comment