Network adapters public/private

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Network adapters public/private

Postby denville » Tue Oct 30, 2018 9:52 am

So here is today's teaser (forgive that it is not directly CPB but it is the environment in which the programme runs). The PC has two RJ45 wired network adapters, I have renamed them LAN and WAN after my Chinese friends. Both connect to entirely static local networks; neither has nor needs a default gateway specified, neither requires nor need network discovery. When I connect to the networks both LAN and WAN say "Unidentified Network" (UN).

I want to refine the firewall rules and to this end I wish to assign ANY network connected to LAN as Private, and ANY network connected to WAN as Public.

So that's the challenge. I have tried every snippet I have found online without success (too many ideas to list). But the bottom line seems to be that Public and Private are assigned on the basis of the (connected) network name (ie Unidentified Network in both cases) so no discrimination possible. Even using a netsh command to selectively assign LAN to Private fails in that it sees that LAN is connected to UN, then looks for all adapters connected to UN and ends up changing BOTH LAN and WAN to Private!

I conclude that this approach is thus doomed, unless anyone knows better. One idea is to intercept how Windows actually names the connected network and force it to name it LAN Network / WAN Network depending on the adapter, but I have no idea if this is possible.

Any ideas ??
BCBJ Veteran
BCBJ Veteran
Posts: 65
Joined: Sat Mar 06, 2010 4:40 am

Return to Technical

Who is online

Users browsing this forum: No registered users and 17 guests