[英]Enable and Disable IPv4 and IPv6 of an adapter programmatically in C#
是否可以使用C#和.Net库或注册表为选定的网络适配器启用/禁用IPv4和IPv6协议?
Take a look at : http://eniackb.blogspot.com/2009/07/how-to-disable-ipv6-in-windows-2008.html 请查看: http : //eniackb.blogspot.com/2009/07/how-to-disable-ipv6-in-windows-2008.html
Basically modify registry to do same as you would using GUI. 基本上修改注册表以执行与使用GUI相同的操作。
You need to use INetCfgBindingPath::Enable
then INetCfg::Apply
method (see here ). 您需要使用
INetCfgBindingPath::Enable
然后使用INetCfg::Apply
方法(请参阅此处 )。 Please look into code example for details: how to disable ipv6 programmatically . 请查看代码示例以获取详细信息: 如何以编程方式禁用ipv6 。
As far as I know nvspbind can disable or enable IPv6 on specified adapter without rebooting PC. 据我所知, nvspbind可以在指定的适配器上禁用或启用IPv6而无需重启PC。 And I think
nvspbind
is based on INetCfg
API. 我认为
nvspbind
基于INetCfg
API。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.