使用命令,netsh interface dump > dumpfile.cfg
我以脚本格式获取网络配置,可以通过 重新加载netsh exec dumpfile.cfg
。在检索到的文件中没有提到网关和 DNS 地址...为什么?还有其他方法可以真正保存和恢复实际的网络配置吗?
我的转储文件的内容:
#========================
# Interface configuration
#========================
pushd interface
popd
# End of interface configuration
# ----------------------------------
# IPHTTPS Configuration
# ----------------------------------
pushd interface httpstunnel
reset
popd
# End of IPHTTPS configuration
# ----------------------------------
# IPv4 Configuration
# ----------------------------------
pushd interface ipv4
reset
set global icmpredirects=enabled
add route prefix=0.0.0.0/0 interface="Local Area Connection" nexthop=169.254.144.200 metric=1 publish=Yes
add address name="VirtualBox Host-Only Network" address=192.168.56.1 mask=255.255.255.0
add address name="VMware Network Adapter VMnet1" address=192.168.6.1 mask=255.255.255.0
add address name="VMware Network Adapter VMnet8" address=192.168.111.1 mask=255.255.255.0
add address name="Local Area Connection" address=169.254.144.155 mask=255.255.255.0
popd
# End of IPv4 configuration
# ----------------------------------
# IPv6 Configuration
# ----------------------------------
pushd interface ipv6
reset
set interface interface="Teredo Tunneling Pseudo-Interface" forwarding=disabled advertise=disabled mtu=1280 metric=0 siteprefixlength=0 nud=disabled routerdiscovery=disabled managedaddress=disabled otherstateful=disabled weakhostsend=disabled weakhostreceive=disabled ignoredefaultroutes=disabled advertisedrouterlifetime=0 advertisedefaultroute=disabled currenthoplimit=0 forcearpndwolpattern=disabled enabledirectedmacwolpattern=disabled
popd
# End of IPv6 configuration
# ----------------------------------
# ISATAP Configuration
# ----------------------------------
pushd interface isatap
popd
# End of ISATAP configuration
# ----------------------------------
# 6to4 Configuration
# ----------------------------------
pushd interface 6to4
reset
popd
# End of 6to4 configuration
# ----------------------------------
# ISATAP Configuration
# ----------------------------------
pushd interface isatap
popd
# End of ISATAP configuration
#========================
# Port Proxy configuration
#========================
pushd interface portproxy
reset
popd
# End of Port Proxy configuration
# ----------------------------------
# TCP Configuration
# ----------------------------------
pushd interface tcp
reset
set global rss=enabled chimney=automatic autotuninglevel=normal congestionprovider=none ecncapability=disabled timestamps=disabled netdma=enabled dca=enabled
Dump has failed when retreiving chimneyapplication settings.
Dump has failed when retreiving chimneyapplication settings.
Dump has failed when retreiving chimneyapplication settings.
Dump has failed when retreiving chimneyapplication settings.
popd
# End of TCP configuration
# ----------------------------------
# Teredo Configuration
# ----------------------------------
pushd interface teredo
set state type=client servername=teredo.ipv6.microsoft.com. servervirtualip=0.0.0.0
popd
# End of Teredo configuration
# ----------------------------------
# 6to4 Configuration
# ----------------------------------
pushd interface 6to4
reset
popd
# End of 6to4 configuration
答案1
我发现微软论坛一个主题这表示使用附加的 -c 参数:
netsh –c interface dump
只是这不会将网关写为“网关”而是写为“nexthop”,并且我没有看到其中的 DNS 条目...据我所知,这对任何人来说都不是一个可行的解决方案,但这是我通过 dump/restore 从 netsh 中获得的最多的信息。