netsh切换ip批处理文件

本文详细介绍了如何使用Netsh命令行工具来更改网络设置,包括设置静态IP地址、子网掩码、默认网关、DNS服务器以及WINS服务器。同时也提供了如何将网络属性设置为从DHCP服务器获取IP地址的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 转载自:https://helpdeskgeek.com/networking/change-ip-address-and-dns-servers-using-the-command-prompt/

interface ip set address name="Local Area Connection" static 192.168.10.42 255.255.255.0 192.168.1.1

As you can see, when you use Netsh you need to specify what network properties you need to change. In the example above, we changed the network properties for “Local Area Connection” to use a static IP address of 192.168.10.42, a subnet mask of 255.255.255.0 and a default gateway of 192.168.1.1.

Changing the DNS IP address is almost identical to the procedure above. Type the following command on the Netsh prompt:

interface ip set dns "Local Area Connection" static 192.168.1.1

To setup WINS, type the following command:

interface ip set wins "Local Area Connection" static 192.168.1.1

To set the network properties to obtain the IP address from a DHCP server, type the following command:

interface ip set address "Local Area Connection" dhcp

To set DNS to obtain IP address automatically type the following:

netsh interface ip set dns "Local Area Connection" dhcp
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值