Courseiva
LPIC-2Chapter 7 of 15Objective 201.1

Basic Network Configuration and Troubleshooting

How do you tell your computer to use a specific static IP address or find one automatically? How do you make sure a server can be found on a network by its name, not just by a hard-to-remember number? These are the core problems of basic network configuration, and solving them correctly is the foundation of every system you will manage as an LPIC-2 certified professional.

12 min read
Beginner
Updated Jul 23, 2026
Reviewed by Johnson Ajibi· Senior Network & Security Engineer · MSc IT Security

A simple way to picture Basic Network Configuration and Troubleshooting

The House Address and Mail Delivery Analogy

Your house has a street address. This address is its unique location on the planet, used by the postal service to deliver mail. The postal service doesn't know the layout of your living room; it only cares about getting the envelope to your front door. The network equivalent is an IP address, a unique numerical label assigned to every device (like your computer or phone) connected to a network, which tells data where to go. Your house also has a front door. Behind that door, multiple people live in different rooms. The postal service delivers mail to the front door, but it is your household's job to hand a letter addressed to 'John' to John, not to his sister. In networking, this is the job of a port number. Ports are like numbered doors inside your computer. When data arrives at your IP address, the port number (like 80 for web traffic, 443 for secure web traffic) tells your computer which specific program or service should receive the data. Configuring these network settings is like correctly writing your address and sorting the mail once it arrives. Troubleshooting is what you do when a package goes missing: you check the address, look at the postal tracking (like ping or traceroute), and see if the front door is locked (a firewall blocking a port). This entire system is useless if the address is misconfigured, which is why LPIC-2 demands you master setting and verifying these numbers on Linux systems.

How It Actually Works

Basic network configuration is the process of assigning network parameters to your Linux machine so it can communicate with other devices. This is not magic; it is a set of precise, editable settings that tell your computer its identity on the network and how to find the rest of the world.

At the heart of this is the Network Interface. A network interface is the hardware (like an Ethernet card or a Wi-Fi chip) or software (like a virtual loopback interface) that your operating system uses to send and receive data. You can think of it as a postal slot in your computer's wall. Every interface needs an IP address to participate in a network.

An IP address (Internet Protocol address) is a logical identifier. For IPv4, the most common version, it looks like four numbers separated by dots: 192.168.1.10. This address is divided into two parts: the network portion and the host portion. The Subnet Mask (e.g., 255.255.255.0) tells the computer which part is the network and which part is the specific host on that network. If the subnet mask is 255.255.255.0, the first three numbers (192.168.1) are the network, and the last number (.10) is the host. Two devices with the same network portion (e.g., 192.168.1.5 and 192.168.1.20) can talk to each other directly. If they have different network portions, they need a router.

The default gateway is the IP address of the device (usually a router) that knows how to send traffic to other networks, including the internet. It is the exit door. Without a default gateway, your computer is an island; it can talk to other computers on the same local network but cannot reach the internet or other networks.

Finally, a DNS server (Domain Name System server) is a phonebook for the internet. It translates human-readable names like 'google.com' into IP addresses like 142.250.80.14. If you configure the wrong DNS server, you might be able to ping an IP address but not browse a website by name.

Why does this exist? Before networks, files were moved by floppy disk. Network configuration exists to allow efficient, remote, and automatic communication. It replaces the manual, physical transfer of data. There are two primary ways to configure these settings:

Static Configuration: You manually type in the IP address, subnet mask, gateway, and DNS server. This is like giving your house a permanent, unchanging address. It is used for servers that must always have the same address so other devices can find them reliably.

Dynamic Configuration (DHCP): A DHCP server on the network automatically assigns these settings. Your computer broadcasts a request (like raising your hand to ask 'What is my address?'), and the DHCP server replies with all the details. This is like a hotel assigning you a room number when you check in; it changes every time you visit. This is typical for client workstations and laptops.

On Linux, these settings have traditionally been stored in plain text configuration files. The most famous one is /etc/network/interfaces on Debian/Ubuntu systems, or files in /etc/sysconfig/network-scripts/ on Red Hat/CentOS systems. Modern Linux distributions have moved to network management daemons like systemd-networkd or NetworkManager, which manage these settings more dynamically and often use configuration files written in a more structured format (like YAML or ini files) stored in directories like /etc/netplan (Ubuntu) or /etc/NetworkManager/system-connections.

Configuring these settings incorrectly is one of the most common causes of server outages. A typo in the gateway address makes the machine unable to talk to the internet. A duplicated IP address causes a conflict, and one of the machines will lose connectivity. Troubleshooting these issues involves using command-line tools like: - ip addr show: Displays all IP addresses assigned to all interfaces. - ip route show: Shows your routing table, including your default gateway. - ping: Tests basic connectivity to another host. - traceroute: Shows the path packets take to reach a destination, helping identify where a break in the path is. - ss: Shows socket statistics, confirming if a service is listening on the correct port.

