简体   繁体   中英

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

Basically modify registry to do same as you would using GUI.

You need to use INetCfgBindingPath::Enable then INetCfg::Apply method (see here ). Please look into code example for details: how to disable ipv6 programmatically .

As far as I know nvspbind can disable or enable IPv6 on specified adapter without rebooting PC. And I think nvspbind is based on INetCfg API.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM