Information Technology Reference
In-Depth Information
> netsh routing ip nat add addressrange
"Local Area Connection #2" 10.10.10.1 10.10.10.254 255.255.255.0
Fourth, to add a port mapping to a specified interface, use this command:
> netsh routing ip nat add portmapping [InterfaceName=] <InterfaceName>
[proto=]{tcp | udp} [publicip=]{IPAddress | 0.0.0.0}
[publicport=] <Integer> [privateip=] <IPAddress> [privateport=] <Integer>
The command-line options are as follows:
InterfaceName : Required parameter whose value specifies the interface on which you want
to configure NAT. The value must match the name of the interface as it has been specified
in Network Connections. Put the value in quotation marks if there are spaces in the name.
Proto : Required parameter whose value specifies whether the mapping will use TCP or UDP.
PublicIP : Required parameter whose value specifies an external IP address on the public
network. Alternatively, you may use 0.0.0.0 to indicate any IP address that is not already
part of the private network.
PublicPort : Required parameter whose value specifies the public protocol port number.
The port number must be an integer ranging from 0 to 9999 .
PrivateIP : Required parameter whose value specifies an IP address within the private
address range.
PrivatePort : Required parameter whose value specifies the private protocol port number.
The port number must be an integer from 0 to 9999 .
For example, to map TCP port 80 on all public addresses to port 80 on an internal address
of 192.168.25.2 over the Local Area Connection #2 interface, use the following command:
> netsh routing ip nat add portmapping
"Local Area Connection #2" TCP 0.0.0.0 80 192.168.25.2 80
You can also delete interfaces from the command line. Use the following commands, each
of which is a counterpart to the commands previously described. The descriptions for the
parameters are identical to those previously presented.
To delete a NAT interface, use this command:
> netsh routing ip nat delete interface [InterfaceName=] <InterfaceName>
To delete an address mapping on a NAT interface, use this command:
> netsh routing ip nat delete addressmapping
[InterfaceName=] <InterfaceName> [[public=] <IPAddress> ]
If the public parameter is omitted, all mappings will be deleted from the interface.
To delete an address range from a NAT interface, use this command:
> netsh routing ip nat delete addressrange
[InterfaceName=] <InterfaceName> [start=] <IPAddress>
Search WWH ::




Custom Search