Fast IP address Switching

Source: Internet
Author: User
Tags configuration settings

 

 

Reposted on: Qian Xiaozhi IP address Quick Switch

 

 

The mobility of the current notebook is enhanced. We need to connect to the network in multiple environments and manually set the IP address, gateway, and other information each time without the vro automatically assigned, it is very cumbersome. In practice, the netsh command is used to quickly switch IP addresses.

A. Basic usage

1. Create a New notepad and write the following information:

Int IP
Set address name = "Local Connection" Source = static ADDR = 192.168.0.107 mask = 255.255.255.0
Set address name = "Local Connection" Gateway = 192.168.0.1 gwmetric = 1

Save as 218.sh. note that the suffix is sh. To explain, the above ADDR is the IP address, the mask is the subnet mask, the gateway is the gateway, and the gwmetric is the default gateway hop count.

2. Create a New notepad and write the following information:
netsh exec 218.sh


Save as a 218. bat batch file. This is easy to understand. It is to run a script file through the netsh command. When this batch is run, the 218. Sh file is called to modify the IP address and gateway.

Place the above files in any location on the hard disk, and then set up a shortcut pointing to 218.bat. this makes it easy to conveniently switch and control IP addresses.

B. application extension

In the above case, the IP address, mask, and gateway are changed. The usage of the sh file is different:
Int IP
Set address name = "Local Connection" Source = DHCP // automatically obtain the IP address
Set DNS name = "Local Connection" Source = DHCP // automatically retrieve DNS
Set DNS "Local Connection" static 192.168.0.1 primary // set the preferred DNS to 192.168.0.1
Set DNS "Local Connection" static NONE // clear the DNS list

In fact, the first example can be simply written as follows:
Set address "Local Connection" static 192.168.0.107 255.255.0 192.168.0.1 1

"Local Connection" is the name of the connection, 192.168.0.107 is the IP address to be set for ADDR, 255.255.255.0 is the mask subnet mask, 192.168.0.1 1 is the gateway, and 1 is the number of hops of the gwmetric default gateway.

C. Basic and extended usage of the netsh command

Netsh /?

The following commands are valid:

Commands in this context:
...-Move to the context level of the previous layer.
? -Display the command list.
Aaaa-changed to the 'netsh aaa' context.
Abort-discard the changes made in offline mode.
Add-Add a configuration project to the project list.
Alias-add an alias
Bridge-change to the 'netsh bridge 'context.
Bye-exit the program.
Commit-submit the changes made in offline mode.
Delete-delete a configuration item from the project list.
DHCP-changed to the 'netsh DHCP 'context.
Diag-changed to the 'netsh diag' context.
Dump-displays a configuration script.
Exec-run a script file.
Exit-exit the program.
Help-display the command list.
Interface-changed to the 'netsh interface' context.
IPsec-changed to the 'netsh IPSec 'context.
Offline-set the current mode to offline.
Online-set the current mode to a VM instance.
Popd-open a context from the stack.
Pushd-put the current context into the stack.
Quit-exit the program.
Ras-changed to the 'netsh Ras 'context.
Routing-changed to the 'netsh routing' context.
RPC-change to the 'netsh RPC 'context.
Set-Update Configuration Settings.
Show-display information.
Unalias-delete an alias.
Wins-changed to the 'netsh wins 'context.

The following sub-contexts are available:
Aaaa bridge DHCP diag interface IPSec Ras routing RPC wins

If you need more help information for the command, enter the command, followed by a space, followed ?.

Netsh>
--------------------

 

As can be seen from the above, in the netsh mode, you can also enter the lower-level operation mode:
Aaaa
|-The following commands are valid:
Commands inherit from the netsh context:
Show alias-list all defined aliases.
Show helper-list all top-level assistants.
Show mode: displays the current mode.

