Network modes and snapshots
On this page
Later in this course, you will run programs that are built to be attacked, and you will break the system on purpose. Two questions decide whether that is safe. Who else can reach the VM while it runs? And when something breaks, how do you get the system back exactly as it was?
Your VM already has answers to both, chosen by VirtualBox’s defaults. By the end of this lesson, you can say what the VM can reach in each network mode, check its connection from inside Ubuntu, and undo a change with a snapshot.
Before you start
Section titled “Before you start”- Creating and installing the VM (B02.3). You need the VM
rootvolt-labwith Ubuntu installed and the image removed from its optical drive. - About 20 minutes.
The steps were tested with Oracle VirtualBox 7.2.18 on a Windows host, with Ubuntu 24.04.4 LTS in the VM.
Find the VM’s network setting
Section titled “Find the VM’s network setting”In lesson B02.3, the installer was online without any setup: you chose Use wired connection, and it worked. VirtualBox gave the VM a network card and connected it for you.
To see how, power off the VM, select rootvolt-lab in the VirtualBox Manager, and open Settings, then Network. The page has four tabs, Adapter 1 to Adapter 4: each is one virtual network card. Only Adapter 1 is enabled. Its Attached to field sets the network mode, which decides what the card is connected to.

- The Network page of the VM’s settings.
- Adapter 1, the VM’s only enabled network card.
- Attached to: NAT, the mode VirtualBox chose when it created the VM.
- Port Forwarding, used later in this lesson.
You do not need to change anything here. Close the window with Cancel.
The network modes
Section titled “The network modes”With the VM still powered off, open the settings again and click Attached to to see the list of modes. Look only, then close the window with Cancel.
![The Attached to list open on the Adapter 1 tab, with eight entries: NAT, Bridged Adapter, Internal Network, Host-only Adapter, Generic Driver, NAT Network, Cloud Network [EXPERIMENTAL], and Not attached.](/_astro/b02-4-attached-to-list-shot-02.ZoWwkebi_2uH5Dp.webp)
- NAT, the course default.
- Bridged Adapter.
- Internal Network.
- Host-only Adapter.
- NAT Network.
Five modes matter for this course:
- NAT (Network Address Translation). The manual says a VM with NAT “acts much like a real computer that connects to the Internet through a router”. The router is part of VirtualBox. The VM can go out to the internet, but “the virtual machine is invisible and unreachable from the outside internet”.
- NAT Network. The same idea, but several VMs share one NAT network and can reach each other. You create it first in VirtualBox’s Network Manager.
- Bridged Adapter. VirtualBox connects the VM to one of your host’s real network cards. The manual says it then “looks to the host system as though the guest were physically connected to the interface using a network cable”. The VM joins your home network as another device, next to your phone and your laptop.
- Internal Network. A network “visible to selected virtual machines, but not to applications running on the host or to the outside world”. Only VMs attached to the same internal network, by name, can reach each other.
- Host-only Adapter. A network of the host and its VMs, “without the need for the host’s physical network interface”. The VMs and the host reach each other, but not the outside world.
Not attached keeps a network card in the VM with no connection, “as if no Ethernet cable was plugged into the card”. Generic Driver and Cloud Network are for special setups that this course does not use.
What each mode can reach
Section titled “What each mode can reach”The manual has an overview table of the five modes. Here it is with the endpoints a home user has: the host, which is your computer; another VM on the same host; and your home network, meaning your router and the other devices on it, plus the internet behind it. “Out” means the VM can start a connection to that endpoint; “In” means the endpoint can start one to the VM.
| Mode | Host | Another VM | Home network and internet |
|---|---|---|---|
| NAT | Out; In only by port forwarding | No | Out; In only by port forwarding |
| NAT Network | Out; In only by port forwarding | Yes, on the same NAT network | Out; In only by port forwarding |
| Bridged Adapter | Out and In | Out and In | Out and In |
| Internal Network | No | Yes, on the same internal network | No |
| Host-only Adapter | Out and In | Out and In | No |
Port forwarding is a rule that passes connections arriving at a port on the host to a port in the VM. It is how something outside reaches a NAT VM, one service at a time. Module B14 explains ports.
Read the diagram one row at a time. Only one mode reaches everything both ways: Bridged Adapter. Only two modes cannot reach your home network or the internet at all: Internal Network and Host-only Adapter.
Which mode the course uses
Section titled “Which mode the course uses”NAT is the course default, and it is what your VM has now. The VM can download updates and software, and nothing on your home network can start a connection to it. The manual adds that NAT keeps VMs apart: “by default virtual machines cannot talk to each other”.
Later security labs run a target VM, a system with weaknesses that you practice finding. A weak system must not be reachable from your home network, and it must not reach your home network either. Those labs use Internal Network, when only the VMs need to reach each other, or Host-only Adapter, when the host must reach them too. Each lab says which one, and why.
Bridged Adapter puts the VM on your real home network as another device. Every device there can try to connect to it, and it can reach every device there. The course does not use it. Use it only on a network you control, never with a target VM.
Check the connection from inside Ubuntu
Section titled “Check the connection from inside Ubuntu”Start the VM, log in, and open a terminal. Type these three commands, pressing Enter after each:
ip -br addressip routeping -c 3 example.comip -br addresslists the VM’s network interfaces and their addresses, in a short table (-br, brief).ip routelists the routes: where the system sends traffic for each destination.ping -c 3 example.comsends three test messages (-c 3, count) toexample.com, a website reserved for examples, and waits for each reply.
Module B14 explains these commands in detail. Here, they answer one question: is the VM on the network that NAT promises?
Guess first: your home router has an address on your home network. Will the VM’s route to the internet go through that address?
Run it, then compare with your guess
In the tested VM, the three commands printed:
learner@rootvolt:~$ ip -br addresslo UNKNOWN 127.0.0.1/8 ::1/128enp0s3 UP 10.0.2.15/24 2001:db8::1/64 2001:db8::2/64 fe80::2/64learner@rootvolt:~$ ip routedefault via 10.0.2.2 dev enp0s3 proto dhcp src 10.0.2.15 metric 10010.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15 metric 100learner@rootvolt:~$ ping -c 3 example.comPING example.com (203.0.113.10) 56(84) bytes of data.64 bytes from 203.0.113.10: icmp_seq=1 ttl=64 time=24.7 ms64 bytes from 203.0.113.10: icmp_seq=2 ttl=64 time=28.7 ms64 bytes from 203.0.113.10: icmp_seq=3 ttl=64 time=27.2 ms
--- example.com ping statistics ---3 packets transmitted, 3 received, 0% packet loss, time 2004msrtt min/avg/max/mdev = 24.705/26.858/28.695/1.644 msNo. The route goes through 10.0.2.2, which is not your router. It is VirtualBox’s NAT engine, the router that the manual describes, and VirtualBox passes the traffic on through your host.
Some values in this output were changed before publishing. Every other character is as the tested VM printed it:
- On the
enp0s3line, the three IPv6 addresses (the longer addresses with colons) are replaced with the example addresses2001:db8::1/64,2001:db8::2/64, andfe80::2/64, because part of them is made from the network card’s MAC address. This lesson uses only the IPv4 address before them. - In the
pinglines,example.com’s real address is replaced with the documentation address203.0.113.10, on the first line and in each reply line. Your output shows the real one.
Read the output line by line
Section titled “Read the output line by line”lo is the loopback interface: the system’s connection to itself. Its address 127.0.0.1 always means “this computer”. Its state is UNKNOWN, which is normal for loopback; Ubuntu’s own documentation shows the same.
enp0s3 is the VM’s network card, Adapter 1 from the settings. Ubuntu’s documentation says Ethernet cards get “predictable network interface names”, such as enp0s3 here. The state UP means the card is working and connected.
10.0.2.15/24 is the VM’s address. The manual says that with one NAT card, “the guest is assigned to the address 10.0.2.15, the gateway is set to 10.0.2.2 and the name server can be found at 10.0.2.3”. So your VM has the same address as the tested one, and so does every other VirtualBox VM using NAT. The /24 means the first three numbers name the network: 10.0.2.0/24 is every address from 10.0.2.0 to 10.0.2.255. This private network exists only inside VirtualBox, which is why devices on your home network cannot see the VM.
default via 10.0.2.2 is the default route: traffic for any address not covered by another route goes to 10.0.2.2, the gateway. proto dhcp means the VM received this route automatically, from the DHCP server built into VirtualBox. The second route says that addresses in 10.0.2.0/24 are reached directly through enp0s3.
The ping lines. Each 64 bytes from 203.0.113.10 line is one reply from example.com’s address. time=24.7 ms is the round trip in milliseconds; the three replies took between 24.7 and 28.7 ms, and yours will differ. ttl=64 is the reply’s time to live, a limit on how many routers it may pass; you can ignore it here. The summary shows 3 packets transmitted, 3 received, 0% packet loss: the VM reached the internet. The manual notes that VirtualBox’s NAT has limits for some network tools, but “ping should work”.
Snapshots
Section titled “Snapshots”A snapshot saves the VM’s state so you can return to it later. Lesson B02.1 introduced the idea; now you take one.
The manual describes what a snapshot holds:
- A copy of the VM’s settings. When you restore the snapshot, “the VM settings are restored as well”.
- The state of the virtual disks. Restoring means “Files that were since created will disappear, files that were deleted will be restored, changes to files will be reverted.”
- If the VM was running, also its memory.
A snapshot is not a backup. When you take a snapshot, VirtualBox does not copy the disk. It keeps the disk as it is and writes later changes to a separate file, a differencing image, in a Snapshots folder inside the VM folder. The snapshot needs the original disk file, and both sit in D:\VMs\rootvolt-lab. If that folder is deleted, or the host’s drive fails, the snapshots are gone with it. A backup is a copy kept somewhere else.
Take the clean-install snapshot
Section titled “Take the clean-install snapshot”Your VM is freshly installed and works. That is the state to keep: if a later lesson goes wrong, you can return to it. The course names it clean-install.
- Power off the VM. In Ubuntu, open the menu at the top right and choose Power Off. A snapshot of a running VM also stores its memory, which the manual says “can be as large as the memory size of the VM”, here 4 GB. A snapshot of the powered-off VM has no memory file, and restoring it gives you a powered-off VM.
- In the VirtualBox Manager, select
rootvolt-laband click Snapshots. The list holds one item, Current State: “the current point in the lifetime of the virtual machine”. - Click Take in the Snapshots toolbar, or right-click Current State and choose Take.
- In the Take Snapshot of Virtual Machine window, set Snapshot Name to
clean-install. In Snapshot Description, write what the state is, so you still know in a month. - Click Ok.

