经常往返于实验室的同学一定常会遇到一个问题:
宿舍的路由器一般是自动获取IP,
但是实验室里面一般是静态IP。
每次往返,每天就要修改,很麻烦。
这里提供了一个简便方法: (该方法为Win7下的,XP下的见最后一行)
第一步 : 新建一个txt文件
第二步: 在文件中添加如下内容:
netsh
interface
ip
set
address name=
"
本地连接
"
source=
static
addr=
10.60
.
37.99
mask=
255.255
.
255
.0gateway=
10.60
.
37.254
netsh
interface
ip
set
dns
"
本地连接
"
source=
static
addr=
202.120
.
190.208
4个红色的部分需要我们根据需要修改:
10.60.37.99 是IP地址
255.255.255.0 是掩码地址
10.60.37.254 是默认网关
202.120.190.208 是DNS
第三步: 将txt文件的后缀由 .txt 改为 .cmd
第四步: 右键点击.cmd文件,选择“以管理员身份运行”
大功告成!
PS:
如果回到寝室,想改回自动获取IP和DNS,
只需创建一个新的cmd文件,内容为:
netsh
interface
ip
set
address name=
"
本地连接
"
source=
dhcp
netsh
interface
ip
set
dns name=
"
本地连接
"
source=dhcp
XP中的指令稍有不同:
netsh
interface
ip
set
address name=
"
本地连接
"
source=
static
addr=
10.60
.
37.96
mask=
255.255
.
255.0
netsh
interface
ip
set
address name=
"
本地连接
"
gateway=
10.60
.
37.254
gwmetric=
0
netsh
interface
ip
set
dns
"
本地连接
"
source=
static
addr=
202.120
.
190.208

