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:
- Master the
ipcommand for interface management. - Create and isolate processes using Network Namespaces.
- Build a Linux Bridge and connect virtual cables (
veth). - Inspect Proxmox's
vmbr0configuration.
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.
-
List all interfaces:
bash ip link show- Question: What is the MTU of your loopback (
lo) interface?
- Question: What is the MTU of your loopback (
-
View IP Addresses:
bash ip addr show- Identify your main IP address and subnet mask (CIDR notation).
-
View the Routing Table:
bash ip route list- Identify the "default IP". This is your gateway.
-
Field Report:
- My Loopback MTU:
[ _____________________________ ] - My Main IP Address:
[ _____________________________ ] - My Gateway IP:
[ _____________________________ ]
- My Loopback MTU:
-
Critical Thinking:
- Why does the loopback interface (
lo) not have a gateway? [ _________________________________________________________________________ ]
- Why does the loopback interface (
Part 2: Building a Virtual Lab (Namespaces)
We will create two "virtual computers" (namespaces) named RED and BLUE on your single VM.
-
Create Namespaces:
bash sudo ip netns add red sudo ip netns add blue -
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!
-
Create a Virtual Cable: Create a
vethpair. Think of this as a patch cable with two ends:veth-redandveth-blue.bash sudo ip link add veth-red type veth peer name veth-blue -
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 -
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
-
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.
-
Field Report:
- Red Namespace IP:
[ _____________________________ ] - Blue Namespace IP:
[ _____________________________ ] - Ping Result (Success/Fail):
[ ___________ ]
- Red Namespace IP:
-
Critical Thinking:
- If you deleted the
rednamespace, what would happen to theveth-redinterface? [ _________________________________________________________________________ ]
- If you deleted the
Part 3: The Linux Bridge
Now let's create a switch (Bridge) to connect multiple things.
-
Create a Bridge:
bash sudo ip link add name br-test type bridge sudo ip link set br-test up -
Inspect it:
bash ip link show br-test -
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).
-
View the Bridge: Run
ip link show vmbr0. This is the main bridge for the university lab. -
View Bridge Members: Install
bridge-utilsif needed (usually pre-installed) or usebridge link.bash bridge link- You should see your physical interface (e.g.,
eno1oreth0) connected tovmbr0. - If you have running VMs, you will see
tapinterfaces (e.g.,tap100i0) also connected. This visualizes that VMs are just "plugged into" the switch!
- You should see your physical interface (e.g.,
-
Field Report:
- Bridge Name:
vmbr0 - Physical Interface Connected:
[ _____________________________ ] - Number of TAP Interfaces:
[ _____________________________ ]
- Bridge Name:
-
Critical Thinking:
- Why must the physical interface (e.g.,
eno1) NOT have an IP address when it is part of a bridge? [ _________________________________________________________________________ ]
- Why must the physical interface (e.g.,
Part 5: Advanced Troubleshooting
In a real environment, you often need to verify if packets are actually flowing.
-
Check IP Forwarding: Check if your kernel is allowed to route packets (act as a gateway).
bash sysctl net.ipv4.ip_forward0= Host only (default).1= Router enabled.
-
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.8from another terminal window. - You should see "Request" and "Reply" packets scrolling in real-time.
- While this is running, ping
Part 6: Introduction to Open vSwitch (OVS)
While Linux Bridges are great, modern clouds use OVS. Let's install it and create a switch.
-
Install OVS:
bash sudo apt update sudo apt install openvswitch-switch -y -
Create an OVS Bridge:
bash sudo ovs-vsctl add-br ovs-lab -
Inspect the Switch:
bash sudo ovs-vsctl show- You should see your Bridge
ovs-lablisted with a Port of the same name.
- You should see your Bridge
-
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
- I can identify my IP and Gateway using
ip addrandip route. - I created two network namespaces and successfully pinged between them.
- I understand that a Linux Bridge acts as a virtual Layer 2 switch.
- I confirmed via CLI that my Proxmox physical
NIC is a "slave" to
vmbr0. - I installed Open vSwitch and created a test bridge.
Instructor Signature: ___ Date: ___