Connect VMs with virtual networking
Explore virtual switches, NAT, bridge modes, and security groups.
- Choose network modes for VM connectivity and exposure.
VMs connect through virtual NICs to virtual switches. In bridge mode, a VM appears directly on the local network. In NAT mode, VMs use private addresses and share host egress. Security groups or firewall rules control inbound and outbound traffic per VM or subnet.
Good VM networking design applies least privilege: open only required ports, segment workloads by function, and monitor east-west traffic. For public services, pair network policy with host hardening and patch discipline.
Practice: choose a network mode
Try it
Up to 15 XPNAT or bridged?
Think about who needs to start the connection: the VM, or something else on the network.
“A throwaway VM on your laptop that just needs to download updates.”
“A file server that colleagues connect to from their own machines.”
“A VM on a café’s Wi-Fi that you don’t want others to see.”
“A VM that must get an address from the office DHCP server.”
Practice: fix a security group
Try it
Up to 15 XPOrder the rules for a web VM
Each rule is reasonable, but the first match wins, so this order lets the wrong traffic in. Use the arrows until every flow behaves as it should.
Rules, checked top to bottom
- 1AllowSSH from anywhere
- 2DenyEverything from guest Wi-Fi
- 3AllowHTTPS from anywhere
- 4DenySSH from everyone else
- 5AllowSSH from the bastion host
- –Anything else: denied by default
Traffic
- A customer loads the site (internet, 443)Should pass. Matched rule 3: Allow.
- An admin connects through the bastion (bastion, 22)Should pass. Matched rule 1: Allow.
- A stranger tries SSH (internet, 22)Should be blocked. Matched rule 1: Allow.
- A visitor probes the VM (guest-wifi, 443)Should be blocked. Matched rule 2: Deny.
- Someone tries the database (internet, 5432)Should be blocked. No rule matched, so it's denied by default.
1 flow has the wrong verdict.
Key takeaways
Choose network modes for VM connectivity and exposure.
VMs are powerful when automation and guardrails stay strong.
Observe before scaling; recover before incidents become outages.
Lesson quiz
5 questions · pass with 4 correct · up to 50 XP
Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.
Questions about this lesson
Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.
Loading posts…