← Back to Course Index

Lab Icon Week 3 - Lab 1: Linux Networking Fundamentals

Module: Operating Systems 3 (Virtualisation & Cloud Technologies)

Topic: IP Command, Namespaces, and Bridges
Estimated Time: 60 Minutes


Lab Overview

In this lab, you will perform the fundamental networking operations manually. You will create a virtual network from scratch using the Linux command line. You will then inspect how Proxmox handles networking.

Objectives:

  1. Master the ip command for interface management.
  2. Create and isolate processes using Network Namespaces.
  3. Build a Linux Bridge and connect virtual cables (veth).
  4. Inspect Proxmox's vmbr0 configuration.

Prerequisites: - Access to your Ubuntu Server VM (for Parts 1-3). - Use sudo for all networking commands.


Part 1: The New Standard (ip)

Move away from ifconfig. Perform these tasks on your Ubuntu VM.

  1. List all interfaces: bash ip link show

    • Question: What is the MTU of your loopback (lo) interface?
  2. View IP Addresses: bash ip addr show

    • Identify your main IP address and subnet mask (CIDR notation).
  3. View the Routing Table: bash ip route list

    • Identify the "default IP". This is your gateway.
  4. Field Report:

    • My Loopback MTU: [ _____________________________ ]
    • My Main IP Address: [ _____________________________ ]
    • My Gateway IP: [ _____________________________ ]
  5. Critical Thinking:

    • Why does the loopback interface (lo) not have a gateway?
    • [ _________________________________________________________________________ ]

Part 2: Building a Virtual Lab (Namespaces)

We will create two "virtual computers" (namespaces) named RED and BLUE on your single VM.

  1. Create Namespaces: bash sudo ip netns add red sudo ip netns add blue

  2. Verify Isolation: Run a command inside the RED namespace. bash sudo ip netns exec red ip link show

    • Observation: You only see the loopback interface. It isolated!
  3. Create a Virtual Cable: Create a veth pair. Think of this as a patch cable with two ends: veth-red and veth-blue. bash sudo ip link add veth-red type veth peer name veth-blue

  4. Connect the Cables: Plug one end into RED and the other into BLUE. bash sudo ip link set veth-red netns red sudo ip link set veth-blue netns blue

  5. Configure IPs: Now assign IPs to these interfaces inside their namespaces.

# Configure RED (10.0.0.1)
sudo ip netns exec red ip addr add 10.0.0.1/24 dev veth-red
sudo ip netns exec red ip link set veth-red up

# Configure BLUE (10.0.0.2)
sudo ip netns exec blue ip addr add 10.0.0.2/24 dev veth-blue
sudo ip netns exec blue ip link set veth-blue up
  1. Test Connectivity: Ping BLUE from RED. bash sudo ip netns exec red ping -c 3 10.0.0.2

    • Success! You created a private network between two isolated environments.
  2. Field Report:

    • Red Namespace IP: [ _____________________________ ]
    • Blue Namespace IP: [ _____________________________ ]
    • Ping Result (Success/Fail): [ ___________ ]
  3. Critical Thinking:

    • If you deleted the red namespace, what would happen to the veth-red interface?
    • [ _________________________________________________________________________ ]

Part 3: The Linux Bridge

Now let's create a switch (Bridge) to connect multiple things.

  1. Create a Bridge: bash sudo ip link add name br-test type bridge sudo ip link set br-test up

  2. Inspect it: bash ip link show br-test

  3. Clean Up (Optional but Recommended): Since we are done with the experimental namespaces: bash sudo ip netns delete red sudo ip netns delete blue sudo ip link delete br-test


Part 4: Inspecting Proxmox Networking

Log in to the Proxmox Web GUI and then access the Shell of the Node (pve1).

  1. View the Bridge: Run ip link show vmbr0. This is the main bridge for the university lab.

  2. View Bridge Members: Install bridge-utils if needed (usually pre-installed) or use bridge link. bash bridge link

    • You should see your physical interface (e.g., eno1 or eth0) connected to vmbr0.
    • If you have running VMs, you will see tap interfaces (e.g., tap100i0) also connected. This visualizes that VMs are just "plugged into" the switch!
  3. Field Report:

    • Bridge Name: vmbr0
    • Physical Interface Connected: [ _____________________________ ]
    • Number of TAP Interfaces: [ _____________________________ ]
  4. Critical Thinking:

    • Why must the physical interface (e.g., eno1) NOT have an IP address when it is part of a bridge?
    • [ _________________________________________________________________________ ]

Part 5: Advanced Troubleshooting

In a real environment, you often need to verify if packets are actually flowing.

  1. Check IP Forwarding: Check if your kernel is allowed to route packets (act as a gateway). bash sysctl net.ipv4.ip_forward

    • 0 = Host only (default).
    • 1 = Router enabled.
  2. Inspect Traffic with tcpdump: Warning: This can generate a lot of output. Listen for ICMP (ping) packets on your main interface. bash sudo tcpdump -i eno1 icmp

    • While this is running, ping 8.8.8.8 from another terminal window.
    • You should see "Request" and "Reply" packets scrolling in real-time.

Part 6: Introduction to Open vSwitch (OVS)

While Linux Bridges are great, modern clouds use OVS. Let's install it and create a switch.

  1. Install OVS: bash sudo apt update sudo apt install openvswitch-switch -y

  2. Create an OVS Bridge: bash sudo ovs-vsctl add-br ovs-lab

  3. Inspect the Switch: bash sudo ovs-vsctl show

    • You should see your Bridge ovs-lab listed with a Port of the same name.
  4. Add a Fake Port: To see how it looks populated: bash sudo ip link add type veth sudo ovs-vsctl add-port ovs-lab veth0 sudo ovs-vsctl show


Lab Checkpoint


Instructor Signature: ___ Date: ___

← Back to Course Index