Linux Networking Lab · Xubuntu · VirtualBox

```
Linux Networking Lab · Xubuntu · VirtualBox

Terminal Networking with Xubuntu in VirtualBox

A hands-on networking tutorial for a Xubuntu virtual machine running inside VirtualBox on a Windows 11 host. Learn interfaces, IP addressing, routing, DHCP, DNS, ARP, sockets, HTTP, network paths and packet capture almost entirely from the Linux terminal.

Xubuntu VM Windows 11 Host VirtualBox ip + nmcli curl tcpdump
Internet external networks
→
Windows 11 physical host
→
VirtualBox virtual network
→
Xubuntu VM Linux guest
```
01

Understand the VirtualBox Network

Before touching Linux commands, understand where your Xubuntu VM sits. VirtualBox creates a virtual network adapter that Xubuntu treats much like a physical Ethernet interface.

Mode Internet VM → Windows Windows → VM Best Use
NAT Yes Yes Not directly General Internet access
Bridged Yes Yes Yes VM acts like another LAN computer
Host-only Usually no Yes Yes Isolated host/VM lab
Internal Network No No Other VMs Multi-VM networking labs
Recommended starting point Begin with NAT. It provides Internet access while keeping the VM behind VirtualBox's virtual NAT router. Later, switch to Bridged, Host-only and Internal Network modes to explore other network designs.
02

Inspect Interfaces and IP Addresses

Open Xubuntu Terminal with Ctrl + Alt + T. Your first job is to discover which interfaces Linux knows about.

xubuntu — terminal
$ ip link

$ ip addr

# shorthand $ ip a

# show assigned host addresses $ hostname -I

You will normally see lo, the loopback interface, and an Ethernet interface such as enp0s3. Your exact interface name may differ.

1: lo: <LOOPBACK,UP,LOWER_UP>
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP>
    inet 10.0.2.15/24
Lab habit Do not copy an example IP address blindly. Always discover the actual interface name and address assigned to your VM.
03

Read the Routing Table

An IP address tells you who the machine is on a network. The routing table tells Linux where packets should go.

$ ip route

A typical VirtualBox NAT configuration may resemble:

default via 10.0.2.2 dev enp0s3
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15

The default route is used when Linux does not have a more specific route for the destination.

# show only the default route
$ ip route show default

# ask Linux how it would reach this address $ ip route get 8.8.8.8
04

Test Connectivity Layer by Layer

Good troubleshooting moves outward from the local machine instead of randomly changing settings.

  1. Test the local TCP/IP stack.
  2. Test the VM's own interface address.
  3. Test the default gateway.
  4. Test an Internet IP address without depending on DNS.
  5. Finally, test a hostname to verify DNS resolution.
# 1 — loopback
$ ping -c 4 127.0.0.1

# 2 — your own IP; substitute the real address $ ping -c 4 10.0.2.15

# 3 — discover the gateway first $ ip route show default

# then test it; example only $ ping -c 4 10.0.2.2

# 4 — Internet without DNS $ ping -c 4 1.1.1.1

# 5 — Internet plus DNS $ ping -c 4 example.com
Troubleshooting clue If an Internet IP such as 1.1.1.1 works but a hostname does not, basic routing is probably functioning. DNS becomes the next subsystem to inspect.
05

Investigate DNS

DNS translates names such as example.com into IP addresses. Xubuntu normally integrates DNS configuration with NetworkManager and the system resolver.

$ cat /etc/resolv.conf

$ resolvectl status

$ resolvectl query example.com

Install dig

$ sudo apt update
$ sudo apt install dnsutils

$ dig example.com

# query a specific resolver $ dig @1.1.1.1 example.com

# compact result $ dig +short example.com
06

Control NetworkManager from the Terminal

Xubuntu normally uses NetworkManager. Its command-line client, nmcli, lets you inspect and control networking without opening the graphical settings application.

$ nmcli

$ nmcli general status

$ nmcli device status

$ nmcli device show enp0s3

$ nmcli connection show

