How to check if a network queue discipline is set in Linux

LinuxLinuxBeginner
Practice Now

Introduction

In this lab, you will learn how to check if a network queue discipline is set in Linux. You will use the tc qdisc show command to list the configured queue disciplines on your network interfaces and understand the output.

You will also verify your network interfaces using the ip link command and inspect the network configuration files in /etc/network to gain a comprehensive understanding of your network setup and how queue disciplines are applied.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("Linux")) -.-> linux/BasicFileOperationsGroup(["Basic File Operations"]) linux(("Linux")) -.-> linux/RemoteAccessandNetworkingGroup(["Remote Access and Networking"]) linux/BasicFileOperationsGroup -.-> linux/cat("File Concatenating") linux/RemoteAccessandNetworkingGroup -.-> linux/ifconfig("Network Configuring") linux/RemoteAccessandNetworkingGroup -.-> linux/netstat("Network Monitoring") linux/RemoteAccessandNetworkingGroup -.-> linux/ip("IP Managing") subgraph Lab Skills linux/cat -.-> lab-558742{{"How to check if a network queue discipline is set in Linux"}} linux/ifconfig -.-> lab-558742{{"How to check if a network queue discipline is set in Linux"}} linux/netstat -.-> lab-558742{{"How to check if a network queue discipline is set in Linux"}} linux/ip -.-> lab-558742{{"How to check if a network queue discipline is set in Linux"}} end

List queue disciplines with tc qdisc

In this step, you will learn how to list the queue disciplines configured on your network interfaces using the tc command.

The tc command is a powerful tool in Linux used for traffic control. It allows you to manage network traffic, including shaping, scheduling, and policing. Queue disciplines (qdiscs) are the core of traffic control. They determine how packets are queued and transmitted on a network interface.

To list the currently configured queue disciplines, you will use the tc qdisc show command.

Open your terminal if it's not already open. You can do this by clicking the Xfce Terminal icon on the left side of your desktop.

Now, type the following command and press Enter:

tc qdisc show

You should see output similar to this:

qdisc noqueue 0: dev lo root refcnt 2
qdisc fq_codel 0: dev eth0 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn

Let's break down the output:

  • qdisc: Indicates that this line describes a queue discipline.
  • noqueue: This is the name of the queue discipline. noqueue is a simple qdisc that doesn't perform any queuing; packets are dropped if the interface is busy. It's typically used for the loopback interface (lo).
  • 0:: This is the handle of the qdisc.
  • dev lo: Specifies the network interface the qdisc is attached to. lo is the loopback interface.
  • root: Indicates that this is the root qdisc for the interface.
  • refcnt 2: Reference count for the qdisc.

The second line shows the fq_codel qdisc on the eth0 interface. fq_codel is a more advanced qdisc that combines Fair Queuing (FQ) with CoDel (Controlled Delay) to provide fair bandwidth allocation and minimize bufferbloat.

Understanding queue disciplines is crucial for optimizing network performance and troubleshooting network congestion issues.

Click Continue to proceed to the next step.

In this step, you will use the ip link command to examine the network interfaces on your system. The ip command is a modern and versatile utility for network configuration in Linux, replacing older tools like ifconfig.

The ip link command specifically deals with the network interfaces themselves, showing their state, MAC addresses, and other details.

Open your terminal if it's not already open.

Type the following command and press Enter:

ip link show

You should see output similar to this, listing your network interfaces:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ff

Let's look at the key information provided for each interface:

  • 1: lo: and 2: eth0:: The interface index and name. lo is the loopback interface, and eth0 is typically your primary network interface.
  • <LOOPBACK,UP,LOWER_UP> and <BROADCAST,MULTICAST,UP,LOWER_UP>: Flags indicating the interface's capabilities and current state. UP means the interface is active, and LOWER_UP means the physical link is up.
  • mtu 65536 and mtu 1500: The Maximum Transmission Unit, which is the largest packet size that can be transmitted without fragmentation.
  • qdisc noqueue and qdisc fq_codel: The queue discipline attached to the interface, as you saw in the previous step.
  • state UNKNOWN and state UP: The operational state of the interface.
  • mode DEFAULT: The mode of the interface.
  • group default: The group the interface belongs to.
  • qlen 1000: The transmit queue length.
  • link/loopback and link/ether: The link layer type.
  • 00:00:00:00:00:00 and aa:bb:cc:dd:ee:ff: The MAC address of the interface.
  • brd 00:00:00:00:00:00 and brd ff:ff:ff:ff:ff:ff: The broadcast MAC address.

The ip link show command is essential for quickly checking the status and configuration of your network interfaces.

Click Continue to move on.

Inspect network config in /etc/network

In this step, you will explore the traditional network configuration files located in the /etc/network directory. While modern Linux distributions often use tools like Netplan or NetworkManager, understanding these older configuration files is still valuable, especially on systems that use them or for troubleshooting.

The primary configuration file for network interfaces in this style is /etc/network/interfaces.

Open your terminal if it's not already open.

You will use the cat command to display the content of the /etc/network/interfaces file. cat is a simple command used to concatenate and display file content.

Type the following command and press Enter:

cat /etc/network/interfaces

You should see output similar to this:

## interfaces(5) file used by ifup(8) and ifdown(8)
## Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

Let's examine the content:

  • #: Lines starting with # are comments and are ignored.
  • source-directory /etc/network/interfaces.d: This line tells the system to include configuration files found in the /etc/network/interfaces.d directory. This allows for modular network configurations.
  • auto lo: This line indicates that the lo (loopback) interface should be brought up automatically when the system starts.
  • iface lo inet loopback: This line configures the lo interface. inet specifies the address family (IPv4), and loopback indicates it's a loopback interface.
  • auto eth0: This line indicates that the eth0 interface should be brought up automatically when the system starts.
  • iface eth0 inet dhcp: This line configures the eth0 interface to obtain its IP address and other network settings automatically using DHCP (Dynamic Host Configuration Protocol).

This file provides a static way to configure network interfaces. You can manually define IP addresses, netmasks, gateways, and other settings here instead of using DHCP.

While you won't be modifying this file in this lab, knowing its location and basic structure is important for understanding how network interfaces can be configured on a Linux system.

Click Continue to complete this lab.

Summary

In this lab, you learned how to check if a network queue discipline is set in Linux. You started by using the tc qdisc show command to list the configured queue disciplines on your network interfaces, understanding the output including the qdisc name, interface, and type. This command is a fundamental tool for inspecting traffic control settings.

You also learned the importance of understanding different queue disciplines like noqueue and fq_codel and their roles in managing network traffic and performance. This initial step provided a practical way to see which qdiscs are active on your system.