Exercise: Creating a Virtual Network with VLANs
Hands-On Network Segmentation
1 Purpose
This exercise provides a practical, hands-on application of network segmentation using VLANs. While we cannot create VLANs on a physical switch in this environment, we can simulate the same behavior within our Fedora VM. You will use the powerful nmcli (NetworkManager Command-Line Interface) tool to create virtual interfaces and assign them to different VLANs, demonstrating how traffic can be logically separated on the same physical device.
2 What You’ll Accomplish
By the end of this exercise, you will be able to:
- Use
nmclito view network connections. - Create a new virtual bridge interface.
- Create new VLAN interfaces tagged to the bridge.
- Assign static IP addresses to your VLAN interfaces.
- Verify that devices on different VLANs cannot communicate directly.
This exercise maps to the following program and course learning outcomes:
- Program Learning Outcomes (PLOs):
- 3. Apply terminology and numeric or system concepts: This exercise requires the direct application of VLAN tagging, IP addressing, and network interface configuration.
- Course Learning Outcomes (CLOs):
- 4. Configure hardware and basic network components: You will be directly configuring virtual network interfaces, which mirrors the process used on physical enterprise hardware.
This exercise develops the following skills, which align with the O*NET SOC Code 15-1232.00 for Computer User Support Specialists.
| Learning Objective | O*NET KSAs | Technologies Used |
|---|---|---|
| Create and configure VLAN interfaces in Linux. | Knowledge: Telecommunications, Computers & Electronics Skills: Systems Analysis |
nmcli, VLANs |
| Assign static IP addresses to interfaces. | Knowledge: Telecommunications Abilities: Information Ordering, Deductive Reasoning |
IP Addressing |
3 Prerequisites
This exercise requires a running Fedora 42 virtual machine with internet access and a user account with sudo privileges.
4 Step-by-Step Guide
Open a terminal window in your Fedora VM to begin.
4.1 Step 1: Explore nmcli
First, take a look at your existing connections with nmcli.
Run the following command to see your connection profiles:
nmcli connection showYou will see the profile for your main Ethernet connection.
Run this command to see the status of your devices:
nmcli device status
4.2 Step 2: Create a Network Bridge
A bridge is a virtual switch that we can connect other interfaces to.
Create a bridge named
br10:nmcli connection add type bridge con-name br10 ifname br10Bring the bridge interface up:
nmcli connection up br10
4.3 Step 3: Create VLAN Interfaces
Now, you will create two VLAN interfaces. Imagine these are for two different departments: Sales (VLAN 101) and Engineering (VLAN 102). These virtual interfaces will be “plugged into” your bridge.
Create the “Sales” VLAN interface, tagged with ID 101:
nmcli connection add type vlan con-name sales-vlan ifname vlan101 id 101 dev br10Create the “Engineering” VLAN interface, tagged with ID 102:
nmcli connection add type vlan con-name engineering-vlan ifname vlan102 id 102 dev br10Verify that your new connections exist:
nmcli connection showYou should now see
sales-vlanandengineering-vlanin the list.
4.4 Step 4: Assign Static IP Addresses
Assign an IP address to each VLAN from a different subnet. This mimics how a router would handle different VLANs.
Assign an IP address to the Sales VLAN. We’ll use the
192.168.101.0/24subnet.nmcli connection modify sales-vlan ipv4.addresses 192.168.101.1/24 ipv4.method manualAssign an IP address to the Engineering VLAN. We’ll use the
192.168.102.0/24subnet.nmcli connection modify engineering-vlan ipv4.addresses 192.168.102.1/24 ipv4.method manualBring the VLAN interfaces up to apply the changes:
nmcli connection up sales-vlan nmcli connection up engineering-vlan
4.5 Step 5: Verify the Configuration
Check that your interfaces have the correct IP addresses.
Run
ip addr:ip addrLook for the
vlan101andvlan102interfaces and confirm they have the IP addresses you assigned.
In your student notebook, write down the inet line for both the vlan101 and vlan102 interfaces.
4.6 Step 6: Test Segmentation
The final step is to prove that the VLANs are separated. You will try to ping an address on the “Engineering” subnet from the “Sales” interface. This should fail, because there is no router between them.
Run a
pingcommand, using the-Iflag to specify which interface to send the ping from. We will try to ping a hypothetical second device (192.168.102.10) on the engineering network from our sales interface.ping -c 4 -I vlan101 192.168.102.10Observe the output. The ping should fail with a “Destination Host Unreachable” or “Network is Unreachable” message. This is the expected result! It proves that the
vlan101interface has no direct path to the192.168.102.0/24network.
In your notebook, write down the result of your ping test. Did it succeed or fail? Why is this the correct outcome?
5 Reflect and Review
Now that you have completed this exercise, reflect on your experience in your Microsoft Teams Student Notebook:
- 3 new
nmclisub-commands you learned. - 2 virtual interfaces you created.
- 1 question you still have about how routers handle traffic between VLANs.
Answer these questions in your notebook to solidify your understanding:
- What is the purpose of a network bridge in this exercise?
- In the
nmclicommand to create a VLAN, what does theidnumber represent? - Why did we assign IP addresses from different subnets to each VLAN?
- Why did the final
pingtest fail, and what piece of hardware would be required to make it succeed?