Chinaunix首页 | 论坛 | 博客
  • 博客访问: 988654
  • 博文数量: 102
  • 博客积分: 10120
  • 博客等级: 上将
  • 技术积分: 2754
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-13 23:00
文章分类

全部博文(102)

文章存档

2011年(6)

2010年(55)

2009年(16)

2008年(25)

分类: WINDOWS

2008-07-01 13:48:51

Here are two scripts, which function as switching network configuration under windows. The first one will configure network interface by dhcp; while the other one will configure network interface statically. They both are run by netsh. The command line looks like: netsh exec net-switch-dhcp.sh.

net-switch-dhcp.sh
==============================
# net-switch-dhcp.sh
# configure network interface by dhcp
# ----------------------------------
# 接口 IP 配置
# ----------------------------------
pushd interface ip


# "本地连接" 的接口 IP  配置

set address name="本地连接" source=dhcp
set dns name="本地连接" source=dhcp register=PRIMARY
set wins name="本地连接" source=dhcp


popd
# 接口 IP 配置结束
==============================


then, net-switch-static.sh
==============================
# net-switch-static.sh
# configure network interface statically
# ----------------------------------
# 接口 IP 配置
# ----------------------------------
pushd interface ip


# "本地连接" 的接口 IP  配置

set address name="本地连接" source=static addr=192.168.1.84 mask=255.255.255.0 gateway=192.168.1.50 gwmetric=1
set dns name="本地连接" source=static addr=192.168.1.50 register=PRIMARY
set wins name="本地连接" source=dhcp


popd
# 接口 IP 配置结束

==============================

That's all.
阅读(1303) | 评论(0) | 转发(0) |
0

上一篇:灾区亲历(3)

下一篇:灾区亲历(4)

给主人留下些什么吧!~~