90 minutes; session 5 of 5
Creating Dummy Interfaces with ip link add
The ip link add
command can create virtual dummy interfaces in Linux. Dummy interfaces act like normal network devices without actual hardware. Let’s look at an example.
Introduction
Dummy interfaces are useful for testing configurations without affecting production networks. Follow along as we create and manipulate a dummy interface.
Steps
Open Terminal
First, open a terminal window on your system.
Create Dummy Interface
Use this to add a dummy interface:
sudo ip link add name dummy0 type dummy
This creates a virtual interface called “dummy0”.
Verify Interface
Check that the dummy interface exists:
ip link show dummy0
The new dummy interface should be listed.
Bring Interface Down
Dummy interfaces can be brought up and down like real interfaces:
sudo ip link set dummy0 down
Bring Interface Up
To bring the interface back up:
sudo ip link set dummy0 up
Delete Interface
Delete the dummy interface when finished:
sudo ip link delete dummy0
Summary
The ip link add
command allows creating dummy interfaces to simulate network devices and test configurations without affecting production networks.
Configuring Interface Queues with ip link set
The ip link set
command can configure queue lengths for network interfaces in Linux. This allows tuning transmit queue parameters.
Introduction
Adjusting queue lengths can help optimize throughput for specific network needs. Let’s look at an example.
Steps
Open Terminal
First, open a terminal window on your system.
Identify Interface
Determine the interface to configure. For example, eth0
.
Configure Tx Queue
Set transmit queue length:
sudo ip link set dev eth0 txqueuelen 1000
Replace 1000 with desired length.
Verify Configuration
Check configured queue length:
ip link show eth0
The “txqueuelen” value should reflect the new setting.
Test Traffic
Send pings or data to see impact of queue configuration.
Reset Queue Length
Return queue to default length when done:
sudo ip link set dev eth0 txqueuelen 100
Summary
The ip link set txqueuelen
command configures transmit queue lengths to potentially optimize throughput for specific network needs.
Creating VLAN Interfaces with ip link add
The ip link add
command can create VLAN subinterfaces in Linux. This allows network segmentation and virtual LANs.
Introduction
VLANs logically divide a physical network into isolated groups. Let’s look at creating a VLAN with ip link add
.
Steps
Open Terminal
First, open a terminal window on your system.
Identify Parent Interface
Determine the parent interface for the VLAN. For example, eth0
.
Create VLAN Interface
Use this to add a VLAN subinterface:
sudo ip link add link eth0 name eth0.10 type vlan id 10
This creates a VLAN 10 interface called “eth0.10”.
Verify VLAN Interface
Check that the new VLAN interface exists:
ip link show eth0.10
Bring Interface Up/Down
The VLAN interface can be brought up/down like a normal interface.
Delete VLAN Interface
Delete when finished:
sudo ip link delete eth0.10
Summary
The ip link add
command allows creating virtual VLAN subinterfaces to logically divide and isolate network traffic.
Creating Bridge Interfaces with ip link add
The ip link add
command can create bridge interfaces in Linux. Bridges allow connecting network segments.
Introduction
Bridges join different interfaces into a shared communication domain. Let’s look at creating a bridge with ip link add
.
Steps
Open Terminal
First, open a terminal window on your system.
Create Bridge Interface
Use this to add a bridge interface:
sudo ip link add name br0 type bridge
This creates a bridge interface called “br0”.
Verify Bridge Interface
Check that the new bridge interface exists:
ip link show br0
Add Interfaces to Bridge
Attach real interfaces:
sudo ip link set eth0 master br0
Inspect Bridge Configuration
List bridge member interfaces:
ip link show br0
Attached interfaces should show up.
Delete Bridge Interface
Delete when finished:
sudo ip link delete br0
Summary
The ip link add
command allows creating bridge interfaces to connect network segments and route traffic between them.
Attaching Interfaces to Bridges with ip link set
The ip link set
command can add interfaces to a bridge in Linux. This allows building bridged networks.
Introduction
Adding interfaces to a bridge joins them into a shared communication domain. Let’s look at an example.
Steps
Open Terminal
First, open a terminal window on your system.
Identify Interface
Determine the interface to be bridged, e.g. eth0
.
Identify Bridge
Specify the target bridge, e.g. br0
.
Attach Interface
Add interface to bridge:
sudo ip link set eth0 master br0
Verify Configuration
Inspect bridge details:
ip link show br0
The bridged interface should appear.
Detach Interface
To detach the interface:
sudo ip link set eth0 nomaster
Reattach Interface
To reattach the interface:
sudo ip link set eth0 master br0
Summary
The ip link set master
command adds interfaces to a bridge, allowing segmented networks to communicate through the bridge interface.
Creating VXLAN Interfaces with ip link add
The ip link add
command can create VXLAN interfaces in Linux. VXLAN enables building virtual L2 networks.
Introduction
VXLAN interfaces tunnel L2 traffic over L3 networks. Let’s look at creating a VXLAN interface.
Steps
Open Terminal
First, open a terminal window on your system.
Create VXLAN Interface
Use this to add a VXLAN interface:
sudo ip link add vxlan0 type vxlan id 10 dstport 4789 local 203.0.113.5 dev eth0
This creates a VXLAN interface with ID 10.
Verify Interface
Check that the VXLAN interface exists:
ip link show vxlan0
Bring Interface Up/Down
VXLAN interfaces can be brought up/down like normal interfaces.
Delete Interface
Delete when finished:
sudo ip link delete vxlan0
Summary
The ip link add
command allows creating virtual VXLAN interfaces to tunnel layer 2 traffic over layer 3 networks, enabling virtual bridged networks.