昨天公司1段的网络不稳定,于是我们换成了0段的网关;

今天公司0段的网络又不稳定了,于是我们又换成了1段的网关;

如此换来换去,打开网络连接修改ip地址实在麻烦,就写了个批处理命令来修改IP地址。

修改为0段网关的命令:

netsh interface ip reset "本地连接"
netsh interface ip add address "本地连接" 192.168.0.10 255.255.255.0
netsh interface ip add address "本地连接" gateway=192.168.0.5 gwmetric=1
netsh interface ip set dns "本地连接" static 192.168.0.8 primary

修改为1段网关的命令:

netsh interface ip reset "本地连接"
netsh interface ip add address "本地连接" 192.168.1.10 255.255.255.0
netsh interface ip add address "本地连接" gateway=192.168.1.1 gwmetric=1
netsh interface ip set dns "本地连接" static 192.168.1.1 primary

posted on 2011-03-01 13:00  小伟地方  阅读(1990)  评论(0编辑  收藏  举报