Sub topic 10
Practicing networking tasks
This chapter assumes you have a working virtual machine lab with one Windows and one Linux guest, as built in the previous chapter. It also assumes you know the basics of IP addresses, subnet masks, gateways, and DNS. The goal is to turn those definitions into habits you can use on exam questions.
Why lab networking matters for the exam
The A+ objectives ask you to configure and troubleshoot small networks, not to design large ones. Questions often give you a symptom, such as "the user can reach the file server but not websites." Then they ask you to pick the next step. You answer these faster when you have caused and fixed the same fault yourself.
Networking practice has three parts:
- Choose a virtual network mode that matches the task.
- Configure addressing by hand and by DHCP.
- Break something on purpose, then diagnose it with command-line tools.
Choosing a virtual network mode
VirtualBox gives each virtual network adapter a mode. The mode decides what the guest can reach.
| Mode | Guest can reach the internet | Guests can reach each other | Best use |
|---|---|---|---|
| NAT | Yes | No | Updates and web access |
| Bridged | Yes, as its own device on your LAN | Yes | Acting like a real PC on your router |
| Host-only | No | Yes, plus the host | Isolated host-to-guest tests |
| Internal network | No | Yes, only guests on the same name | Fully isolated multi-guest practice |
In NAT mode the hypervisor (the program that runs virtual machines) acts as a router and DHCP server. By default, the guest gets an address like 10.0.2.15 and a gateway of 10.0.2.2.
A good setup gives each guest two adapters. Adapter 1 uses NAT so the guest can get updates. Adapter 2 joins an internal network where you can practice static addressing without touching your home network.
Run this with the VM powered off:
VBoxManage modifyvm "APlus-Win11" --nic1 nat
VBoxManage modifyvm "APlus-Win11" --nic2 intnet --intnet2 labnetRepeat the second command for your Linux guest with its own VM name. Use the same labnet name so the two guests share a network.
Addressing practice
Practice both ways of getting an address, because the exam tests the difference.
- DHCP (Dynamic Host Configuration Protocol) assigns an address, mask, gateway, and DNS server automatically. The NAT adapter works this way.
- Static addressing means you type those values yourself. Use it on the internal adapter.
On the Windows guest, run an elevated prompt and set a static address on the second adapter. Check the adapter's actual name first with ipconfig, since it may be "Ethernet 2".
netsh interface ip set address name="Ethernet 2" static 192.168.100.10 255.255.255.0On the Linux guest, assign a matching address in the same subnet. Replace enp0s8 with your second interface name from ip addr show.
sudo ip addr add 192.168.100.20/24 dev enp0s8
sudo ip link set enp0s8 up
ping -c 4 192.168.100.10Windows Defender Firewall blocks incoming ping by default. If the ping fails, enable the "File and Printer Sharing (Echo Request - ICMPv4-In)" rule. That is a useful lesson in itself, because a failed ping does not always mean a broken network.
To return the Windows adapter to automatic addressing, run:
netsh interface ip set address name="Ethernet 2" dhcpThen try giving the two guests addresses in different subnets, such as 192.168.100.10 and 192.168.200.20, both with mask 255.255.255.0. Ping fails because neither guest has a route to the other's subnet. Seeing this once makes subnet-mask questions much easier.
Following the path from the inside out
Check the network in the same order the traffic travels. If an early step fails, later steps cannot succeed, so you do not waste time on them.
The Windows version of this sequence is:
ipconfig /all
ping 127.0.0.1
ping 10.0.2.2
nslookup example.com
tracert example.comHere is what each command tells you:
ipconfig /allshows the address, mask, gateway, DNS servers, and whether DHCP is on. An address starting with 169.254 means the guest asked for DHCP and got no answer.ping 127.0.0.1tests the local TCP/IP stack. A failure here points to the guest itself, not the network.ping 10.0.2.2tests the gateway. Use your own gateway address fromipconfig.nslookup example.comtests name resolution separately from connectivity.tracert example.comlists each router on the way. The last hop that answers shows where the path stops.
The Linux equivalent uses different tools:
ip addr show
ip route show
ping -c 4 10.0.2.2
resolvectl statusip route show should include a line starting with default via. If it does not, the guest has no gateway and cannot leave its own subnet.
Testing ports and services
Connectivity to a host does not prove a service is reachable. A firewall can allow ping but block a port. Practice testing a TCP port directly. On Windows:
Test-NetConnection -ComputerName example.com -Port 443On Linux, list the ports the guest is listening on:
ss -tulnLearn the common ports by testing them: 53 (DNS), 80 (HTTP), 443 (HTTPS), 22 (SSH), 3389 (RDP). Port-to-protocol matching is a frequent exam item.
Breaking things on purpose
Fault injection is the most valuable lab activity. Have a study partner break the lab, or write a fault down in a note and forget the detail. Then diagnose it with only the commands above. Try these faults one at a time:
- Set a wrong gateway address on the static adapter.
- Set the DNS server to an unused address such as 10.0.2.99.
- Disable the adapter in the hypervisor settings by clearing "Cable Connected."
- Set the wrong subnet mask.
- Block ping with the firewall on the target.
For each fault, record the symptom, the command that exposed it, and the fix. A wrong DNS server is the classic case. Pinging an IP address works, pinging a name fails, and nslookup times out. That pattern should now feel familiar.
Common mistakes
- Testing the wrong adapter. A guest with two adapters can have a working NAT adapter and a broken internal one. Read
ipconfig /allcarefully. - Treating a failed ping as proof of a dead link. Firewalls often block ICMP.
- Changing several settings at once. You then cannot tell which change fixed the problem.
- Forgetting to power off the VM before running
VBoxManage modifyvm.
Exercise
A Windows guest has the address 169.254.17.32. It can ping 127.0.0.1 but nothing else. What is the most likely cause, and what is the first thing you check?
Show answer
The guest asked for an address by DHCP and received no reply, so Windows assigned itself an automatic private address. Check that the adapter is connected to the correct virtual network and that a DHCP server is available there. On the internal network no DHCP server exists, so either assign a static address or run ipconfig /renew on an adapter that has DHCP, such as the NAT adapter.
Exercise
From a Linux guest, ping 93.184.216.34 succeeds but ping example.com fails. Which layer is broken, and which command shows the DNS servers in use?
Show answer
Name resolution is broken, not connectivity, because the IP address is reachable. Run resolvectl status to see the DNS servers, then correct the DNS setting. You can confirm with nslookup example.com.