$ nmcli connection show --active

Disconnect and reconnect

$ sudo nmcli device disconnect enp0s3

$ nmcli device status $ ip a

$ sudo nmcli device connect enp0s3

$ ip a $ ip route
Important Replace enp0s3 with your actual interface name before running interface-specific commands.
07

Inspect DHCP Configuration

VirtualBox NAT normally supplies network configuration automatically. NetworkManager represents automatic IPv4 configuration with ipv4.method auto.

$ nmcli connection show

# example connection name $ nmcli connection show "Wired connection 1"

# display IPv4 information for the interface $ nmcli -f IP4 device show enp0s3
What DHCP gives you Automatic configuration can provide the VM with an IP address, subnet information, default gateway and DNS information.
08

Explore ARP and the Neighbor Table

On an IPv4 Ethernet network, Linux maintains neighbor information that maps reachable local IP addresses to Layer 2 MAC addresses.

$ ip neigh

You may see an entry similar to:

10.0.2.2 dev enp0s3 lladdr 52:54:00:12:35:02 REACHABLE

Generate traffic and inspect the table again:

$ ping -c 1 10.0.2.2
$ ip neigh

# monitor changes live $ ip monitor neigh

Press Ctrl+C to stop a live monitor.

09

Find the Virtual NIC's MAC Address

$ ip link show enp0s3

Look for link/ether:

link/ether 08:00:27:12:34:56

You can compare the information with NetworkManager:

$ nmcli device show enp0s3
Virtualization concept The adapter is virtual hardware supplied by VirtualBox, but Xubuntu interacts with it through the normal Linux networking stack.
10

Inspect Listening Ports and Connections

IP addresses identify hosts. TCP and UDP ports help identify network services running on those hosts.

# TCP + UDP listening sockets
$ ss -tuln

# include process information $ sudo ss -tulpn

# current TCP connections $ ss -tn
```
-t

TCP

Display TCP sockets.

-u

UDP

Display UDP sockets.

-l

Listening

Show services waiting for connections.

-n

Numeric

Show numeric addresses and ports.

```
11

Build a Temporary Web Server

One of the easiest ways to understand client/server networking is to become the server.

$ mkdir -p ~/network-lab
$ cd ~/network-lab

$ echo "Hello from my Xubuntu VM" > index.html

$ python3 -m http.server 8000

The server should report that it is listening on port 8000.

Open another Xubuntu terminal:

$ ss -ltn

$ curl http://127.0.0.1:8000

Expected page content:

Hello from my Xubuntu VM
What just happened? Python became a server listening on TCP port 8000. curl became the client. Both communicated through the Linux networking stack.

Return to the server terminal and press Ctrl+C when finished.

12

Explore HTTP with curl

# fetch a page
$ curl https://example.com

# headers only $ curl -I https://example.com

# verbose connection details $ curl -v https://example.com

# save output to a file $ curl -o page.html https://example.com

$ ls -lh page.html
Watch the layers Verbose curl output is useful because you can observe parts of the process behind a web request: name resolution, connection establishment, TLS and the HTTP exchange.
13

Trace a Network Path

$ sudo apt install traceroute

$ traceroute example.com

# alternative $ tracepath example.com
Do not over-interpret asterisks A router may refuse to return the responses used by traceroute while still forwarding ordinary application traffic. Asterisks do not automatically prove that the path is broken.
14

Experiment with Bridged Networking

Bridged networking lets you compare VirtualBox NAT with a VM that behaves more like another computer connected directly to the physical LAN.

First shut down Xubuntu:

$ sudo poweroff

In VirtualBox on Windows 11, open the VM's network settings and change the adapter from NAT to Bridged Adapter. Start Xubuntu again.

$ ip a
$ ip route

Compare the new configuration with the values you recorded while using VirtualBox NAT. The VM may now receive an address belonging to the same physical LAN as the Windows host.

inet 192.168.1.73/24

Compare NAT and Bridged mode

