日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

切换网络配置之脚本法

發(fā)布時(shí)間:2024/6/3 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 切换网络配置之脚本法 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

切換網(wǎng)絡(luò)配置之腳本法

由于現(xiàn)在移動設(shè)備的普遍使用等情況,需要經(jīng)常改變網(wǎng)絡(luò)配置,如:IP地址等。還有就象我們單位,因?yàn)樯暇W(wǎng)的限制而出現(xiàn)的“搶ip”現(xiàn)象。使用簡單的命令,就可以迅速修改ip,真真做到“上網(wǎng),但不帶走一片樹葉“

D:\>netsh dump interface lacal area connection >MyNet.txt

現(xiàn)在,D:\下有一個(gè)文件:MyNet.txt,內(nèi)容如下:

#========================
# Interface configuration
#========================
pushd interface

reset all


popd
# End of interface configuration

#========================
# Interface configuration
#========================
pushd interface ipv6

uninstall


popd
# End of interface configuration

?

# ----------------------------------
# ISATAP Configuration
# ----------------------------------
pushd interface ipv6 isatap

?

popd
# End of ISATAP configuration

?

# ----------------------------------
# 6to4 Configuration
# ----------------------------------
pushd interface ipv6 6to4

reset

?

popd
# End of 6to4 configuration

#========================
# Port Proxy configuration
#========================
pushd interface portproxy

reset


popd
# End of Port Proxy configuration

?

# ----------------------------------
# Interface IP Configuration????????
# ----------------------------------
pushd interface ip


# Interface IP Configuration for "VMware Network Adapter VMnet8"

set address name="VMware Network Adapter VMnet8" source=static addr=192.168.159.1 mask=255.255.255.0
set dns name="VMware Network Adapter VMnet8" source=static addr=none register=PRIMARY
set wins name="VMware Network Adapter VMnet8" source=static addr=none

# Interface IP Configuration for "VMware Network Adapter VMnet1"

set address name="VMware Network Adapter VMnet1" source=static addr=192.168.148.1 mask=255.255.255.0
set dns name="VMware Network Adapter VMnet1" source=static addr=none register=PRIMARY
set wins name="VMware Network Adapter VMnet1" source=static addr=none

# Interface IP Configuration for "Local Area Connection"

set address name="Local Area Connection" source=static addr=192.168.0.183 mask=255.255.255.0
set address name="Local Area Connection" gateway=192.168.0.1 gwmetric=0
set dns name="Local Area Connection" source=static addr=221.136.0.1 register=PRIMARY
set wins name="Local Area Connection" source=static addr=none


popd
# End of interface IP configuration


???????????????????????????????????????????
# -----------------------------------------
# aaaa Configuration????????????????????????
# -----------------------------------------
# This script will NOT work across different versions of IAS.
# -----------------------------------------

# aaaa configuration script.?
# Known Issues and limitations:
# Import/Export between different versions is not supported.

Failed attempting to show the aaaa configuration.?
??????????????????????????????????????????


# End of aaaa configuration.?????????????????
????????????????????????????????????????????
????????????????????????????????????????????

???????????????????????????????????????????
# -----------------------------------------
# Remote Access Configuration??????????????
# -----------------------------------------
pushd ras

set authmode mode = standard
delete authtype type = PAP
delete authtype type = SPAP
delete authtype type = MD5CHAP
delete authtype type = MSCHAP
delete authtype type = MSCHAPv2
delete authtype type = EAP
add authtype type = MSCHAP
delete link type = SWC
delete link type = LCP
add link type = SWC
add link type = LCP
delete multilink type = MULTI
delete multilink type = BACP
add multilink type = MULTI
add multilink type = BACP

set user name = __vmware_user__ dialin = policy cbpolicy = none
set user name = Administrator dialin = policy cbpolicy = none
set user name = Guest dialin = policy cbpolicy = none
set user name = IUSR_LABSERVER2003 dialin = deny cbpolicy = none
set user name = IWAM_LABSERVER2003 dialin = deny cbpolicy = none
set user name = kavamorph dialin = policy cbpolicy = none
set user name = ss dialin = policy cbpolicy = none
set user name = SUPPORT_388945a0 dialin = policy cbpolicy = none


popd

# End of Remote Access configuration.???????
????????????????????????????????????????????
????????????????????????????????????????????

???????????????????????????????????????????
# -----------------------------------------
# Remote Access AppleTalk Configuration????
# -----------------------------------------
pushd ras appletalk

set negotiation mode = allow

popd

# End of Remote Access AppleTalk Configuration.


???????????????????????????????????????????
# -----------------------------------------
# Remote Access Diagnostics Configuration??
# -----------------------------------------
pushd ras diagnostics

set rastracing component = * state = disabled

set modemtracing state = disabled

set cmtracing state = disabled

set securityeventlogs state = disabled


popd

# End of Remote Access Diagnostics Configuration.
????????????????????????????????????????????????
????????????????????????????????????????????????

???????????????????????????????????????????
# -----------------------------------------
# Remote Access IP Configuration???????????
# -----------------------------------------
pushd ras ip

