码迷,mamicode.com
首页 > Web开发 > 详细

实用netsh命令备份网络配置

时间:2015-03-29 10:48:20      阅读:1324      评论:0      收藏:0      [点我收藏+]

标签:netsh命令备份网络数据   netsh命令   

    如果用户使用笔记本电脑,并经常往来于家庭和公司之间,那么备份网络配置即可避免在网络配置改变之后重新配置。在windows98系统下可以使用"ipconfig /batch bak-netcfg"命令备份网络配置。在windows2000/XP系统下,可以使用netsh命令。
   要把主机上的所有网络相关的配置信息备份到C盘test.txt文件,可以运行命令:
netsh dump>c:\test.txt
   要把本机中远程访问连接和TCP/IP配置接口参数备份到C盘下的test.txt,可以运行命令:netsh interface dump>test.txt。
示例如下:
C:\>netsh dump>c:\test.txt,然后我们就可以在c盘找到test.txt文件,改文件的内容如下:
#========================
# 接口配置
#========================
pushd interface 




popd
# 接口配置结束






# ----------------------------------
# IPHTTPS 配置
# ----------------------------------
pushd interface httpstunnel


reset




popd
# IPHTTPS 配置的结尾






#========================
# IPv4 配置
#========================
pushd interface ipv4


reset
set global defaultcurhoplimit=64 icmpredirects=enabled taskoffload=enabled




popd
# IPv4 配置结束






# ----------------------------------
# IPv6 配置
# ----------------------------------
pushd interface ipv6


reset




popd
# IPv6 配置的结尾






# ----------------------------------
# ISATAP 配置
# ----------------------------------
pushd interface isatap






popd
# ISATAP 配置结束






# ----------------------------------
# 6to4 配置
# ----------------------------------
pushd interface 6to4


reset






popd
# 6to4 配置结束






# ----------------------------------
# ISATAP 配置
# ----------------------------------
pushd interface isatap






popd
# ISATAP 配置结束




#========================
# 端口代理配置
#========================
pushd interface portproxy


reset




popd


# 端口代理配置结束






# ----------------------------------
# TCP 配置
# ----------------------------------
pushd interface tcp


reset


全局设置 rss=enabled chimney=automatic autotuninglevel=normal congestionprovider=none ecncapability=disabled timestamps=disabled netdma=enabled dca=enabled




popd
# TCP 配置结束






# ----------------------------------
# Teredo 配置
# ----------------------------------
pushd interface teredo
set state type=client servername=teredo.ipv6.microsoft.com. servervirtualip=0.0.0.0






popd
# Teredo 配置结束






# ----------------------------------
# 6to4 配置
# ----------------------------------
pushd interface 6to4


reset






popd
# 6to4 配置结束




# ------------------------------------
# 桥配置 (不支持)
# ------------------------------------


# ------------------------------------
# 桥配置结束
# ------------------------------------


# ----------------------------------------
# 有线局域网配置
# ----------------------------------------
pushd lan




popd


# 有线局域网配置结尾。




不支持移动宽带配置转储


# ========================================================== 
# 健康注册机构配置 
# ========================================================== 
pushd nap hra


popd
# NAP HRA 配置的结尾 


                                            
# ----------------------------------------- 
# 远程访问配置
# -----------------------------------------
pushd ras


set authmode mode = standard
delete authtype type = PAP
delete authtype type = MD5CHAP
delete authtype type = MSCHAPv2
delete authtype type = EAP
delete authtype type = CERT
add authtype type = MSCHAPv2
delete link type = SWC
delete link type = LCP
add link type = SWC
add link type = LCP
delete multilink type = MULTI
add multilink type = MULTI
set conf confstate = disabled
set type ipv4rtrtype = lananddd ipv6rtrtype = none rastype = ipv4
set wanports device = "WAN Miniport (IKEv2)" rasinonly = disabled ddinout = disabled ddoutonly = disabled maxports = 2 
set wanports device = "WAN Miniport (L2TP)" rasinonly = disabled ddinout = disabled ddoutonly = disabled maxports = 2 
set wanports device = "WAN Miniport (PPPOE)" ddoutonly = disabled
set wanports device = "WAN Miniport (PPTP)" rasinonly = disabled ddinout = disabled ddoutonly = disabled maxports = 2 
set wanports device = "WAN Miniport (SSTP)" rasinonly = disabled ddinout = disabled ddoutonly = disabled maxports = 2 


set user name = Administrator dialin = policy cbpolicy = none 
set user name = Guest dialin = policy cbpolicy = none 


set ikev2connection idletimeout = 5 nwoutagetime = 30
set ikev2saexpiry saexpirytime = 480 sadatasizelimit = 100


popd


#  远程访问配置结束。






                                            
# ----------------------------------------- 
# 远程访问诊断配置
# -----------------------------------------
pushd ras diagnostics


set rastracing component = * state = disabled


set modemtracing state = disabled


set cmtracing state = disabled


set securityeventlog state = disabled


set loglevel events = warn




popd


# 远程访问诊断配置结束






                                            
# ----------------------------------------- 
# 远程访问 IP 配置
# -----------------------------------------
pushd ras ip


delete pool


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


popd


# 远程访问 IP 配置结束。




                                            
# ----------------------------------------- 
# 远程访问 IPv6 配置          
# ----------------------------------------- 
pushd ras ipv6






set negotiation mode = deny
set access mode = all
set routeradvertise mode = enabled


popd


# 远程访问 IPv6 配置结束。   
                                             


                                            
# ----------------------------------------- 
# 远程访问 AAAA 配置
# -----------------------------------------
pushd ras aaaa




popd


# 远程访问 AAAA 配置结束。








# -----------------------------------------
# WinHTTP 代理服务器配置
# -----------------------------------------
pushd winhttp


reset proxy


popd


# WinHTTP 代理服务器配置末尾


以后在进行网络设置调整时,如果发生了操作错误,或者服务器网络出现故障,可以利用备份快速恢复网络设置:
netsh -f c:\test.txt或netsh exec c:\test.txt

实用netsh命令备份网络配置

标签:netsh命令备份网络数据   netsh命令   

原文地址:http://blog.csdn.net/qq_20545159/article/details/44724957

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!