$ hostname -I
$ ip route
$ ip neigh
$ resolvectl status
Environment matters Bridged networking can depend on the physical network and its policies. Corporate, campus, hotel and some Wi-Fi networks may restrict or complicate bridged guests.
15

Capture Packets with tcpdump

Packet capture connects terminal commands with the packets actually moving through the interface.

$ sudo apt install tcpdump

# list capture interfaces $ sudo tcpdump -D

# capture traffic on the VM interface $ sudo tcpdump -i enp0s3

Capture ICMP

$ sudo tcpdump -i enp0s3 icmp

In another terminal:

$ ping example.com

Capture DNS

$ sudo tcpdump -i enp0s3 port 53

Generate a lookup:

$ dig example.com

Capture HTTP traffic from the local test server

Start the Python server in one terminal:

$ cd ~/network-lab
$ python3 -m http.server 8000

Then inspect traffic associated with TCP port 8000:

$ sudo tcpdump -i any port 8000

Generate a request from another terminal:

$ curl http://127.0.0.1:8000
Lab challenge Keep tcpdump running in one terminal while you generate traffic from another. Try to identify request and response pairs rather than treating the capture as random scrolling text.
16

A Repeatable Troubleshooting Workflow

When networking breaks, gather evidence before changing configuration. Work from the local interface outward.

# 1. Does Linux see the interface?
$ ip link

# 2. Does it have an IP address? $ ip addr

# 3. What does NetworkManager think? $ nmcli device status

# 4. Is there a default route? $ ip route

# 5. Does localhost work? $ ping -c 2 127.0.0.1

# 6. Discover and test the real gateway $ ip route show default

# 7. Can we reach an Internet IP? $ ping -c 2 1.1.1.1

# 8. Does DNS work? $ resolvectl query example.com

# 9. Does HTTPS work? $ curl -I https://example.com

# 10. What services are listening? $ sudo ss -tulpn
Do not assume the gateway 10.0.2.2 is a common VirtualBox NAT example, not a universal value. Use ip route show default to discover the gateway actually assigned to your VM.
17

Networking Commands Worth Memorizing

ip addr

Addresses

Inspect interface IP configuration.

ip link

Interfaces

Inspect Layer 2 interfaces and state.

ip route

Routing

Inspect where packets will be sent.

ip neigh

Neighbors

Inspect local IP-to-MAC mappings.

ping

Reachability

Generate ICMP echo traffic.

ss

Sockets

Inspect ports and connections.

nmcli

NetworkManager

Inspect and control network configuration.

resolvectl

Resolver

Inspect and query DNS resolution.

dig

DNS

Perform detailed DNS queries.

curl

Application Test

Test HTTP and HTTPS from the shell.

traceroute

Path

Explore hops toward a destination.

tcpdump

Packets

Capture traffic from an interface.

A useful five-command snapshot is:

$ ip a
$ ip route
$ nmcli device status
$ resolvectl status
$ sudo ss -tulpn
Five questions What interfaces exist? What addresses do I have? Where will packets go? How is name resolution configured? Which services are listening?
18

Where to Go Next

Once the commands make sense individually, combine them into complete labs.

  1. NAT lab: identify the VM address, subnet, gateway and DNS configuration, then verify Internet connectivity.
  2. Packet lab: run tcpdump while generating traffic with ping, dig and curl.
  3. Server lab: run python3 -m http.server 8000 and inspect its socket with ss.
  4. Bridged lab: place Xubuntu directly on the LAN and compare its IP address, routes, DNS configuration and neighbor table with NAT mode.
  5. Host-only lab: create an isolated network between Windows and the Xubuntu VM and compare its routes with NAT and Bridged configurations.
  6. Two-VM lab: create another Xubuntu VM and connect both through a VirtualBox Internal Network.
Best next project The two-VM lab is where many networking concepts come together. You can practice addressing, ARP, ICMP, routing, TCP/UDP, ports, client/server communication and packet capture without changing the physical Windows network.
XUBUNTU NETWORKING LAB · VIRTUALBOX · WINDOWS 11 · TERMINAL EDITION