常駐點在外的我,來回駐地公司常要重設IP,之前有個批次檔,後來都忘了怎麼設,以下為.bat的內容,只能說知其然不知其所以然:
netsh interface ip set address name="區域連線" static 10.1.0.58 255.255.255.0 10.1.0.254 1 #最後一個1老忘了加
netsh interface ip set dns 區域連線 static 168.95.192.1  # 慣用DNS
netsh interface ip add dns 區域連線 addr=10.1.8.2        # 其他DNS
#以下設定wins目前沒用到
netsh interface ip set wins "區域連線" static 172.22.253.2
netsh interface ip add wins "區域連線" 172.22.253.3 2
 
不過看DNS與WINS的設定邏輯,第一個用set:set (dns|wins) name static xxx.xxx.xxx.xxx
第二個要用add的方式,而且拿掉static:add (dns|wins) name xxx.xxx.xxx.xxx


2010/3/3補述: 參考http://lawpronotes.blogspot.com/2010/02/batch-file-bat-ip.html

使用DHCP方式如下:
netsh interface ip set address name="區域連線" source=dhcp
netsh interface ip set dns name="區域連線" source=dhcp
arrow
arrow
    全站熱搜

    Jemmy 發表在 痞客邦 留言(0) 人氣()