How to Set the Interface Name in WireGuard on Windows

network-adapterwindowswireguard

Using WireGuard, I noticed a counter in the interface name of WireGuard interfaces in Windows. See for example the following image:

enter image description here

How I reproduce it:

I created (and activated) an interface using the official client (downloaded from here), using a configuration file called wg_test.conf. The interface name is correctly wg_test but then there is another (internal?) name, that contains a counter.

Each time I recreate the interface using the same file but changing the private key of the Wireguard interface, the counter increases. The counter is connected to the private keys, I mean if I reuse a previous private key, I will get a previous number. If I uninstall and reinstall the client, the counter does not restart.

Question:

How can I force the name to be only wg_test without any number?

Best Answer

That's not the interface name, but the name of a "network profile" that Windows tracks for purposes such as firewall policies, primarily so that it could apply different firewall rules for "public" vs "private" networks even if the same interface is reused.

For regular Ethernet connections, Windows automatically detects networks based on various fuzzy parameters (gateway MAC address, DNS search domain, etc.) – but most of those can't actually be used on VPN "tunnel" interfaces, so WireGuard manages the network associations explicitly, by associating the hash of you and your peers' keypairs with a Windows network ID. See this post for details.

Go to HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles in the Registry to find your "wg_test 6" network profile and rename it to something else. (In Windows 7/8.x this used to be available in the "Network & Sharing Center" but apparently not anymore.)

Related Question