Professional Windows Server 1002003 Security A Technical Reference [Electronic resources]

Roberta Bragg

نسخه متنی -صفحه : 415/ 351
نمايش فراداده

netsh/Interface Context

Configures router interfaces for Routing and Remote Access Service.

Subcontexts

IP

Commands

add interface name=iname type=[tunnel | full]

Adds an interface to the router, specifying its name (iname) and type (tunnel for VPN interfaces and full for demand-dial interfaces). The name of the interface must be in quotes if it contains spaces.

delete interface name=iname

Removes the specified interface.

dump

Dumps the configuration of the interfaces for the Routing and Remote Access Service as a series of NetShell commands.

ip

Switches to the IP subcontext to further configure IP interfaces on the router. The commands available in this subcontext are listed in Table 5-11.

reset all

Resets the router configuration by deleting all interfaces.

set credentials name=iname user=username domain=domainname password=password

Specifies the credentials needed to connect to an interface.

set interface name=iname admin=[enabled | disabled] connect=[connected | disconnected] [newname=newiname]

Sets the current state of the WAN interface called iname to either enabled or disabled. If connected is specified, the interface is automatically enabled. newiname is used only for renaming the default LAN interface.

show credentials name=iname

Displays the credentials needed to connect to each interface.

show interface [name=iname]

Displays the name, type, and current state of each interface on the router. If no name is specified, all interfaces are displayed.

Table 5-11. Commands available in Interface IP subcontext

Command

Option

Description

add

address

Adds IP address

dns

Adds static DNS server address

wins

Adds static WINS server address

delete

address

Deletes IP address or default gateway

arpcache

Flushes ARP cache

dns

Removes DNS settings

wins

Removes WINS settings

dump

Dumps configuration as netsh commands

set

address

Specifies IP address or default gateway

dns

Specifies DNS server mode and addresses

wins

Specifies WINS server mode and addresses

show

address

Lists all addresses

config

Lists IP addresses and configuration settings

dns

Lists addresses of DNS servers

icmp

Displays ICMP statistics

interface

Displays interface statistics

ipaddress

Lists IP addresses

ipnet

Lists net-to-media mappings

ipstats

Displays statistics for IP addresses

joins

Lists joined multicast groups

offload

Lists offload information

tcpconn

Lists TCP connections

tcpstats

Displays TCP statistics

udpconn

Lists UDP connections

udpstats

Displays UDP statistics

wins

Lists addresses of WINS servers

Examples

Display interfaces on router:

C:\>netsh
netsh>interface
interface>show interface
Admin State    State       Type          Interface Name
------------------------------------------------------
Enabled      Connected    Loopback       Loopback
Enabled      Connected    Internal       Internal
Enabled      Connected    Dedicated      Local Area Connection

Switch to IP subcontext and view details of interfaces:

interface>ip
interface ip>show interface
MIB-II Interface Information
------------------------------------------------------
Index:                              1
User-friendly Name:                 Loopback
GUID Name:                          Loopback
Type:                               Loopback
MTU:                                32768
Speed:                              10000000
Physical Address:
Admin Status:                       Up
Operational Status:                 Operational
Last Change:                        0
In Octets:                          0
In Unicast Packets:                 0
In Non-unicast Packets:             0
In Packets Discarded:               0
In Erroneous Packets:               0
In Unknown Protocol Packets:        0
Out Octets:                         0
Out Unicast Packets:                0
Out Non-unicast Packets:            0
Out Packets Discarded:              0
Out Erroneous Packets:              0
Output Queue Length:                0
Description:                        Internal loopback interface for   
127.0.0 network
Index:                              2
User-friendly Name:                 Local Area Connection
GUID Name:                         {54414D01-02DA-4783-B931-C9AC7A70EDDD}
Type:                               Ethernet
MTU:                                1500
Speed:                              10000000
Physical Address:                   00-00-B4-A0-47-74
Admin Status:                       Up
Operational Status:                 Operational
Last Change:                        0
In Octets:                          4722820
In Unicast Packets:                 16263
In Non-unicast Packets:             6698
In Packets Discarded:               0
In Erroneous Packets:               0
In Unknown Protocol Packets:        8151
Out Octets:                         2970151
Out Unicast Packets:                21769
Out Non-unicast Packets:            3745
Out Packets Discarded:              0
Out Erroneous Packets:              0
Output Queue Length:                0
Description:                        Realtek RTL8029(AS) Ethernet Adapt 
(Microsoft's Packet Scheduler)

Display IP address info for "Local Area Connection" interface:

interface ip>show address "Local Area Connection"
Configuration for interface "Local Area Connection"
DHCP enabled:                         No
IP Address:                       172.16.11.104
SubnetMask:                       255.255.255.0
Default Gateway:                  172.16.11.196
GatewayMetric:                        1
InterfaceMetric:                      1

Before adding a second IP address for this interface, first check the syntax for the add address command:

interface ip>add address ? 
Usage: add address [name=]string  [[addr=]IP address 
[mask=]IP subnet mask][[gateway=]IP address 
[gwmetric=]integer]
Parameters:
name         - The name of the IP interface.
addr         - The IP address to be added for 
the interface.
mask         - The IP subnet mask for the 
specified IP address.
gateway      - The default gateway for the 
specified IP address.
gwmetric     - The metric to the default 
gateway.
Remarks: Adds IP addresses and default gateways to an interface configured 
with static IP addresses.
Examples:
add address "Local Area Connection" 10.0.0.2 255.0.0.0
add address "Local Area Connection" gateway=10.0.0.3 
gwmetric=2
The first command adds a static IP address of 10.0.0.2 with a subnet mask of 
255.0.0.0 to the Local Area Connection interface. The second command adds 
the IP address of 10.0.0.3 as a second default gateway for this interface 
with a gateway metric of 2.

Add a second IP address 172.16.11.105 for this interface:

interface ip>add address "Local Area Connection" 172.16.11.105 255.255.255.0
Ok.

Verify the result:

interface ip>show address "Local Area Connection"
Configuration for interface "Local Area Connection"
DHCP enabled:                         No
IP Address:                       172.16.11.104
SubnetMask:                       255.255.255.0
IP Address:                       172.16.11.105
SubnetMask:                       255.255.255.0
Default Gateway:                  172.16.11.196
GatewayMetric:                        1
InterfaceMetric:                      1
interface ip>

You can also verify that the address was successfully added by accessing the TCP/IP properties sheet for this interface in the GUI:

Right-click on My Network Places Properties right-click on Local-Area Connection Properties select Internet Protocol (TCP/IP) Properties Advanced

See Also

Connections, Routing and Remote Access