Use it when a VM is behind a hypervisor/virtual-router NAT network or when connectivity depends on translation rather than direct bridged/routed addressing.
NAT (Network Address Translation)
NAT in virtual networking lets VMs on a private network share the host's or a virtual router's IP address to reach other networks, and can publish a VM service through port forwarding. It is the default network mode in many desktop hypervisors and libvirt.
1. NAT hides VMs behind the host IP.
2. Good for labs; inbound needs port forwards.
3. libvirt default network: 192.168.122.0/24.
4. Check forwarding and masquerade rules.
5. Not for production servers.
VM → NAT network → masquerade → host uplink
Test representative inbound/outbound rules and state expiry/failover if relevant.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
It does not show all rules, ports, remote services or long-lived state behavior.
Next check: Test representative inbound/outbound rules and state expiry/failover if relevant.
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
guest packet → virtual L2/L3 path → NAT match/translation → external route → remote service → return packet → reverse translation → guest
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- NAT is stateful translation, not a substitute for valid routing and return-path reachability.
- A translation entry proves matching traffic reached the NAT function, not that the remote endpoint responded.
- Inbound publishing/port forwarding requires a separate destination translation and policy path.
- NAT can mask overlapping/private addresses but adds another troubleshooting boundary.
virsh net-dumpxml default— libvirt NAT networkiptables -t nat -L -n -v— NAT rulesGet-NetNat— Windows NAT (Hyper-V internal)
ReferenceImportant terms & boundaries3 sections · depth on demand
What this shows and what it does not
A translation entry shows the flow matched and state was created, but it does not show external routing, remote application response or reverse delivery to the guest.
NAT setups
| Platform | How |
|---|---|
| libvirt | Default network virbr0 NAT (virsh net-list) |
| Hyper-V | Internal switch + New-NetNat -InternalIPInterfaceAddressPrefix 192.168.100.0/24 |
| Proxmox | Masquerade rule on a bridge (post-up iptables -t nat -A POSTROUTING …) |
| VMware Workstation | VMnet8 |
In depth
NAT networks let VMs reach outside networks through the host's address without their own routable IPs — default on desktop hypervisors and libvirt (default network on virbr0, 192.168.122.0/24 with dnsmasq).
virsh net-list --all; virsh net-dumpxml default
iptables -t nat -L -n -v | grep 192.168.122
# Hyper-V
New-VMSwitch -Name NATSwitch -SwitchType Internal
New-NetIPAddress -IPAddress 192.168.50.1 -PrefixLength 24 -InterfaceAlias 'vEthernet (NATSwitch)'
New-NetNat -Name LabNAT -InternalIPInterfaceAddressPrefix 192.168.50.0/24
Inbound access needs port forwards; NAT is fine for labs, rarely for servers.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Virtual Networking → NAT. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://libvirt.org/formatnetwork.html · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Virtual Networking → NAT reference map
Fast virtual-network boundaries for Virtual Networking → NAT.
| Boundary | Meaning | Evidence limit |
|---|---|---|
| Pre-NAT | Guest identity | Original flow |
| Translation | Mapped address/port | State evidence |
| Post-NAT | External identity | Egress evidence |
| Reverse | Return translation | Required for session |