本文介绍了在Windows XP上通过命令行更改IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码通过cmd.exe更改计算机IP地址:

I'm trying to change a machine IP address via cmd.exe with this code:

netsh int ip set address name="Local Area Connection" source=static addr=???.???.???.??? mask=255.255.255.0

IP不变的问题(由<$ c $检查) c> ipconfig )但在DHCP上没有改变。因此,当我重新启动机器时,IP将返回到DHCP。

The problem that the IP doesn't change (checked by ipconfig) but doesn't not changed on the DHCP. Thus when I restart the machine, the IP is returned to DHCP.

我需要一种通过命令行永久更改IP的方法。

I need a way to change the IP permanently via command line.

任何想法?

推荐答案

您可以使用以下命令:

netsh interface ip set address name="Local Area Connection" static 192.168.0.100 255.255.255.0 192.168.0.1 1

其中


  • 192.168。 0.100 是IP地址

  • 网络掩码是 255.255.255.0

  • 并且网关 192.168.0.1

  • the 192.168.0.100 is the IP address
  • the netmask is 255.255.255.0
  • and the gateway is 192.168.0.1

您还可以拥有DHCP使用以下命令自动配置DNS:

You can also have the DNS configured automatically by DHCP using following command:

netsh interface ip set dns "Local Area Connection" dhcp

这篇关于在Windows XP上通过命令行更改IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 19:40