- Snapshot Name:
clean-install. - Snapshot Description: in the tested VM,
Fresh Ubuntu 24.04 install, before any lessons. - Ok takes the snapshot.
The snapshot appears in the list, with Current State below it. The manual explains the order: the current state “is a variation based on the snapshot you took earlier”.

- Snapshots, the view that lists the VM’s snapshots.
- The snapshot to keep:
clean-install. - Current State: the VM as it is now. In the tested VM, it reads Current State (changed).
To the right of the names, outside this cropped view, the Taken column shows when each snapshot was made; in the tested VM, 11/2/2026 4:20 AM (50 seconds ago).
Make a disposable change
Section titled “Make a disposable change”To test the snapshot, change something you can see, then undo it. Start the VM, log in, open a terminal, and type:
echo "This file should disappear" > ~/snapshot-test.txtls ~echo prints its text, and > sends that text into a file instead of the screen, creating snapshot-test.txt in your home directory, ~. Module B09 explains >. Then ls ~ lists your home directory. In the tested VM:
learner@rootvolt:~/Desktop$ echo "This file should disappear" > ~/snapshot-test.txtlearner@rootvolt:~/Desktop$ ls ~Desktop Downloads Pictures snap TemplatesDocuments Music Public snapshot-test.txt VideosThe file is there, next to the folders Ubuntu created. The prompt shows ~/Desktop because this terminal was opened from the desktop; the commands use ~, so they work the same from any folder. Power off the VM again, from Ubuntu’s menu.
Restore the snapshot
Section titled “Restore the snapshot”In Snapshots, select clean-install and click Restore in the toolbar. VirtualBox asks for confirmation:

