IT tutorials
 
Technology
 

Windows Server 2008 : Configuring IPv4 with netsh

8/26/2013 11:43:40 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

The basic syntax is

netsh interface ipv4 set address name = ""
static IP-address subnet-mask default-gateway

For example, you can use the following command to configure the NIC named “Local Area Connection” with an IP address of 192.168.1.15, a subnet mask of 255.255.255.0, and a default gateway of 192.168.1.1.

netsh interface ipv4 set address name = "local area connection"
static 192.168.1.15 255.255.255.0 192.168.1.1

Note

The default name of the first NIC is Local Area Connection on Windows systems. Because the NIC’s name (Local Area Connection) has spaces within it, it must be enclosed in quotes.


Some other commands you can use to configure the NIC are shown in the following table.

CommandDescription
Get TCP/IP information from DHCP.
netsh interface ipv4
set address [name=]
"NIC-name" [source=]
dhcp
C:\>netsh interface
ipv4 set address name =
"local area connection"
source = dhcp

Changes the NIC so that it gets TCP/IP configuration automatically from DHCP.
Get DNS from DHCP.
netsh interface ipv4
set dnsserver [name=]
"NIC-name " [source=]
dhcp
C:\> netsh interface
ipv4 set dnsserver
"local area connection"
dhcp

Changes the NIC to get the DNS address automatically from DHCP.
Set IP address of preferred DNS server with set.
netsh interface ipv4 set
dnsserver [name=]"NIC-
name" [source=]static
[address=] Preferred-
DNS-IP-Address
C:\>netsh interface
ipv4 set dnsserver
name="local area
connection"
source=static
192.168.1.5

Sets the IP address of the preferred DNS server.

Note

This command removes all other DNS Server IP addresses, if any are configured.

Set IP address of preferred DNS server with add.
netsh interface
ipv4 add dnsserver [name=]"NIC-name
"
[address=] Preferred-
DNS-IP-Address index=1
C:\>netsh interface
ipv4 add dnsserver
name="local area
connection" 192.168.1.6
index=1

Note

The add command has slightly different syntax than the set command. For example, you cannot use the indexset command. clause with the

This command adds the address of a DNS server and sets it as the preferred DNS server (with an index of 1). If other DNS servers are in the list, they are moved down the list.

Note

You cannot use this command to modify the order of existing DNS server addresses. If you use an IP address of a DNS server already in the list, the command fails. However, you can use the set command to set one DNS server address, and then use the add command to add additional DNS server addresses with the index clause to specify the order.

Figure1 shows the result of this command in combination with the previous add command. The setadd command with an index of 1 is set 192.168.1.6 as the preferred DNS server, and bumped 19.168.1.6 to the alternate.
Set alternate DNS server.
netsh interface
ipv4 add dnsserver [name=]"NIC-name"
[address=] Preferred-
DNS-IP-Address index=2
C:\>netsh interface
ipv4 add dnsserver
name="local area
connection" 192.168.1.7
index=2

This command adds 192.168.1.7 as the alternate. If another server was designated as the alternate, it will be moved down one in the list.

Tip

You can add DNS servers with different indexes.


Tip

If you want to identify the names of the IPv4 interfaces on the system, you can use the following command:

netsh interface ipv4 show interfaces


Figure 1. Configuring DNS server addresses
 
Others
 
- Windows Server 2008 : Understanding netsh, Understanding netsh Contexts
- Windows 7 : Faxing and Scanning - Setting Up Your Cover Sheets
- Windows 7 : Faxing and Scanning - Defining Dialing Rules
- Windows 7 : What You Need for Fax - Configuring fax modem options
- Windows 7 : Troubleshooting Printing - Problem with a network printer, Advanced printing features are disabled
- Windows Server 2012 : Monitoring System Performance - Monitoring the Network Subsystem
- Windows Server 2012 : Monitoring System Performance - Analyzing Processor Usage, Evaluating the Disk Subsystem
- Windows Server 2012 : Monitoring System Performance - Monitoring System Memory and Pagefile Usage
- Active Directory 2008 : Managing Group Policy Scope (part 4) - Group Policy Processing, Loopback Policy Processing
- Active Directory 2008 : Managing Group Policy Scope (part 3) - WMI Filters, Enabling or Disabling GPOs and GPO Nodes
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us