Skip to content

Change Default Container's Network Outbound policy to DENY-ALL #617

Closed

Description

What is your question?
After Reading this document , it mentions that Default Outbound: ALLOW ALL for Windows Server Containers. It also mentions that it's possible to change the default for HNSNetwork to be DENY-ALL. We tried changing all firewall networks to Block, but that didn't have any effect on the NAT network and containers created underneath it. Can you please point us to correct syscall/powershell/documentation that will change the default back to DENY-ALL ? DENY-ALL is the default behavior for Windows Server 2019.

Activity

  1. github-actions commented on Oct 6, 2025

    @github-actions

    Thank you for creating an Issue. Please note that GitHub is not an official channel for Microsoft support requests. To create an official support request, please open a ticket here. Microsoft and the GitHub Community strive to provide a best effort in answering questions and supporting Issues on GitHub.

  2. winkingturtle-vmw commented on Nov 7, 2025

    @winkingturtle-vmw
    Author

    Pinging to keep this issue open

  3. winkingturtle-vmw commented on Dec 9, 2025

    @winkingturtle-vmw
    Author

    Pinging to keep this issue open

  4. winkingturtle-vmw commented on Jan 12, 2026

    @winkingturtle-vmw
    Author

    Pinging to keep this issue open

  5. winkingturtle-vmw commented on Feb 17, 2026

    @winkingturtle-vmw
    Author

    Pinging to keep this issue open

  6. winkingturtle-vmw commented on Mar 23, 2026

    @winkingturtle-vmw
    Author

    Pinging to keep this issue open

  7. sureshbabu-msft commented on Apr 13, 2026

    @sureshbabu-msft

    Hi Amin Jamali (@winkingturtle-vmw), Thank you for your patience — we've investigated this in detail. Here's a summary of our findings and recommendations:

    Why Windows Firewall Changes Don't Work

    The outbound policy for NAT-networked containers is controlled at the HNS/VFP layer, not the Windows Firewall layer. Modifying firewall profiles (even setting all to "Block") has no effect on container traffic in NAT mode. The Network Isolation and Security (https://learn.microsoft.com/en-us/virtualization/windowscontainers/container-networking/network-isolation-security) doc references this but doesn't provide actionable steps — we acknowledge that gap.

    Recommended Workaround: HNS Endpoint ACL Policies

    For process-isolated containers, you can apply a DENY-ALL outbound policy per container using HNS endpoint ACL policies. This has been tested and confirmed to block all outbound traffic (including DNS).

    You can apply an ACL policy with Action=Block, Direction=Out, Protocol=256 (Any) to the container's HNS endpoint using Get-HnsEndpoint and Invoke-HNSRequest. This must be applied per container endpoint — there is currently no network-wide default DENY-ALL configuration option for NAT networks.

    Hyper-V Isolation Limitation

    For Hyper-V isolated containers using NAT networking, HNS ACL policies do not take effect due to a platform limitation — the default port ACLs cannot be reconfigured (https://learn.microsoft.com/en-us/virtualization/windowscontainers/container-networking/network-isolation-security) in NAT and Transparent modes for Hyper-V isolation. As an alternative, L2Bridge networking can be considered, where VFP-based ACL enforcement is expected to be more effective.

    Kubernetes Environments

    If you are running Windows containers in Kubernetes with Calico, you can enforce egress deny-all using a Kubernetes Network Policy
    (https://docs.tigera.io/calico/latest/network-policy/get-started/kubernetes-policy/kubernetes-network-policy).

    We hope this helps unblock your scenario. Please let us know if you have further questions.

  8. winkingturtle-vmw commented on Apr 13, 2026

    @winkingturtle-vmw
    Author

    Thank you sureshbabu-msft for your response. I believe you may have ran your tests against Windows Server 2022 or 2019. As replied in this issue (#616) applying ACLPolicy for HNSEndpoint is broken Windows Server 2025.

  9. sureshbabu-msft commented on Apr 16, 2026

    @sureshbabu-msft

    Hi Amin Jamali (@winkingturtle-vmw), thank you for the follow-up and for pointing out the ACLPolicy issue on Windows Server 2025.

    Since the underlying ACLPolicy/HNSEndpoint issue on Windows Server 2025 is already being tracked in #616, we are closing this issue to consolidate the discussion and avoid duplication. Any updates and fixes related to ACLPolicy enforcement will be tracked there.

    Please continue to follow #616 for progress on this. If you have additional questions or scenarios beyond what's covered in #616, feel free to open a new issue.

    Thank you for your patience and for helping us identify this gap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    NetworkingConnectivity and network infrastructuredocumentationNeed improvements or additions to docsquestionFurther information is requestedtriageNew and needs attention

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions