windows换IP的脚本_bat格式
写的换IP脚本
08上运行出现RPC未启用?
03,xp等系统正常
只惜没时间检查
尸体留在此处 等日后解
旧.bat
@echo off
rem -------------------------旧机器的参数设置---------------------
rem 临时外网IP
set tmp_wlan_ip=*.*.109.23
set tmp_wlan_mask=255.255.255.240
rem 临时内网IP
set tmp_llan_ip=192.168.7.23
set tmp_llan_mask=255.255.255.0
rem 本地原外网IP
set old_wlan_ip=*.*.109.198
set old_wlan_mask=255.255.255.240
rem 本地原内网IP
set old_llan_ip=192.168.7.178
set old_llan_mask=255.255.255.0
rem 外网默认网关
set wan_gateway=*.*.109.1
echo -------------------------1-旧机器添加临时IP---------------
netsh interface ip add address wan static addr=%tmp_wlan_ip% mask=%tmp_wlan_mask%
netsh interface ip add address local static addr=%tmp_llan_ip% mask=%tmp_llan_mask%
ipconfig /renew
echo "添加临时IP完成"
echo "停掉像转移后 回到这里 按任意键继续 "
@pause
echo -------------------------2-旧机器删除原IP-----------------------
netsh interface ip delete address wan addr=%old_wlan_ip% gateway=all
netsh interface ip delete address local addr=%old_llan_ip% gateway=all
netsh interface ip set address wanl static addr=%tmp_wlan_ip% mask=%tmp_wlan_mask% gateway=%wan_gateway% 1
ipconfig /renew
echo "本机原有IP已删除,本机操作完成,请转新服务器运行脚本"
@pause
新.bat
@echo off
rem --------------------------新机器的参数设置------------------------
rem 原外网IP
set old_wlan_ip=*.*.109.23
set old_wlan_mask=255.255.255.240
rem 原内网IP
set old_llan_ip=192.168.7.23
set old_llan_mask=255.255.255.0
rem 新外网IP
set new_wlan_ip=*.*.109.198
set new_wlan_mask=255.255.255.240
rem 新内网IP
set new_llan_ip=192.168.7.178
set new_llan_mask=255.255.255.0
rem 外网默认网关
set wan_gateway=*.*.109.1
echo -------------------------3-新机器添加内网IP------------------------
netsh interface ip set address local static addr=%new_llan_ip% mask=%new_llan_mask%
netsh interface ip add address local static addr=%old_llan_ip% mask=%old_llan_mask%
ipconfig /renew
echo "添加本地IP完成"
echo "ping 这两个内网IP看是否连通 如果成功 mstsc连到内网IP"
echo "按任意键进入下一步(改外网ip)"
@pause
echo ------------------------4-新机器更改外网IP------------------------
netsh interface ip set address wan static addr=%new_wlan_ip% mask=%new_wlan_mask% gateway=%wan_gateway% 1
ipconfig /renew
echo "新机器更改外网IP(这句话应该看不到)"
@pause