Commands in this context:
Show clients-dump AAAA client settings in script format.
Show config-dump AAAA configuration information in script format.
Show connection_request_policies-dump AAAA Connection Request Policy settings in script format.
Show logging-dump AAAA logging settings in script format.
Show remote_access_policies-dump AAAA remote access policy settings in script format.
Show server_settings-dump AAAA server settings in script format.
Show version-displays the version of an AAAA configuration database.

Bridge
|-The following commands are valid:
Commands inherit from the netsh context:
Show alias-list all defined aliases.
Show helper-list all top-level assistants.
Show mode: displays the current mode.

Commands in this context:
Show adapter-display the adapter configured as a single bridge.

DHCP
|-The following commands are valid:
List-list all available commands.
Help-displays help.
? -Display help.

Add Server-Add a server to the authorization server of the Directory Service.
Delete server-delete a DHCP server from the authorized server list in the directory service.
Show server-show all DHCP servers in the directory service for the current domain
Server $ [$ // servername/IPaddress $] $-switch the context to the specified server.
A null value indicates a local machine.

Diag
|-The following commands are valid:
Commands inherit from the netsh context:
Show alias-list all defined aliases.
Show helper-list all top-level assistants.
Show mode: displays the current mode.

Commands in this context:
Show adapter-show all adapters.
Show all-show all categories.
Show client-displays all network clients.
Show computer-displays the computer information.
Show DHCP-displays the DHCP servers for each adapter.
Show DNS-displays the DNS servers of each adapter.
Show gateway-displays the default gateway servers for each adapter.
Show ieproxy-display the server name and port number of Internet Explorer.
Show IP-the IP address of each adapter is displayed.
Show mail-display the email server name and port number.
Show modem-show all modem.
Show news-display the name and port number of the news server.
Show OS-displays operating system information.
Show test-show all categories and perform all tests.
Show version-windows and WMI versions are displayed.
Show wins-displays the preferred and secondary WINS servers for each adapter.

Interface
|-The following commands are valid:
Commands inherit from the netsh context:
Show alias-list all defined aliases.
Show helper-list all top-level assistants.
Show mode: displays the current mode.

Commands in this context:
Show credentials-displays the creden。 used to connect to the interface.
Show interface-display interface.

IPSec
|-The following commands are valid:
The following commands are valid:

Commands in this context:
Show alias-list all defined aliases.
Show helper-list all top-level assistants.
Show mode: displays the current mode.

Ras
|-The following commands are valid:
Commands inherit from the netsh context:
Show alias-list all defined aliases.
Show helper-list all top-level assistants.
Show mode: displays the current mode.

Commands in this context:
Show activeservers-listen to remote server access ads.
Show authmode-display the Authentication mode.
Show authtype-displays the currently enabled authentication types.
Show client-displays the remote access client that is connected to this computer.
Show Link-display the link properties to be negotiated by PPP
Show Multilink-displays multiple links to be negotiated by PPP
Show registeredserver-displays whether the computer is registered in the specified domain
The remote access server in Active Directory.
Show user-displays the Remote Access attribute for the user.

Routing
|-The following commands are valid:
Commands in this context:
Show alias-list all defined aliases.
Show helper-list all top-level assistants.
Show mode: displays the current mode.

RPC
|-The following commands are valid:
Commands in this context:
? -Display the command list.
Add-create the "add" List of subnets.
Delete-create a "delete" List of subnets.
Dump-displays a configuration script.
Help-display the command list.
Reset-reset the selection binding settings to 'None' (listen to all interfaces ).
Show-the binding status of each subnet is displayed on the system.

Wins
|-The following commands are valid:
Commands in this context:
Show alias-list all defined aliases.
Show helper-list all top-level assistants.
Show mode: displays the current mode.

The powerful netsh command is not discussed here. If you are interested, you can press the netsh key in cmd mode to enter the netsh mode. To remind you, use the netsh command back to your superiors. or .., use bye or exit to exit netsh mode.

Demo file:Click here to download

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.