This diagram shows the step-by-step process a Linux computer follows to resolve a hostname (google.com) into an IP address and then route the traffic to the destination server.

Walk-Through

1

Identify the Network Interface

Run 'ip link show' or 'ip addr show' to list all network interfaces. You need to know the exact name (e.g., eth0, enp0s3) of the interface you want to configure. This prevents you from editing the wrong file or applying settings to a virtual interface like 'lo'.

2

Determine IP Assignment Method: Static or DHCP

Decide if the interface will get its address automatically from a DHCP server or if you must assign a fixed static IP. Servers and printers typically use static addresses for reliability, while client workstations use DHCP for mobility. This decision determines which configuration parameters you must provide.

3

Edit the Configuration File

Using a text editor with root privileges (sudo), you edit the appropriate configuration file. This could be a Netplan YAML file in /etc/netplan/, a script file in /etc/sysconfig/network-scripts/, or the /etc/network/interfaces file. You set the IP address, subnet mask, gateway, and DNS servers. A single typo here breaks connectivity.

4

Apply the Configuration

Run the appropriate command to apply your changes. For Netplan, run 'sudo netplan apply'. For traditional init scripts, run 'sudo systemctl restart networking' or 'sudo ifdown eth0 && sudo ifup eth0'. This step tests your configuration for syntax errors and applies it to the running system.

5

Verify Connectivity with Diagnostic Tools

After applying, you must prove the configuration works. Run 'ip addr show' to confirm the IP address is assigned. Run 'ping -c 4 127.0.0.1' to check the TCP/IP stack. Run 'ping -c 4 [gateway_ip]' to check local connectivity. Run 'ping -c 4 [remote_ip]' (like 8.8.8.8) to check internet routing. Finally, run 'nslookup [hostname]' to verify DNS resolution.

What This Looks Like on the Job

You are the junior systems administrator for a small e-commerce company, 'Widgets Ltd'. Your manager asks you to provision a new web server. This is not a theoretical exercise; you must configure its network settings to integrate it into the existing infrastructure.

The server is a bare-metal machine with a fresh install of Ubuntu Server 22.04 LTS. The network team has given you a specific static IP address to use: 10.0.1.50, with a subnet mask of 255.255.255.0 (/24). The default gateway is 10.0.1.1, and the company's DNS servers are 10.0.0.10 and 8.8.8.8.

Here is the step-by-step of what you actually do:

1.

Physically connect the server to the network switch using an Ethernet cable. You log in for the first time using the console (keyboard and monitor) or an out-of-band management interface like iDRAC or iLO.

2.

You check what network interfaces exist. You run 'ip link show'. You see two interfaces: 'lo' (the loopback, an internal software interface) and 'enp0s3' (the physical Ethernet interface).

3.

On Ubuntu 22.04, network configuration is managed by Netplan. The configuration files live in /etc/netplan/. You open the file (likely /etc/netplan/00-installer-config.yaml) with a text editor.

4.

You edit it to define a static IP. The configuration looks like:

- network: - ethernets: - enp0s3: - dhcp4: no - addresses: [10.0.1.50/24] - routes: - to: default via: 10.0.1.1 - nameservers: addresses: [10.0.0.10, 8.8.8.8] - version: 2

5.

You apply the configuration with 'sudo netplan apply'. If there is a syntax error, Netplan will refuse to apply the change, preventing you from accidentally getting locked out.

6. You verify the configuration. You run: - ip addr show enp0s3: You confirm the IP address is 10.0.1.50/24 and the interface is 'UP' (state UP). - ip route show: You confirm the default route via 10.0.1.1 exists. - ping -c 4 10.0.1.1: You test connectivity to the gateway. If this fails, you have a cable or switch problem, or the address is wrong. - ping -c 4 8.8.8.8: You test internet connectivity. If the gateway works but this fails, the gateway may not have internet access or an access control list (ACL) is blocking you. - nslookup google.com: You test DNS resolution. If this fails, you check the DNS server addresses in your configuration.

Once all tests pass, the server is network-configured. You can now install the web server software. This process is the first skill tested in the LPIC-2 201.1 objective. If you misconfigure a single number, the server will be unreachable, and your manager will be unhappy. The entire process is about precision and verification using standard command-line tools.

How LPIC-2 Actually Tests This

The LPIC-2 201.1 exam objective is ruthlessly specific about what you must know. It does not test general networking theory; it tests your ability to configure and troubleshoot network settings on a Linux system using specific files and commands. You are expected to be proficient with both legacy and modern tools.

