共用方式為


Netsh Commands for Interface (IPv4 and IPv6)

Applies To: Windows Server 2008

You can use commands in the Netsh Interface context and subcontexts to configure the TCP/IP version 4 protocol (including addresses, default gateways, Domain Name System (DNS) and WINS servers) and to display configuration and statistical information for IPv4.

In addition, you can use commands in this context and related subcontexts (6to4, isatap, portproxy, and teredo) to configure Internet Protocol version 6 (IPv6).

The netsh interface context contains the following commands:

  • add

  • delete

  • reset

  • set credentials

  • set interface

  • show credentials

  • show interface

To run these commands from the command prompt, you must either enter the netsh interface context or prepend the context to the command. For example, if you are at the command prompt but have not typed netsh and then interface to enter the netsh interface context, you must type:

netsh interfacecommand

Where command is the command that you want to run, including all of the required parameters for the command.

The Netsh Interface context also includes several subcontexts.

Subcontexts of Netsh Interface

This context provides the following subcontexts:

Subcontext name Result

6to4

Changes to the netsh interface 6to4 context.

HTTPSTunnel

netsh interface HTTPSTunnel

ipv4

Changes to the netsh interface ipv4 context.

ipv6

Changes to the netsh interface ipv6 context.

isatap

Changes to the netsh interface isatap context.

portproxy

Changes to the netsh interface portproxy context.

tcp

Changes to the netsh interface tcp context.

teredo

Changes to the netsh interface teredo context.

Formatting legend

For information on how to interpret netsh command syntax, see Formatting Legend.

Netsh Interface command reference

Following are the details for the commands in the Netsh Interface context.

add

Adds an interface to the router. For full interfaces, a phone book entry with the same name must already exist on the system.

Syntax

add [name=] Name [[type=]full]

Parameters

  • name
    Required. Specifies the name of the interface to be added.
  • type
    Optional. Specifies that a demand dial interface is created when full is designated.

Examples

Following is an example of the add interface command that creates a demand dial interface.

add name="Demand-Dial Interface" type=full

delete

Deletes an interface from the router.

Syntax

delete [ name= ] Name

Parameters

  • name
    Required. Specifies the name of the interface to be deleted.

Examples:

The following example command deletes a demand dial interface at the router

delete name="Demand-Dial Interface"

reset

Deletes all of the interfaces that can be added through this context.

Syntax

reset

set credentials

Specifies the credentials that are used to connect to or add an interface.

Syntax

set credentials [ name= ] InterfaceName [ user= ]UserName [[ domain= ] Domain [password=] Password ]

Parameters

  • InterfaceName
    Required. Specifies the name of the interface that you want to add.
  • UserName
    Required. Specifies the user account name that has the required permissions to add an interface.
  • Domain
    Optional. Specifies the domain where the user account is located.
  • Password
    Optional. Specifies the password of the user account.

Examples

Following are two examples of the set credentials command.

set credentials name="Demand-Dial Interface" user=guest

set credentials name="Demand-Dial Interface" user=admin domain=mydomain password=mypassword

set interface

Changes the parameters for an existing interface.

Syntax

set interface [name = ] IfName [ [admin = ] ENABLED|DISABLED [connect = ] CONNECTED|DISCONNECTED [newname = ] NewName ]

Parameters

  • IfName
    Required. Specifies the name of the interface that you want to modify.
  • admin
    Optional. Specifies whether the interface should be enabled or disabled.
  • connect
    Optional. Specifies whether or not to enable and connect the interface (non-LAN only).
  • newname
    Optional. Specifies a new name for the interface (LAN only).

Remarks

  • At least one option other than the name must be specified.

  • If you specify that the value for connect equals CONNECTED, then the interface is automatically enabled even if you also specify that the value for admin equals DISABLED.

show credentials

Displays the credentials that are used to connect to an interface.

Syntax

show credentials [name = ] IfName

Parameters

  • IfName
    Required. Specifies the name of the interface whose credentials you want to display.

show interface

Displays a list of the configured interfaces, including their current Name, Admin State, State, and Type.

Syntax

show interface [[name=] Name]

Parameters

  • Name
    Optional. Specifies the name of the interface that you want to display. If Name is not specified, all interfaces are displayed.

Examples

Following is an example of the show interface command.

show interface name="Local Area Connection"

See Also

Concepts

Netsh commands for Interface 6to4
Netsh commands for Interface HTTPSTunnel
Netsh commands for Interface Internet Protocol version 4 (IPv4)
Netsh commands for Interface Internet Protocol version 6 (IPv6)
Netsh commands for Interface ISATAP
Netsh commands for Interface Portproxy
Netsh commands for Interface Transmission Control Protocol
Netsh commands for Interface Teredo