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.