Inspect network config in /etc/network
In the previous steps, you learned how to view the active routing table using ip route show
and route -n
. Now, let's look at where some of the network configuration might be stored on a Debian-based system like Ubuntu.
Network configuration files are often located in the /etc
directory, which is where system configuration files are typically stored. A common location for network interface configuration is the /etc/network/interfaces
file.
We will use the cat
command to display the contents of this file. cat
is a simple command that reads files sequentially and prints them to the standard output.
Open your terminal and type the following command:
cat /etc/network/interfaces
Press Enter.
You will 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 contents:
- Lines starting with
#
are comments and are ignored.
source-directory /etc/network/interfaces.d
: This line indicates that configuration files in the /etc/network/interfaces.d
directory should also be included. This allows for modular network configuration.
auto lo
: This line tells the system to automatically bring up the lo
interface (the loopback interface) during boot.
iface lo inet loopback
: This configures the lo
interface as a loopback interface using the inet
(IPv4) address family.
auto eth0
: This tells the system to automatically bring up the eth0
interface during boot. eth0
is a common name for the first Ethernet network interface.
iface eth0 inet dhcp
: This 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 configuration for network interfaces. While modern systems often use tools like Netplan or NetworkManager for more dynamic configuration, understanding the /etc/network/interfaces
file is still valuable as it's present on many systems and provides a clear view of basic interface setup.
You have now seen how to view the active routing table and inspect a common network configuration file. This gives you a basic understanding of how network settings are managed in Linux.
Click Continue to complete this lab.