The exam focuses on these core areas:

- Manual and automatic configuration: You must understand how to set a static IP address using the traditional configuration files and the modern tools like Netplan or NetworkManager. Expect questions that show you a configuration file and ask you to identify the gateway address or the IP address. - Configuration files: - /etc/network/interfaces (Debian/Ubuntu classic format) - /etc/sysconfig/network-scripts/ifcfg-eth0 (RHEL/CentOS classic format) - /etc/hosts (static hostname lookup, bypassing DNS) - /etc/nsswitch.conf (defines the order of lookups: files, DNS, etc.) - /etc/resolv.conf (DNS resolver configuration, though often managed by other services now) - Commands: You will be tested on the modern 'ip' command suite (ip addr, ip link, ip route) and the older, deprecated 'ifconfig' and 'route' commands. The exam expects you to know both, but 'ip' is the standard now. - Troubleshooting: You must be able to interpret the output of 'ping', 'traceroute', and 'netstat' (or 'ss'). Questions often present a symptom and ask which command you would run to diagnose it.

Common traps and question patterns:

Trap: Question gives you a system that has two network interfaces and asks which route will be used to reach the internet. The answer depends on the metric (cost) of the route, not just the interface speed. You must know to check the routing table.

Trap: They give you the output of 'ifconfig eth0' and ask for the subnet mask. The output shows it in hex (0xffffff00). You must convert that to dotted decimal (255.255.255.0).

Trap: A question states that 'ping 8.8.8.8' works but 'ping google.com' fails. The issue is not the network; it is DNS resolution. The correct answer involves checking /etc/resolv.conf or /etc/nsswitch.conf.

Trap: They ask you to add a temporary IP address to an interface for testing. The correct command is 'ip addr add 10.0.0.1/24 dev eth0'. The trap answer might be using a configuration file change and reboot.

To pass, you must memorise the syntax of the 'ip' command, the structure of the key configuration files, and the logic of the 'ping' and 'traceroute' output. Practise editing these files without a network connection (simulate) and verifying the changes with 'ip' commands. The exam will present you with a terminal emulation where you must pick the correct command from a list or type it.

Key Takeaways

The 'ip' command suite (ip addr, ip link, ip route) is the modern standard for viewing and configuring network interfaces on Linux.

Every network host that needs internet access requires a default gateway configured in its routing table.

DNS configuration on modern systems must be done through the system's network manager (e.g., Netplan, NetworkManager), not by directly editing /etc/resolv.conf.

The 'ping 127.0.0.1' test verifies the internal integrity of the TCP/IP stack, not the physical network cable.

A subnet mask (e.g., /24 or 255.255.255.0) defines which part of an IP address identifies the network and which part identifies the host.

The /etc/hosts file provides static, local name-to-IP mappings that take priority over DNS lookups if configured in /etc/nsswitch.conf.

Troubleshooting a network problem always starts with testing the physical layer (cable/link), then layer 3 (IP connectivity with ping), then layer 7 (service availability).

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

Static IP Configuration

IP address is manually assigned by an administrator and does not change automatically.

Used for servers and network infrastructure that must have a predictable, permanent address.

Configuration is done by manually editing network configuration files or using command-line tools like 'ip'.

Configuration is done by manually editing network configuration files or using command-line tools like 'ip'.

Dynamic IP Configuration (DHCP)

IP address is automatically assigned by a DHCP server from a pool of available addresses.

Used for client workstations, laptops, and mobile devices that change networks or are numerous.

Configuration is minimal; the client sets 'dhcp: yes' and the server provides all details.

Legacy net-tools (ifconfig, route)

Deprecated and may not be installed by default in modern distributions.

Does not support advanced features like network namespaces or Multiple Routing Tables.

Uses different syntax and output formats that are often harder to parse for scripting.

Uses different syntax and output formats that are often harder to parse for scripting.

Modern iproute2 suite (ip)

The current standard tool suite for network configuration on Linux.

Unified command structure ('ip addr', 'ip link', 'ip route') with consistent output.

Actively developed and maintained, supporting all modern network features.

/etc/hosts file

A local, static text file on a single machine mapping hostnames to IP addresses.

Only affects the machine on which the file is edited; not scalable for many hosts.

Useful for testing or resolving local network names without a DNS server.

Useful for testing or resolving local network names without a DNS server.

DNS (Domain Name System)

A global, hierarchical distributed database that translates hostnames to IP addresses for the entire internet.

Scalable and dynamic; changes to a DNS record propagate to all requesters worldwide.

Requires network access to a DNS server and proper configuration of resolvers.

IPv4 Address

32-bit address, written as four decimal octets (e.g., 192.168.1.1).

Exhausted at the internet backbone level; uses NAT to conserve addresses.

