Verifying Connectivity after Site to Site

John Spriggs 0 Reputation points
2026-11-19T17:20:48.7633333+00:00

We have configured a Site to site connection that we can verify is live and works.

I can ping our outside address from our VM in azure

I can ping Azure PIP from on premise devices.

But i cannot ping or test ports to the VM server in Azure from our local environment.

I have striped our Network security group(NSG) to ensure we are not blocking ourselves.

Was looking for some suggestions as what is next.

Thank you for any replies.

Azure VPN Gateway
Azure VPN Gateway

An Azure service that enables the connection of on-premises networks to Azure through site-to-site virtual private networks.

0 comments No comments

2 answers

Sort by: Newest
  1. VIVEK DWIVEDI 270 Reputation points Microsoft Employee
    2026-11-20T04:13:05.79+00:00

    Hi @John Spriggs

    So the tunnel shows connected, but nothing from on-prem actually lands on the VM. That's a pretty common spot to be in after a fresh S2S build. A connected tunnel only tells you IKE/IPsec came up. It doesn't tell you the right traffic is being sent into it.

    One thing first. The pings you mentioned are both going to public addresses, so they're going over the internet, not through the tunnel. S2S traffic should be aimed at the VM's private IP. Also, the VPN gateway itself doesn't reply to ICMP on its local address, so don't use it as a ping target.

    Here's the order I'd work through it in.

    1. Test the VM's private IP over TCP, not just ping

    Ping is often blocked by the guest OS firewall, so a failed ping on its own doesn't prove much. I'd test a port you know is listening:

    # From an on-prem Windows host
    Test-NetConnection <VM-private-IP> -Port 3389
    tracert <VM-private-IP>
    
    # From an on-prem Linux host
    nc -vz <VM-private-IP> 22
    

    On the VM, check the service is actually listening and the OS firewall allows your on-prem subnet. Open just that port for that source range. No need to turn the whole firewall off.

    1. Verify the Port in Azure VM is in listening state.

    Windows VM, run elevated

    Get-NetTCPConnection -State Listen |

    Where-Object LocalPort -in 3389,443

    Get-NetFirewallProfile

    Linux VM

    sudo ss -lntp

    sudo nft list ruleset # or: iptables -S

    sudo firewall-cmd --list-all 2>/dev/null || sudo ufw status

    Fix the port listening issue first if they are not in listening state.

    3. Check the address spaces on both ends

    • In the portal, open the Local network gateway and check its address space includes the exact on-prem subnet you're testing from.
    • On your on-prem firewall, the Azure VNet prefix has to be routed into the tunnel, and the encryption domain / proxy IDs need to list your on-prem subnet as local and the Azure VNet (or VM subnet) as remote.
    • If the gateway is policy-based, the prefixes have to match exactly on both sides. Microsoft's troubleshooting guide calls this out specifically.43. Look at the VM's effective routes

    This shows you the return path. Go to VM > Networking > Network settings > NIC > Help > Effective routes. You want to see your on-prem prefix with next hop Virtual network gateway. The VM has to be running for this to show anything.

    az network nic show-effective-route-table \
      --resource-group <rg> \
      --name <vm-nic-name> \
      --output table
    

    If a route table on the subnet is sending that prefix to an NVA or a firewall, the traffic goes there instead. In that case the NVA needs IP forwarding enabled or packets get dropped.

    4. Watch the tunnel counters while you test

    Open the virtual network gateway > Connections > your connection and note Data in / Data out. Run your test for a few minutes and refresh.

    • Nothing moves: traffic isn't entering the tunnel. Look at on-prem routing and the proxy IDs.
    • Data in goes up but no reply: the packets are reaching Azure. Focus on the VM side (routes, NSG, guest firewall).
    • Data out goes up but on-prem sees nothing: check the return path on your side.

    If it still isn't clear, run VPN troubleshoot in Network Watcher against the gateway and connection. It drops IKE logs into a storage account, and they'll show selector or policy mismatches.

    5. Confirm the NSG picture with IP flow verify

    NSGs can sit on both the subnet and the NIC, so removing one doesn't always clear everything. Run Network Watcher IP flow verify (inbound, VM private IP and port, on-prem source IP). It tells you which rule allows or denies the packet. For what it's worth, the default AllowVnetInBound rule uses the VirtualNetwork tag, and that tag includes connected on-prem address spaces. With the default rules in place, on-prem traffic should already be allowed.

    Let me know what the counters and effective routes show and we can take it from there.

    Reference documents

    Test-NetConnection <VM-private-IP> -Port 3389 tracert <VM-private-IP>

    From an on-prem Linux host

    nc -vz <VM-private-IP> 22

      
      On the VM, check the service is actually listening and the OS firewall allows your on-prem subnet. Open just that port for that source range. No need to turn the whole firewall off.
      
      __2. Verify the Port in Azure VM is in listening state.__
      
      # Windows VM, run elevated
    
      Get-NetTCPConnection -State Listen |
      
      Where-Object LocalPort -in 3389,443
      
      Get-NetFirewallProfile
      
      __Linux VM__
      
      sudo ss -lntp
      
      sudo nft list ruleset       # or: iptables -S
      
      sudo firewall-cmd --list-all 2>/dev/null || sudo ufw status
      
      Fix the port listening issue first if they are not in listening state.
      
      #### 3. Check the address spaces on both ends
    
      - In the portal, open the __Local network gateway__ and check its address space includes the exact on-prem subnet you're testing from.
      
      - On your on-prem firewall, the Azure VNet prefix has to be routed into the tunnel, and the encryption domain / proxy IDs need to list your on-prem subnet as local and the Azure VNet (or VM subnet) as remote.
      
      - If the gateway is policy-based, the prefixes have to match exactly on both sides. Microsoft's troubleshooting guide calls this out specifically.43. Look at the VM's effective routes
      
      This shows you the return path. Go to VM > Networking > Network settings > NIC > Help > __Effective routes__. You want to see your on-prem prefix with next hop __Virtual network gateway__. The VM has to be running for this to show anything.
      
      ```dockerfile
      az network nic show-effective-route-table \
      --resource-group <rg> \
      --name <vm-nic-name> \
      --output table
    

    If a route table on the subnet is sending that prefix to an NVA or a firewall, the traffic goes there instead. In that case the NVA needs IP forwarding enabled or packets get dropped.

    4. Watch the tunnel counters while you test

    Open the virtual network gateway > Connections > your connection and note Data in / Data out. Run your test for a few minutes and refresh.

    • Nothing moves: traffic isn't entering the tunnel. Look at on-prem routing and the proxy IDs.
    • Data in goes up but no reply: the packets are reaching Azure. Focus on the VM side (routes, NSG, guest firewall).
    • Data out goes up but on-prem sees nothing: check the return path on your side.

    If it still isn't clear, run VPN troubleshoot in Network Watcher against the gateway and connection. It drops IKE logs into a storage account, and they'll show selector or policy mismatches.

    5. Confirm the NSG picture with IP flow verify

    NSGs can sit on both the subnet and the NIC, so removing one doesn't always clear everything. Run Network Watcher IP flow verify (inbound, VM private IP and port, on-prem source IP). It tells you which rule allows or denies the packet. For what it's worth, the default AllowVnetInBound rule uses the VirtualNetwork tag, and that tag includes connected on-prem address spaces. With the default rules in place, on-prem traffic should already be allowed.

    Let me know what the counters and effective routes show and we can take it from there.

    Reference documents

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-11-19T17:22:59.1766667+00:00

    Test the Azure VM’s private IP address, not the VPN gateway public IP or the VM public IP, and then verify that both sides have routes for the corresponding private subnets.

    A successful ping to either public endpoint only confirms internet-facing reachability; Site-to-Site traffic should reach the VM through its private NIC address. Azure private IPs are specifically used for on-premises communication through VPN Gateway.^1^

    1. Test a service on the VM’s private IP

    From an on-premises host, test a port that is known to be listening:

    # Windows client
    Test-NetConnection [IP Address] -Port 3389
    tracert [IP Address]
    
    # Linux client
    nc -vz [IP Address] 22
    traceroute [IP Address]
    

    Replace the address and port with the Azure VM’s private IP and actual service port.

    On the Azure VM, confirm that the service is listening:

    # Windows VM, run elevated
    Get-NetTCPConnection -State Listen |
      Where-Object LocalPort -in 3389,443
    Get-NetFirewallProfile
    
    # Linux VM
    sudo ss -lntp
    sudo nft list ruleset       # or: iptables -S
    sudo firewall-cmd --list-all 2>/dev/null || sudo ufw status
    

    If the service is listening but the connection fails, temporarily permit only the required port and on-premises source subnet in the guest OS firewall. Do not disable the entire firewall. Microsoft notes that when routes are correct, firewall software inside the VM can still prevent communication.^2^

    2. Verify routing in both directions

    1. On the on-premises router/firewall, verify that the Azure VNet prefix is routed into the IPsec tunnel.
    2. In Azure Portal, open Local network gateway → Configuration and verify that its address prefixes include the exact on-premises source subnet.
    3. Verify that the on-premises VPN traffic selectors or proxy IDs contain:
      • Local network: the on-premises subnet.
      • Remote network: the Azure VNet or VM subnet.
    4. Check the Azure VM’s return route:
      • VM → Networking → Network settings → select the NIC
      • Expand Help → Effective routes
      • Find the on-premises prefix and confirm that it is Active and points to Virtual network gateway, rather than None or an unintended virtual appliance.

    The VM must be running before Azure can return its effective routes. Effective routes combine system, custom, and BGP-propagated routes; a custom route can override the expected VPN path.^3^

    For CLI validation:

    az network nic show-effective-route-table \
      --resource-group <resource-group> \
      --name <vm-nic-name> \
      --output table
    

    If an Azure route sends the on-premises prefix to an NVA, confirm that the appliance and its NIC have IP forwarding configured. If no correct return route exists, correct the associated route table or BGP advertisement rather than adding an unrelated default route.

    3. Observe whether test traffic crosses the tunnel

    Open Virtual network gateway → Connections → your connection and record Data In and Data Out. Generate traffic to the VM’s private IP for several minutes, wait briefly, and refresh; these counters are cumulative and might not update immediately.

    • Neither counter changes: inspect on-premises routing, encryption domains/traffic selectors, and firewall policy.
    • Data In increases but the VM does not respond: focus on Azure routing, effective security rules, the guest firewall, and whether the service is listening.
    • Data Out increases without a reply on-premises: inspect the on-premises return path and firewall.

    Run Network Watcher → VPN troubleshoot, select a Standard storage account, the gateway, and the connection, and start troubleshooting. Download the generated files from the storage account’s vpn container; the IKE logs can expose selector, authentication, or IPsec-policy failures.^4^

    4. Confirm effective NSG handling without repeating the rebuild

    Stripping one NSG does not necessarily account for rules inherited from both the NIC and subnet. Use Network Watcher → IP flow verify with:

    • Direction: Inbound
    • Protocol: the tested TCP or UDP protocol
    • Local endpoint: VM private IP and service port
    • Remote IP: on-premises test host
    • Remote port: * or its ephemeral source port

    The result identifies the effective NSG rule allowing or denying the packet.^5^ This models NSG evaluation only; it does not prove that the packet crossed the VPN or that the guest service accepted it.

    5. Conditional GatewaySubnet check

    Because the tunnel is already connected, GatewaySubnet filtering is less likely than routing, selectors, or the guest firewall. Nevertheless, check whether GatewaySubnet has an NSG or route-table association. If it does, first review its rules and routes for traffic affecting the on-premises peer or default route.

    Only if review indicates that association may be responsible, temporarily detach it for a controlled test. Record/export the existing configuration, obtain authorization, use a maintenance window, assess security and connectivity impact, and prepare an immediate rollback before changing either association. If traffic starts flowing, correct the offending rule or route before restoring the association. A connected-but-no-traffic case can result from GatewaySubnet UDR or NSG configuration.^6^

    If packet captures show mismatched proxy IDs or the logs report TS_UNACCEPTABLE/error 13999, align the on-premises traffic selectors with the Azure and Local Network Gateway prefixes.^7^ Reset the gateway only after these routing, selector, and filtering checks fail.


    References

    1. Private IP addresses
    2. Diagnose a virtual machine routing problem
    3. Diagnose a virtual machine routing problem
    4. Diagnose on-premises VPN connectivity with Azure
    5. Troubleshoot network security group misconfigurations blocking traffic in Azure virtual networks
    6. No traffic is passing between on-premises and Azure VMs. - Microsoft Q&A
    7. Troubleshoot Azure site-to-site VPN error codes
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.