- The snapshot it restores: check that it says
clean-install. - Create a snapshot of the current machine state: ticked when the window opened in testing. Untick it.
- Restore, after you have checked 1 and 2.
The box offers to save the current state as another snapshot before it is replaced. That is useful when the current state holds work you may want back; the manual says, “To avoid losing the current state when restoring a snapshot, you can create a new snapshot before the restore operation.” Here, the current state holds only the test file, which you want gone. A saved copy of it would be one more snapshot in the list, taking disk space and inviting you to restore the wrong one later. So untick the box, then click Restore.
Guess first: start the VM and run ls ~ again. Is snapshot-test.txt there?
Run it, then compare with your guess
In the tested VM:
learner@rootvolt:~/Desktop$ ls ~Desktop Documents Downloads Music Pictures Public snap Templates VideosThe file is gone. The VM’s disk is back to the moment you took clean-install, when the file did not exist yet. With one name fewer, ls fits all the names on one line.
Mistakes to recognize
Section titled “Mistakes to recognize”No internet on an Internal Network. You attached the VM to Internal Network, and nothing online works: updates and ping to a website fail. This is the mode working as designed; an internal network has no route to the outside. VirtualBox shows no error for it, so check Settings, Network, Attached to first. For lessons that need the internet, use NAT.
The host cannot reach a service in a NAT guest. You start a service in the VM, and the host cannot connect to it. The manual explains: “network services on the guest are not accessible to the host machine or to other computers on the same network”. The fix is a port forwarding rule, set with the Port Forwarding button on the adapter’s page. Module B14 explains ports and remote connections.
Restoring the wrong snapshot. With several snapshots, you restore an older one by mistake, and newer work disappears. The manual is plain: “The current state of the machine is lost.” Read the name in the confirmation before you click Restore: in testing, it said You are about to restore snapshot clean-install. If the current state holds anything you want to keep, leave Create a snapshot of the current machine state ticked.
The VM folder keeps growing. Each snapshot’s differencing image starts empty, and the manual says, “The longer you use the machine after having created the snapshot, however, the more the differencing image will grow in size.” Snapshots of a running VM add a memory file as well. To free space, select a snapshot you no longer need and click Delete. This “does not affect the state of the virtual machine”, but it “can take a considerable amount of time”.
Good to know
Section titled “Good to know”Snapshots include the settings. A restore also undoes changes to memory, processors, or the network mode made after the snapshot. Try it yourself, below, uses this.
Host-only on a Mac. On macOS hosts, the manual says to choose Host-Only Network instead: “The Host-Only Adapter option is provided for legacy support.”
Snapshots tree. If you restore an older snapshot and take new ones from there, the list becomes a tree with branches. The course keeps one line: clean-install, then the snapshots each lab asks for.
Security Angle
Section titled “Security Angle”A target VM in a security lab is weak on purpose. On a Bridged Adapter, it is a weak device on your home network, next to your family’s laptops and phones, and a program attacking it can reach them as well. On an Internal Network, the manual says the network is not visible “to applications running on the host or to the outside world”: the target and the attacking VM reach each other and nothing else. That is the setup the security labs use, together with a snapshot taken before each lab, so that whatever the lab changes in the target is removed by one restore.
Try it yourself
Section titled “Try it yourself”Goal: Show that a snapshot restores the VM’s settings, not only its files.
- Power off the VM. In Snapshots, take a snapshot named
before-network-test. - In Settings, Network, set Attached to to Not attached and click OK.
- Start the VM, open a terminal, and run
ping -c 3 example.com. Then power off. - Restore
before-network-test, with Create a snapshot of the current machine state unticked. - Open Settings, Network and read Attached to.
- Delete
before-network-test: select it in Snapshots and click Delete.
Expected: In step 3, ping fails and prints an error instead of replies. The exact message may differ. In step 5, Attached to is NAT again. After step 6, only clean-install remains.
Hint
The manual says a snapshot holds “a complete copy of the VM settings, including the hardware configuration”. Which settings were in place when you took before-network-test?
Solution
Not attached leaves the network card without a connection, so the VM has no network, and ping fails with an error instead of replies. The exact message may differ. The snapshot was taken while the adapter was attached to NAT, and a restore brings back the settings as well as the disk, so Attached to shows NAT again.
Deleting before-network-test does not change the VM; it only removes the stored snapshot. clean-install stays as your way back to the fresh installation.
- Attached to, in the VM’s Settings, Network, sets the network mode for each adapter. The course uses NAT: the VM reaches the internet, and nothing outside reaches it without port forwarding.
- Internal Network and Host-only Adapter keep a VM away from your home network; later security labs use them. Bridged Adapter puts the VM on your home network as another device.
- In the VM,
ip -br addressshowsenp0s3UPwith10.0.2.15/24,ip routeshows the default route via10.0.2.2, andpingconfirms the internet connection. - A snapshot saves the disks and settings so you can return to them; it is not a backup.
clean-installis the course’s way back to a fresh system. Restoring it removedsnapshot-test.txt.
Next, in Practice: Building Your Lab, you use everything from this module in one task.
Further reading
Section titled “Further reading”All sources were checked on 2 November 2026, for VirtualBox 7.2. The steps were tested with VirtualBox 7.2.18.
- Oracle VirtualBox User Guide, release 7.2: Virtual Networking, with the network modes, the overview table, port forwarding, the NAT addresses
10.0.2.15and10.0.2.2, and the NAT limitations; Working with Virtual Machines, on taking, restoring, and deleting snapshots and on what a snapshot contains; Technical Background, on theSnapshotssubfolder of the VM folder; and Virtual Storage, on differencing images. - Ubuntu Server documentation: Configuring networks, on interface names, the loopback interface, and the default gateway.
- Ubuntu manual pages: ip(8), with
-brief; ip-address(8); ip-route(8); and ping(8).