Port forwarding, or port mapping, allows remote servers and devices on the internet to access the devices that are within your private local-area network (LAN) and vice versa.
Essentially, port forwarding maps an external “port” on your internet-facing IP address to a particular computer on your local private network. This allows you (or someone else) to access something on your computer from the internet.
If CGW machine is running on a public cloud, then make sure the WAN port configured for port forwarding is allowed to be accessed.
For eg., if CGW is running on Azure cloud, then make sure that WAN interface on CGW has inbound rules configured in Network Security Group (NSG) to allow WAN port configured for port forwarding. WAN interface should have any rules or NSG to block the traffic from public internet except you would like to allow specific IPs to use port forwarding.
¶ How to debug if traffic is not received on WAN interface of Azure VM?
The Network Security Group (NSG) may be blocking the incoming traffic.
Steps to check:
Go to Virtual Machines → Select your VM → Networking.
Under Inbound port rules, verify if there’s a rule allowing traffic on the required port (e.g., SSH on port 22, RDP on port 3389, HTTP on port 80, HTTPS on port 443).
Ensure the Source is set to allow traffic from the internet (Any or specific allowed IP range).
Ensure the Protocol is correctly set to TCP, UDP, or Any, depending on your traffic type.
Check that the rule Priority is lower (higher priority) than any blocking rules.
You can also use the IP Flow Verify feature in Network Watcher to check if the NSG rules are correctly configured for specific source and destination addresses.
Network Watcher provides tools to monitor and troubleshoot networking issues.
IP Flow Verify: This tool allows you to check whether a specific flow (source IP, destination IP, and port) is allowed or denied by NSGs. If the flow is denied, it will also show which NSG rule blocked the traffic.
Go to Azure Network Watcher → IP Flow Verify → Select the VM → Enter source/destination IP and ports to test.
Network Security Group (NSG) Flow Logs: Enable NSG flow logs to capture detailed information about traffic flowing through your NSG.
Go to Network Watcher → NSG Flow Logs → Enable and configure for the NSG attached to the VM.
Connection Troubleshoot: Use the connection troubleshoot feature to test connectivity from the VM to a target destination or from external sources to the VM.
Go to Network Watcher → Connection Troubleshoot → Select the VM → Enter the IP and port you want to test.