Routing and NAT

Summary

This note explains how traffic moves between networks and how NAT changes source or destination addressing. The goal is to understand what routing does, why a default gateway matters, and why NAT appears so often in home networks, labs, and cloud environments.

Azure hub-and-spoke network diagram from official documentation

Official Microsoft Azure diagram showing traffic moving through a central routing point across connected network areas.

Why this matters

  • once traffic leaves the local subnet, routing becomes part of the problem
  • NAT is common in home, lab, and cloud setups, so it is important to recognise what it changes and what it does not
  • many “internet access” issues are really routing or NAT issues rather than DNS problems

Environment / Scope

ItemValue
Topicrouting and NAT basics
Best use for this noteunderstanding traffic beyond the local subnet
Main focusroutes, gateways, source translation
Safe to practise?yes

Key concepts

  • Route - a rule that tells a host or router where traffic should go
  • Default route - the route used when there is no more specific match
  • Router - a device that moves traffic between networks
  • NAT - network address translation, where source or destination addressing is rewritten
  • Private address space - non-public address ranges typically used behind NAT

Mental model

Inside one subnet, hosts can usually talk directly.
Once traffic needs to leave that subnet, it goes to a router:

host -> default gateway -> router -> next network

NAT often appears at the boundary between private and public networks:

private host -> router performs NAT -> public-facing traffic

This means the outside world may not see the host’s original private address at all.

Everyday examples

ScenarioWhat is happening
Laptop reaches the internet through home routerrouting plus source NAT
VM reaches another subnet through lab firewall/routerrouting
Container publishes a service to the hosttranslation or forwarding may be involved depending on the setup
Cloud private subnet reaches internet via gateway/NAT servicerouting plus NAT

Common misunderstandings

MisunderstandingBetter explanation
”The gateway is the internet”the gateway is only the next hop towards other networks
”NAT is the same as a firewall”NAT changes addressing; it does not automatically mean strong filtering policy
”If DNS works, routing must be fine”name resolution and packet forwarding are separate problems
”Private IPs can be routed on the public internet normally”private ranges are normally meant for internal use and often rely on NAT to reach public services

Verification

CheckExpected result
ip routeshows a sensible default route
ping <gateway-ip>gateway is reachable from the host
traceroute <destination>shows hops beyond the local subnet
External IP checktraffic reaches outside networks if routing and NAT are healthy

Pitfalls / Troubleshooting

ProblemLikely causeWhat to check
Local network works but internet does notmissing or wrong default routeip route, gateway reachability
Gateway responds but external traffic failsupstream routing or NAT issuetraceroute, router config, upstream path
Service works internally but not externallyNAT/port forwarding or firewall issuepublished ports, translation, filtering
Addressing looks correct but return traffic failsasymmetric routing or missing reverse pathroute tables on both sides

Key takeaways

  • routing is what moves traffic between networks
  • the default gateway matters as soon as traffic leaves the local subnet
  • NAT is common and useful, but it can also hide what is really happening to addresses

Official standards