windows下,用命令行进行系统的TCP/IP设置
来源:互联网 发布:php安装教程详解 编辑:程序博客网 时间:2024/04/28 15:26
In order to configure TCP/IP settings such as the IP address, Subnet Mask, Default Gateway, DNS and WINS addresses and many other options you can use Netsh.exe.
Netsh.exe is a command-line scripting utility that allows you to, either locally or remotely, display or modify the network configuration of a computer that is currently running. Netsh.exe also provides a scripting feature that allows you to run a group of commands in batch mode against a specified computer. Netsh.exe can also save a configuration script in a text file for archival purposes or to help you configure other servers.
Netsh.exe is available on Windows 2000, Windows XP and Windows Server 2003.
You can use the Netsh.exe tool to perform the following tasks:
- Configure interfaces
- Configure routing protocols
- Configure filters
- Configure routes
- Configure remote access behavior for Windows-based remote access routers that are running the Routing and Remote Access Server (RRAS) Service
- Display the configuration of a currently running router on any computer
- Use the scripting feature to run a collection of commands in batch mode against a specified router.
What can we do with Netsh.exe?
With Netsh.exe you can easily view your TCP/IP settings. Type the following command in a Command Prompt window (CMD.EXE):
With Netsh.exe, you can easily configure your computer's IP address and other TCP/IP related settings. For example:
The following command configures the interface named Local Area Connection with the static IP address 192.168.0.100, the subnet mask of 255.255.255.0, and a default gateway of 192.168.0.1:
(The above line is one long line, copy paste it as one line)
Netsh.exe can be also useful in certain scenarios such as when you have a portable computer that needs to be relocated between 2 or more office locations, while still maintaining a specific and static IP address configuration. With Netsh.exe, you can easily save and restore the appropriate network configuration.
First, connect your portable computer to location #1, and then manually configure the required settings (such as the IP address, Subnet Mask, Default Gateway, DNS and WINS addresses).
Now, you need to export your current IP settings to a text file. Use the following command:
When you reach location #2, do the same thing, only keep the new settings to a different file:
You can go on with any other location you may need, but we'll keep it simple and only use 2 examples.
Now, whenever you need to quickly import your IP settings and change them between location #1 and location #2, just enter the following command in a Command Prompt window (CMD.EXE):
or
and so on.
You can also use the global EXEC switch instead of -F:
Netsh.exe can also be used to configure your NIC to automatically obtain an IP address from a DHCP server:
Would you like to configure DNS and WINS addresses from the Command Prompt? You can. See this example for DNS:
and this one for WINS:
Or, if you want, you can configure your NIC to dynamically obtain it's DNS settings:
As you now see, Netsh.exe has many features you might find useful, and that goes beyond saying even without looking into the other valuable options that exist in the command.
- windows下,用命令行进行系统的TCP/IP设置
- windows下,用命令行进行系统的TCP/IP设置
- windows下,用命令行进行系统的TCP/IP设置
- Windows下用命令行修改IP详解,附批处理文件
- windows系统用命令行netsh修改网络连接的ip、网关、dns
- 在windows下用命令设置代理服务器
- Windows下用命令行修改IP地址的方法详解(附批处理文件)
- Windows系统下用命令行安装及卸载服务
- 用命令行netsh修改windows的ip、网关、dns
- 用命令行netsh修该windows的网关,ip
- 用命令行netsh修改windows的ip、网关、dns
- 用命令行方式进行WIndows的网络设置
- windows下用命令行导入数据库
- linux系统下,如何用命令获取公网IP
- MySql安装成功后用命令行进行必要的配置
- 用命令或批处理命令一次删除windows系统一个目录下的所有文件
- Windows系统下用命令行编译C/C++程序过程总结
- Windows系统下用命令行编译C/C++程序过程总结
- Java 设计模式
- 在 ASP.NET 中执行 URL 重写
- IIS 状态代码
- NMS SIP的一些工程注意事项
- 数据库的连接串(中文zz)
- windows下,用命令行进行系统的TCP/IP设置
- Think in java读书笔记
- How to use "vi" edit the docs or source code files
- 男人,应该这样做!!
- 如果公务员跟普通公民没有差别.
- IIS 状态代码
- Tomcat中文手册
- Memory space manipulating in Java(Section one:Basic Concepts in Java)
- 制作bat文件的方法