开始在台里办公之后,由于台里的网络采用静态ip,而寝室里的网络是dhcp,我因此感到很不方便:每次从台里回寝室或者从寝室到台里都要重新设置网络连接。故而从网上找到了网络连接的命令行配置方法,并写成bat文件。在这里就记录一下这个小技巧。
设置静态ip:
netsh interface ip set address "net_name" static your.static.ip.address sub.net.ma.sk ga.te.wa.y
netsh interface ip set dns "net_name" static primary.d.n.s primary
netsh interface ip add dns "net_name" spare.d.n.s
其中 net_name 项填入要设置的网络名称,就是在控制面板——网络和共享中心——更改适配器设置中看到的那个,比如“以太网”。
如果要切换回dhcp,就使用:
netsh interface ip set address name="net_name" source=dhcp
netsh interface ip set dns name="net.name" source=dhcp
这就是这次的笔记(小技巧)。
Comments NOTHING