Introduction
Hello! In our last lesson, we dove into specific wireless vulnerabilities like deauthentication and evil twin attacks. We saw how attackers can exploit the fundamental protocols of Wi-Fi to disrupt networks and intercept data. These attack scenarios, particularly the labs you can build to study them, often rely on a foundational technology: virtualization.
Today, we'll explore that technology. Your learning outcome is to explain virtual machine networking modes (bridged, NAT, and host-only). We'll examine how a virtual machine (VM), which is essentially a computer running inside your computer, connects to networks. Understanding these modes is crucial for everything from secure software development and testing to building the complex, cloud-based systems that power the modern internet.
Virtual Networking Fundamentals
Before we dive into the specific modes, it's helpful to understand what a hypervisor (the software that creates and runs VMs, like VirtualBox or VMware) does behind the scenes. When you create a VM, the hypervisor creates virtual hardware for it, including a virtual Network Interface Card (vNIC). This vNIC needs to connect to something, so the hypervisor also creates virtual switches. These software-based switches manage the flow of network traffic between your VMs, your host machine, and the physical network.
The different networking modes we're about to discuss are simply different configurations for how the virtual switch connects the vNIC to your host machine's physical network adapter and the wider world.
For a quick, animated overview of these concepts, please watch this introductory video.
Virtualization: Bridged, NAT, Host-only - Virtual machine connection types
The video 'Virtualization: Bridged, NAT, Host-only' by Sunny Classroom provides a clear, high-level introduction to the three main connection types. It will help you visualize the network paths for each mode.
Watch the video from the beginning to the end (00:00 - 04:56). Pay attention to the simple diagrams that show how the VM connects to the physical network in each mode and where it gets its IP address from.
Now that you have a high-level picture, let's examine each mode in detail.
1. Bridged Mode
Think of Bridged mode as giving your VM a direct connection to your physical network. The hypervisor creates a "bridge" between the VM's vNIC and your host's physical NIC.
- How it works: The VM appears as a separate and distinct device on your local network, just like your phone, your smart TV, or another physical computer.
- IP Addressing: The VM gets its IP address from the same DHCP server that all your other devices use—typically, your home router. Its IP address will be on the same subnet as your host machine (e.g., if your host is
192.168.1.100, your VM might be192.168.1.101). - Connectivity: The VM can communicate with the internet, the host machine, and any other device on the local physical network. Other devices on the network can also initiate connections directly to the VM.
- Use Case: Ideal for running services that need to be accessible on your local network, such as a web server for development, a file server, or a game server.
2. Network Address Translation (NAT) Mode
This mode leverages a concept we've discussed before: Network Address Translation. The host machine acts as a router for the VM, sharing its own network connection and IP address.
- How it works: The hypervisor creates a private virtual network just for the VM. When the VM needs to access the internet, the host machine takes its traffic, translates the VM's private source IP to its own public-facing IP, and sends it out.
- IP Addressing: The hypervisor runs its own internal DHCP server. The VM gets a private IP address on a different subnet from the host's physical network (e.g., your host might be
192.168.1.100on your LAN, while the VM gets an IP like10.0.2.15from the hypervisor). - Connectivity: The VM can access the internet (outbound connections work fine). However, from the perspective of the external network, the VM is "hidden" behind the host. Other devices on your physical network cannot directly initiate connections to the VM without special configuration (like port forwarding).
- Use Case: This is the default and often safest mode. It's perfect when your VM just needs to browse the web, download updates, or act as a client application, without needing to be exposed to the local network.
3. Host-Only Mode
As the name implies, this mode creates a completely isolated network that includes only the host machine and the VMs on that host.
- How it works: The hypervisor creates a virtual network that is not connected to the host's physical network adapter at all. Traffic is contained entirely within the host machine.
- IP Addressing: The hypervisor's internal DHCP server provides IP addresses to the VMs, similar to NAT mode, but there is no gateway to the outside world.
- Connectivity: VMs can communicate with each other and with the host machine. They have no internet access and cannot talk to other devices on the physical LAN.
- Use Case: Perfect for creating an isolated lab environment. For example, you could set up a "hacker" VM and a "victim" VM in Host-Only mode to safely practice the penetration testing techniques we've discussed, without any risk of the malicious traffic escaping onto your real network.
In-Depth Reading and Practical Examples
The concepts are best understood with real-world examples. The following article provides excellent context, especially for scenarios involving security testing, which should feel familiar after our recent lessons.
Understanding VMware Network Adapters | Bridged, NAT, Host-Only...
Let's read 'Understanding VMware Network Adapters' from WebAsha. While it mentions VMware, the concepts are universal to all hypervisors. It provides great IP addressing examples and use cases that tie into security.
Please read the sections titled 'Bridged Mode', 'NAT Mode', and 'Host-Only Mode'. Focus on the IP addressing tables and the 'Real-World Example' and 'When to Use' sub-sections for each mode. The summary table at the very beginning of the article is also a great reference.
Visual Summary and Comparison
To tie everything together, here is a clear diagram illustrating the three modes, followed by a summary table to help you compare them at a glance.

| Feature | Bridged Mode | NAT Mode | Host-Only Mode |
|---|---|---|---|
| VM-to-Internet | Yes | Yes | No |
| VM-to-Host | Yes | Yes | Yes |
| VM-to-LAN Devices | Yes | No (by default) | No |
| LAN Devices-to-VM | Yes | No (by default) | No |
| IP Address Source | Physical LAN DHCP (e.g., your router) | Hypervisor's internal DHCP | Hypervisor's internal DHCP |
| VM IP Subnet | Same as host's physical network | Different from host's physical network | Different from host's physical network |
| Primary Use Case | Network-accessible services (e.g., web server) | Safe, simple internet access (e.g., browsing) | Isolated lab for testing & security |
Conclusion
Today, we've outlined the three fundamental ways a virtual machine can be networked. By choosing the right mode—Bridged, NAT, or Host-Only—you can control your VM's visibility, connectivity, and security posture to suit your specific task. This is a core concept not only for local development but also for understanding how networking is virtualized in massive cloud data centers.
Key Takeaways:
- Bridged Mode: Makes the VM a full peer on your physical network, ideal for hosting services.
- NAT Mode: Hides the VM behind your host's IP, providing simple and secure internet access. This is the "just works" default for client tasks.
- Host-Only Mode: Creates a completely isolated sandbox for the host and VMs, perfect for secure testing labs without internet access.
Preview of the Next Lesson:
We've seen how to connect a single virtual machine. But how do modern, large-scale websites deliver content quickly to millions of users around the globe from potentially just a few server locations? In our next lesson, we will explore Content Delivery Networks (CDNs) and how they solve the challenges of latency and performance on a global scale.