Network Interfaces and the Loopback Interface
Full-Access Members Only
Sorry, this lesson is only available to Server Academy Full-Access members. Become a Full-Access member now and get instant access to this and many more premium courses. Click the button below and get instant access now.
Instructions
Q&A (0)
Notes (0)
Resources (0)
Saving Progress...
Resources
There are no resources for this lesson.
Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.
In this lesson, we will explore network interfaces in Linux, an essential concept for anyone dealing with Linux networking. Network interfaces are the point of interconnection between a computer and a network. They can be physical, like Ethernet and Wi-Fi adapters, or virtual, like loopback and VPN interfaces. Understanding how to manage and configure these interfaces is key to effectively managing network connectivity and traffic on a Linux system.
Introduction to Network Interfaces
A network interface in Linux is a software representation of a network connection. It's how the operating system interacts with the underlying network hardware or virtual network connections.
Types of Network Interfaces
- Physical Interfaces: These are associated with physical network hardware. Examples include:
- Ethernet interfaces (e.g.,
eth0
,enp0s3
) - Wi-Fi interfaces (e.g.,
wlan0
,wlp2s0
)
- Ethernet interfaces (e.g.,
- Virtual Interfaces: These are not tied to physical hardware and include:
- Loopback interface (
lo
), used for internal communication within the host. - Virtual Ethernet interfaces (e.g.,
veth
), often used in container networking. - VPN interfaces (e.g.,
tun0
,tap0
), used for virtual private networks.
- Loopback interface (
Managing Network Interfaces
Listing Network Interfaces
You can list all network interfaces using the ip
command:
ip link show
This will display all available network interfaces along with their state (up or down) and hardware addresses.
paulh@ubuntu-server:~$ ip link show
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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:3e:6b:88 brd ff:ff:ff:ff:ff:ff
Explaining everything that is written here can get pretty deep, and I don't want to go off the rails to explain every detail which you probably don't need right now. Here is a high-level breakdown of the output you see if you're interested:
- Loopback Interface (
lo
):- Identified as the
lo
interface, indicating it's a loopback interface. - Flags (
LOOPBACK,UP,LOWER_UP
) show it's a loopback interface that's active and operational. - MTU (Maximum Transmission Unit) is set to 65536 bytes, typical for loopback interfaces.
qdisc noqueue
indicates no network traffic queuing, common for loopback.state UNKNOWN
is standard for loopback interfaces as they don’t have a physical link status.- Hardware (MAC) address and broadcast address are both all zeros, which is standard for loopback interfaces.
- Identified as the
- Ethernet Interface (
enp0s3
):- Named
enp0s3
, following a predictable naming convention. - Flags (
BROADCAST,MULTICAST,UP,LOWER_UP
) indicate support for broadcasting and multicasting, and show the interface is active with an operational physical layer. - Standard MTU for Ethernet is 1500 bytes.
qdisc fq_codel
is the queuing discipline, used for managing network traffic.state UP
shows the interface is ready for data transmission.- Hardware (MAC) address is specific to the Ethernet interface, and the broadcast address is the standard
ff:ff:ff:ff:ff:ff
.
- Named
Configuring Network Interfaces
You can configure network interfaces in various ways, such as assigning IP addresses, setting up routing, or changing the state (up or down).
To bring an interface up:
sudo ip link set eth0 up
To assign a temporary IP address with the ip
command:
Whatever IP address you assign must fall within your networks subnet, if you're unsure of what this means then run the `ip addr` command and copy the existing IP or modify only the last octet (last set of numbers)
sudo ip addr add 192.168.1.10/24 dev eth0
Here is a general rule of thumb. Notice the /24? That's the IP in CIDR block notation and it means you can modify the last octet if you want to change the IP. Slash 24 is very common for home labs.
Server Academy Members Only
Sorry, this lesson is only available to Server Academy Full Access members. Become a Full-Access Member now and you’ll get instant access to all of our courses.