delete pool

set negotiation mode = allow
set access mode = all
set addrreq mode = deny
set broadcastnameresolution mode = disabled
set addrassign method = auto

popd

# End of Remote Access IP configuration.????
????????????????????????????????????????????

???????????????????????????????????????????
# -----------------------------------------
# Remote Access IPX Configuration??????????
# -----------------------------------------
pushd ras ipx

set negotiation mode = deny
set access mode = all
set nodereq mode = allow
set netassign method = autosame

popd

# End of Remote Access IPX configuration.???
????????????????????????????????????????????
????????????????????????????????????????????

???????????????????????????????????????????
# -----------------------------------------
# Remote Access NBF Configuration??????????
# -----------------------------------------
pushd ras netbeui

set negotiation mode = allow
set access mode = all

popd

# End of Remote Access NBF configuration.??
???????????????????????????????????????????
???????????????????????????????????????????

???????????????????????????????????????????
# -----------------------------------------
# Remote Access AAAA Configuration?????????
# -----------------------------------------
pushd ras aaaa

set authentication provider = windows
set accounting provider = windows

delete authserver name = *
delete acctserver name = *

?

popd

# End of Remote Access AAAA configuration.????
??????????????????????????????????????????????
??????????????????????????????????????????????
# Routing Configuration
pushd routing
reset
popd
# IP Configuration
pushd routing ip
reset
set loglevel error
add preferenceforprotocol proto=LOCAL preflevel=1
add preferenceforprotocol proto=NetMgmt preflevel=10
add preferenceforprotocol proto=STATIC preflevel=3
add preferenceforprotocol proto=NONDOD preflevel=5
add preferenceforprotocol proto=AUTOSTATIC preflevel=7
add preferenceforprotocol proto=OSPF preflevel=110
add preferenceforprotocol proto=RIP preflevel=120
add interface name="Local Area Connection" state=enable
set filter name="Local Area Connection" fragcheck=disable
add interface name="VMware Network Adapter VMnet8" state=enable
set filter name="VMware Network Adapter VMnet8" fragcheck=disable
add interface name="VMware Network Adapter VMnet1" state=enable
set filter name="VMware Network Adapter VMnet1" fragcheck=disable
add interface name="Internal" state=enable
set filter name="Internal" fragcheck=disable
add interface name="Loopback" state=enable
set filter name="Loopback" fragcheck=disable
popd
# End of IP configuration

?

# ----------------------------------
# DNS Proxy configuration???????????
# ----------------------------------
pushd routing ip dnsproxy
uninstall


popd
# End of DNS proxy configuration

?

# ----------------------------------
# IGMP Configuration????????????????
# ----------------------------------
pushd routing ip igmp
uninstall


popd
# End of IGMP configuration

?

# ----------------------------------
# NAT configuration?????????????????
# ----------------------------------
pushd routing ip nat
uninstall


popd

?


# ----------------------------------
# OSPF configuration????????????????
# ----------------------------------

pushd routing ip ospf
uninstall

popd
# End of OSPF configuration

?


# ----------------------------------
# DHCP Relay Agent configuration????
# ----------------------------------
pushd routing ip relay
uninstall


popd
# End of DHCP Relay configuration

?

# ----------------------------------
# RIP configuration?????????????????
# ----------------------------------
pushd routing ip rip
uninstall


popd
# End of RIP configuration

?

# ----------------------------------
# Router Discovery Configuration????
# ----------------------------------
pushd routing ip routerdiscovery
uninstall
add interface name="Local Area Connection" disc=disable minint=7 maxint=10 life=30 level=0
add interface name="VMware Network Adapter VMnet8" disc=disable minint=7 maxint=10 life=30 level=0
add interface name="VMware Network Adapter VMnet1" disc=disable minint=7 maxint=10 life=30 level=0
add interface name="Internal" disc=disable minint=7 maxint=10 life=30 level=0
add interface name="Loopback" disc=disable minint=7 maxint=10 life=30 level=0


popd


# ----------------------------------
# DHCP Allocator Configuration??????
# ----------------------------------
pushd routing ip autodhcp
uninstall


popd
# End of DHCP Allocator Configuration


Loading of DLL WinsEvnt.dll failed.
Wins Operation failed with Error There are no more endpoints available from the endpoint mapper.


做好了第一步,現(xiàn)在開始第二步:

通過控制面板修改網(wǎng)絡(luò)設(shè)置,修改完以后在CMD下輸入:

D:\>netsh dump interface lacal area connection >MyNet2.txt

大功告成,現(xiàn)在有兩個(gè)網(wǎng)絡(luò)配置的腳本了,如果你想切換,在CMD下輸入:

D:\>netsh dump >mynet.txt

D:\>netsh dump >mynet2.txt

就可以迅速切換網(wǎng)絡(luò)配置了。

轉(zhuǎn)載于:https://www.cnblogs.com/kavamorph/archive/2004/03/11/2802.html

總結(jié)

以上是生活随笔為你收集整理的切换网络配置之脚本法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。