在Windows 8上使用命令行从静态IP设置为DHCP [英] Set from static IP to DHCP on Windows 8 using command line

查看:470
本文介绍了在Windows 8上使用命令行从静态IP设置为DHCP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的计算机是Windows 8. 我使用命令行来设置静态IP地址

My computer is Windows 8. I used command line to set static IP address by

netsh interface ipv4 set address name="Wired Ethernet Connection" source=static address=1.1.1.1 mask=1.1.1.1 gateway=1.1.1.1

和静态DNS通过

netsh interface ipv4 add dnsserver name="Wired Ethernet Connection" address=1.1.1.1 index=1

这两种情况下的1.1.1.1只是用于演示,而已由我的真实IP代替.

Where 1.1.1.1 in both cases is just for demonstration and was replaced by my real IP.

:从2018年开始,1.1.1.1现在已用作DNS服务器.

As of 2018, 1.1.1.1 is used as a DNS server now.

我现在想从静态IP更改为DHCP.

I want to change from static IP to DHCP now.

我尝试过

netsh interface ipv4 set address name="Wired Ethernet Connection" source=dhcp

用于IP和

netsh interface ipv4 set dnsservers name="Wired Ethernet Connection" source=dhcp

对于DNS.

但是,只有DNS命令有效.

However, only the command for DNS worked.

然后我与

ipconfig /all

它告诉我DHCP已启用以太网.但是,我以前的IP仍然在那里.

It told me that DHCP was on for Ethernet. However, my previous IP was still there.

有什么方法可以在命令行中将静态设置为DHCP吗?

Is there any way to set from static to DHCP in command line?

推荐答案

netsh interface ipv4 set address name="Wired Ethernet Connection" source=dhcp
ipconfig /renew Wired*

如果上述ipconfig /renew命令无济于事,请尝试

If above ipconfig /renew command does not help, try

netsh interface set interface name="Wired Ethernet Connection" admin=DISABLED
netsh interface ipv4 set address name="Wired Ethernet Connection" source=dhcp
netsh interface set interface name="Wired Ethernet Connection" admin=ENABLED

但是,也许从dhcp获得的所有addressmaskgateway都可以与以前由source=static定义的匹配.
ipconfig /ALL输出中是否显示Lease ObtainedLease Expires属性?

However, maybe all address, mask and gateway obtained from dhcp could match those defined by source=static previously.
Are there Lease Obtained and Lease Expires properties displayed in the ipconfig /ALL output?

这篇关于在Windows 8上使用命令行从静态IP设置为DHCP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