使用批处理命令设置windows系统的ip地址和dns

找到对应的网卡名称


使用命令: ipconfig
ipconfig/all

Windows IP Configuration

        Host Name . . . . . . . . . . . . : D501-4-3
        Primary Dns Suffix  . . . . . . . :
        Node Type . . . . . . . . . . . . : Unknown
        IP Routing Enabled. . . . . . . . : No
        WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter 本地连接:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : Marvell Yukon 88E8057 PCI-E Gigabit
Ethernet Controller
        Physical Address. . . . . . . . . : 44-37-E6-1D-5B-F1
        Dhcp Enabled. . . . . . . . . . . : No
        IP Address. . . . . . . . . . . . : 192.168.1.111
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 192.168.1.1
        DNS Servers . . . . . . . . . . . : 8.8.8.8




我们现在需要设置的网卡名称为"本地连接",ip地址为192.168.1.111,子网掩码为255.255.255.0,dns地址为8.8.8.8

将ip和dns设置为自动获取


使用命令:
netsh interface ip set address "本地连接" dhcp
netsh interface ip set dns "本地连接" dhcp

netsh interface ip set address "本地连接" dhcp
确定。

netsh interface ip set dns "本地连接" dhcp
确定。

相当于操作:


将ip和dns设置为固定的值


使用命令:
netsh interface ip set address "本地连接" static [ip地址] [子网掩码] [网关] [网关跳远点数:一般填1]
netsh interface ip set dns "本地连接" static [dns地址]
netsh interface ip set address "本地连接" static 192.168.1.111 255.255.255.0 192
.168.1.1 1
确定。

netsh interface ip set dns "本地连接" static 8.8.8.8
确定。

相当于操作:


转载于:https://www.cnblogs.com/zhezh/p/3773280.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值