The predominant protocol on most internal networks, but being phased out.

The predominant protocol on most internal networks, but being phased out.

IPv6 Address

128-bit address, written as eight groups of four hexadecimal digits (e.g., fe80::1).

Provides an enormous address space, eliminating the need for NAT in many scenarios.

Required for LPIC-2 knowledge; increasingly used for direct server-to-server internet communication.

Required for LPIC-2 knowledge; increasingly used for direct server-to-server internet communication.

Watch Out for These

Mistake

Setting a static IP address means I no longer need a default gateway.

Correct

Every host on a network that needs to communicate outside its own subnet must have a default gateway configured. Without it, the machine can only talk to other devices on the same local network segment.

Beginners often confuse the concept of a static IP (a manually assigned address) with the idea that the machine is 'independent' and doesn't need a router. This is false; the gateway is required for any off-network traffic.

Mistake

The 'ip' command and the 'ifconfig' command are identical and interchangeable.

Correct

While both display network information, 'ip' is a modern, feature-rich suite from the iproute2 package and is the standard on current Linux systems. 'ifconfig' is deprecated, does not show all information (like network namespaces), and may not be installed by default. The LPIC-2 exam tests both but expects you to prefer 'ip'.

Many old textbooks and tutorials still use 'ifconfig', and beginners get comfortable with it. They do not realise it is being phased out, leading to confusion when the command is missing on a new distribution.

Mistake

Editing /etc/resolv.conf is the correct, permanent way to configure DNS servers.

Correct

On modern Linux systems using NetworkManager or systemd-resolved, /etc/resolv.conf is often a symbolic link or is automatically generated and overwritten. Direct edits are likely to be lost on reboot or network restart. You must configure DNS through the higher-level network manager (e.g., Netplan, NetworkManager GUI, or nmcli).

/etc/resolv.conf is a simple, well-known file. Beginners naturally think editing it is the correct method, as it works immediately. They do not understand the modern dynamic management layers that sit on top.

Mistake

If 'ping 127.0.0.1' fails, your network cable is faulty.

Correct

The 127.0.0.1 address is the loopback interface. It is a purely internal, software-defined interface that does not use any physical hardware. A failure on 'ping 127.0.0.1' indicates a problem with the TCP/IP stack's internal configuration within the operating system itself, not the cable or network card.

The word 'loopback' sounds like it might check the physical loop of a cable. Beginners do not conceptualise that it is a virtual interface that never leaves the machine.

Mistake

A 'static IP address' means the address is physically hard-coded into the network card.

Correct

A static IP address is a logical configuration stored in an operating system file or managed by a daemon. It can be changed at any time by the administrator. It is not burned into any hardware.

The word 'static' implies immutability, and beginners often anthropomorphise computer hardware, thinking of it as a permanent, physical attribute like a serial number.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

Why does 'ifconfig' sometimes show my IP address and sometimes say 'command not found'?

The 'ifconfig' command is part of the older net-tools package and is not installed by default on many modern Linux distributions. You should use the 'ip' command from the iproute2 package instead, which is always present.

I edited /etc/resolv.conf to add a DNS server, but after a reboot, my changes are gone. Why?

Many modern Linux systems use a service like systemd-resolved or NetworkManager that dynamically manages /etc/resolv.conf. They overwrite your manual edits on reboot or network change. You must configure DNS through the primary network configuration tool (e.g., Netplan, nmcli, or the Network Manager GUI).

What is the difference between /24 and 255.255.255.0?

They are two ways of writing the same thing: a subnet mask. The /24 is CIDR notation which says the first 24 bits of the IP address are the network portion. 255.255.255.0 is the equivalent dotted decimal representation. Both mean the same mask.

Can I have two IP addresses on the same physical network interface?

Yes. This is called 'IP aliasing' or 'secondary IP addresses'. You can add a second IP address to the same interface using the 'ip addr add' command. This is often used when a server needs to serve multiple websites on different IP addresses from a single network card.

My ping to 8.8.8.8 works, but 'ping google.com' says 'unknown host'. What is wrong?

Your internet connectivity is fine, but your DNS resolution is broken. The computer cannot translate the name 'google.com' into an IP address. Check your DNS server configuration in your network settings or /etc/resolv.conf, and ensure you can reach the DNS server (try pinging its IP address).

What does 'RTNETLINK answers: File exists' mean when I run 'ip addr add'?

This error typically means the IP address you are trying to add is already assigned to this or another interface on the same machine. You cannot have duplicate IP addresses on the same network segment. Check for existing assignments using 'ip addr show'.

Terms Worth Knowing

Keep going

You've finished Basic Network Configuration and Troubleshooting. Continue through the LPIC-2 study guide to build a complete picture of the exam.

Done with this chapter?