In multi-homed Windows 11 workstations and enterprise client machines—especially laptops alternating between wired Ethernet docks, corporate Wi-Fi, mobile hotspots, and virtualized Hyper-V switches—applying uniform firewall rules across all network connections poses serious security and performance risks. For example, developers may need an internal development web server or debugging socket accessible across a virtual Hyper-V internal switch, but strictly blocked across physical Wi-Fi or cellular interfaces. Conversely, administrative SSH access might be permitted over dedicated management LAN adapters while forbidden on standard user interfaces.
While the standard Windows Defender Firewall GUI permits scoping rules by network profile (Domain, Private, or Public), it provides limited flexibility for isolating rules to specific hardware network cards or interface categories. In Windows 11, the native PowerShell NetSecurity module resolves this challenge through dedicated interface filter objects managed via Get-NetFirewallInterfaceFilter, Set-NetFirewallInterfaceFilter, and Set-NetFirewallInterfaceTypeFilter. This guide covers how to identify network adapter aliases, bind firewall rules to distinct physical or virtual interfaces, restrict traffic by interface type, and audit scoped filters.
Understanding Interface and Interface Type Filters
In the Windows Filtering Platform (WFP), a firewall rule object is composed of multiple linked sub-filters. In addition to address filters (IP ranges) and port filters (TCP/UDP ports), rules can be constrained using two interface-specific filter classes:
- Interface Filters (
NetFirewallInterfaceFilter): Associates a rule with one or more specific network adapters identified by their interface alias (such as"Ethernet","Wi-Fi", or"vEthernet (Default Switch)"). Traffic matching the rule’s port and address criteria is processed only if it traverses the specified physical or virtual network interface card (NIC). - Interface Type Filters (
NetFirewallInterfaceTypeFilter): Restricts rules based on general media categories rather than specific hardware names. Supported interface types includeWired(orLan),Wireless, andRemoteAccess(VPN or dial-up tunnels). This ensures rules automatically adapt when users switch between different physical Wi-Fi adapters or docking station dongles.
Identifying Network Adapter Names and Interface Types
Before binding firewall rules to adapters, query your active hardware and virtual interfaces using the Get-NetAdapter cmdlet from an elevated PowerShell console:
# List all network adapters with alias and media type
Get-NetAdapter | Select-Object Name, InterfaceDescription, Status, MediaType, MacAddress
The output enumerates active and disconnected interfaces:
Name Status MediaType MacAddress
---- ------ --------- ----------
Ethernet Up 802.3 00-1A-2B-3C-4D-5E
Wi-Fi Connected Native 802.11 10-2B-3C-4D-5E-6F
vEthernet (InternalSwitch) Up 802.3 00-15-5D-01-02-03
Take note of the exact string under the Name column. You will pass this alias when applying interface-level scoping.
Scoping Existing Firewall Rules to Specific Network Interfaces
To restrict an existing firewall rule so that it applies exclusively to traffic traversing a particular network adapter, use Get-NetFirewallRule piped to Get-NetFirewallInterfaceFilter and update the interface alias.
For example, to bind an inbound development rule named "Custom-NodeJS-App" strictly to the Hyper-V internal virtual switch:
# Scope existing firewall rule to a virtual switch adapter
Get-NetFirewallRule -DisplayName "Custom-NodeJS-App" |
Get-NetFirewallInterfaceFilter |
Set-NetFirewallInterfaceFilter -InterfaceAlias "vEthernet (InternalSwitch)"
To scope a rule across multiple interfaces simultaneously—for instance, permitting traffic over both the primary Ethernet adapter and a dedicated management LAN dongle—pass an array of interface aliases:
# Scope firewall rule to both wired Ethernet and docking station LAN
Get-NetFirewallRule -DisplayName "Management-SSH-Ingress" |
Get-NetFirewallInterfaceFilter |
Set-NetFirewallInterfaceFilter -InterfaceAlias @("Ethernet", "Ethernet 2")
Creating New Firewall Rules with Direct Interface Scoping
Rather than modifying an existing rule, you can define interface scoping directly at creation time using the -InterfaceAlias parameter of New-NetFirewallRule:
# Create inbound rule permitting TCP port 8080 only on internal virtual switch
New-NetFirewallRule -DisplayName "Isolated-Dev-Port" `
-Direction Inbound `
-Action Allow `
-Protocol TCP `
-LocalPort 8080 `
-InterfaceAlias "vEthernet (InternalSwitch)" `
-Profile Private, Domain
When this rule is active, packets directed to port 8080 arriving over the physical Wi-Fi or Ethernet adapters are ignored by this rule and dropped by the firewall’s default inbound block policy.
Scoping Rules by Interface Type (Wired vs Wireless vs VPN)
In mobile enterprise environments, hardcoding specific adapter names can cause rules to break if a user replaces a USB-C LAN dongle or switches Wi-Fi bands. In such cases, scope rules by media category using Set-NetFirewallInterfaceTypeFilter.
For instance, to permit a local streaming service or file sharing protocol only when connected to a physical wired network:
# Restrict rule exclusively to physical wired (LAN) connections
Get-NetFirewallRule -DisplayName "Local-Media-Streaming" |
Get-NetFirewallInterfaceTypeFilter |
Set-NetFirewallInterfaceTypeFilter -InterfaceType Wired
Supported values for -InterfaceType include:
Wired:Matches any physical Ethernet adapter, docking station NIC, or USB-to-LAN adapter.Wireless:Matches internal and external 802.11 Wi-Fi adapters.RemoteAccess:Matches VPN connections and dial-up tunnels.Any:The default setting, allowing the rule to apply across all interface types.
You can also create a rule scoped by interface type directly in one step:
# Create inbound rule accessible exclusively over RemoteAccess (VPN) tunnels
New-NetFirewallRule -DisplayName "Corporate-Internal-Tool" `
-Direction Inbound `
-Action Allow `
-Protocol TCP `
-LocalPort 9000 `
-InterfaceType RemoteAccess
Inspecting and Auditing Interface Filters
To verify the effective interface binding of any firewall rule, query both the interface filter and interface type filter associated with the rule object:
# Query interface filter properties for a specific rule
Get-NetFirewallRule -DisplayName "Isolated-Dev-Port" | Get-NetFirewallInterfaceFilter
The output displays the active interface alias constraints:
InterfaceAlias : vEthernet (InternalSwitch)
PolicyStore : PersistentStore
To audit all inbound rules that have been restricted to specific network interfaces across the system:
# Audit all rules with explicit interface bindings
Get-NetFirewallRule -Direction Inbound | ForEach-Object {
$Rule = $_
$Filter = $Rule | Get-NetFirewallInterfaceFilter
if ($Filter.InterfaceAlias -and $Filter.InterfaceAlias -ne "") {
[PSCustomObject]@{
DisplayName = $Rule.DisplayName
Enabled = $Rule.Enabled
Direction = $Rule.Direction
Action = $Rule.Action
InterfaceAlias = ($Filter.InterfaceAlias -join ", ")
}
}
} | Format-Table -AutoSize
Removing Interface Constraints and Reverting to Universal Scope
If network hardware is decommissioned or a service must be accessible across all interfaces, clear the interface alias filter by setting it to an empty string:
# Remove interface-specific scoping and allow rule across all interfaces
Get-NetFirewallRule -DisplayName "Isolated-Dev-Port" |
Get-NetFirewallInterfaceFilter |
Set-NetFirewallInterfaceFilter -InterfaceAlias $Null
Similarly, reset an interface type filter back to universal evaluation:
# Reset interface type filter to Any
Get-NetFirewallRule -DisplayName "Local-Media-Streaming" |
Get-NetFirewallInterfaceTypeFilter |
Set-NetFirewallInterfaceTypeFilter -InterfaceType Any
Troubleshooting Interface-Scoped Firewall Rules
When interface-scoped firewall rules do not behave as expected, consider these operational factors:
- Renamed Network Adapters: Interface filters bind strictly to the adapter’s string alias (
Name). If an administrator renames an adapter in the Network Connections control panel (e.g., from"Ethernet"to"Production-LAN"), any firewall rules hardcoded to the old alias will fail to match. Always update filters when altering adapter aliases. - Conflict between Interface Scoping and Profile Scoping: A rule scoped to
"Wi-Fi"will still fail to allow traffic if the Wi-Fi connection is classified as aPublicprofile while the rule is restricted toDomainorPrivate. Ensure both profile settings and interface filters align with the active network environment. - Virtual Switch Teaming and Bridge Adapters: When Hyper-V virtual switches or network bridges are established, physical adapters are bound to the switch protocol, and the host communicates via the synthetic
vEthernetadapter. Rules intending to filter host traffic must be scoped to thevEthernetalias rather than the underlying physical NIC.
Scoping Windows Defender Firewall rules by network interface and media category allows system administrators to isolate testing environments, secure multi-homed endpoints, and prevent accidental service exposure across unvetted networks.