Courseiva
LFCSChapter 11 of 16Objective 5.1

Network Interface Configuration

How do you make a server talk to the internet or to other computers in the same building? Without network interface configuration, your shiny new Linux server is a silent, isolated box — it can't send or receive any data. For the LFCS exam, you must understand exactly how to assign an IP address, set up a default gateway, and configure DNS resolution so your server can join a network and start serving websites, files, or applications.

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

A simple way to picture Network Interface Configuration

The Apartment Intercom System Analogy

When you first move into a new apartment building, you need to get your flat connected to the main intercom system so people can call you from the front door. This is similar to how a server needs to be connected to a network. First, the building manager assigns you a unique flat number (an IP address) so deliveries and visitors can find you. This leads to you connecting your personal intercom handset (your network interface) to the wall jack.

But just having a flat number isn't enough. The building also has a main directory (a routing table) that tells visitors which floor you're on and how to get there. If you want to access the building's shared amenities like the gym or the laundry room, you need permission from the building management (a firewall rule) and the right key (a security certificate).

If you get a new sofa delivered, the delivery driver needs both your flat number and a temporary access code from the concierge to enter the building and take the lift to your floor. This is exactly how a network packet (the sofa) travels from the internet (the delivery truck) to your server (your flat) — it needs a public IP address (the building's main address), a port number (the lift to your floor), and a routing rule (the concierge's approval) to reach the correct application (your living room).

If you change flats within the same building, you need to update your flat number with the post office, the utilities company, and the building directory. On a server, this is equivalent to changing the IP address configuration: you must update the IP itself, the subnet mask (your floor number), the default gateway (the main exit from the building), and the DNS server (the phonebook that translates names like 'pizzeria' into addresses like '42 Wallaby Way').

How It Actually Works

Network interface configuration is the process of telling your Linux server how to connect to a network. Think of it as teaching the server its address, its neighbourhood, and who to ask for directions. Without this, the server is like a phone with no SIM card — completely disconnected.

At the most basic level, a network interface is a piece of hardware (like an ethernet port or a Wi-Fi card) or software (like a loopback interface) that sends and receives data. Your server likely has at least two: eth0 (the first wired ethernet port) and lo (the loopback interface, which talks only to itself). The loopback interface is always there, always active, and it's how your server talks to services running on itself without needing physical hardware.

Every network interface needs an IP address. An IP address is a unique identifier for that interface on a network. Think of it like a postal address for your server. There are two main types: IPv4 (like 192.168.1.10) and IPv6 (like 2001:db8::1). IPv4 addresses are 32-bit numbers, usually shown as four decimal numbers separated by dots. Each number ranges from 0 to 255. So 10.0.0.1 is a valid IPv4 address.

But an IP address alone is not enough. You also need a subnet mask. A subnet mask tells the server which part of the IP address represents the network and which part represents the specific device (host). For example, if your IP is 192.168.1.10 and the subnet mask is 255.255.255.0, then the network part is 192.168.1 and the host part is .10. The subnet mask helps the server decide if another computer is on the same local network (in the same building) or if it needs to go through a router to reach it.

The default gateway is the next critical piece. This is the IP address of the router that connects your local network to other networks, including the internet. Every packet destined for a computer outside your local subnet gets sent to the default gateway. Without it, your server can talk to neighbours but not to the world.

Finally, you need DNS server addresses. DNS stands for Domain Name System. It translates human-readable names like google.com into IP addresses like 142.250.190.78. Without DNS, you would have to memorise every website's IP address — impractical. DNS servers are like phonebooks. Your server sends a query to a DNS server, the DNS server looks up the IP, and your server connects.

On Linux, you configure these settings using network configuration files or commands like ip, ifconfig (legacy), and nmcli. The exact files depend on your distribution. On Red Hat family systems (RHEL, CentOS, Fedora), network scripts live in /etc/sysconfig/network-scripts/. On Debian family systems (Ubuntu), you edit /etc/network/interfaces or use netplan. Modern systems often use NetworkManager, a service that manages network connections dynamically.

To configure an interface manually, you can use the ip command. For example, 'ip addr add 192.168.1.10/24 dev eth0' assigns an IP address and subnet mask to eth0. The /24 after the IP is CIDR notation — it's shorthand for a subnet mask of 255.255.255.0. Then you set the default route: 'ip route add default via 192.168.1.1'. This says: to reach any network that isn't directly connected, send the traffic through 192.168.1.1. Finally, you add DNS servers in /etc/resolv.conf, listing nameserver IP addresses.

These manual settings are temporary — they disappear after a reboot. To make them permanent, you must edit the distribution-specific configuration files. For example, in /etc/sysconfig/network-scripts/ifcfg-eth0 on a Red Hat system, you'd set BOOTPROTO=static, IPADDR=192.168.1.10, NETMASK=255.255.255.0, GATEWAY=192.168.1.1, and DNS1=8.8.8.8. Then you restart the network service: 'systemctl restart network' or 'nmcli connection reload'.

The alternative to static configuration is DHCP (Dynamic Host Configuration Protocol). A DHCP server automatically assigns an IP address, subnet mask, default gateway, and DNS servers to your interface. This is how your home Wi-Fi works — your laptop gets an address from the router automatically. In data centres, servers often use static IPs for stability and predictability, while virtual machines or workstations use DHCP.

To summarise the core components: the interface itself (the hardware or virtual port), the IP address and subnet mask (the unique identifier and neighbourhood map), the default gateway (the exit route to other networks), and the DNS server (the phonebook). Misconfiguring any single one of these can break connectivity entirely or cause intermittent, hard-to-diagnose failures.

Flowchart showing the relationship between server hardware, network interface, configuration source (static or DHCP), required network parameters, and successful connectivity.

Walk-Through

1

Identify the network interface name

Run 'ip link show' or 'ip addr show' to list all available network interfaces. On modern Linux, names look like enp0s3, ens33, or eth0. Note the name of the interface you want to configure (e.g., enp0s3). This step is critical because you must target the correct interface, not the loopback.

2

Decide on static or DHCP configuration

Based on your network design, decide whether the interface will get its IP automatically via DHCP (common for workstations) or manually via static configuration (common for servers). This determines which parameters you set in the config file and how you set BOOTPROTO.

3

Edit the persistent configuration file

Open the appropriate configuration file for your distribution using a text editor. For RHEL/CentOS, edit /etc/sysconfig/network-scripts/ifcfg-enp0s3. Set BOOTPROTO=none (or static), ONBOOT=yes, and add IPADDR, PREFIX, GATEWAY, and DNS1. For Debian/Ubuntu, edit /etc/network/interfaces or the netplan YAML with equivalent settings. This makes the config survive reboots.

4

Apply the configuration to the running system

After saving the config file, apply the changes without rebooting. Commands: 'systemctl restart NetworkManager' or 'nmcli con up enp0s3' (RHEL) or 'systemctl restart networking' (Debian). Alternatively, bring the interface down with 'ip link set dev enp0s3 down' and up with 'ip link set dev enp0s3 up'. Verify with 'ip addr show enp0s3'.

5

Test connectivity and DNS resolution

First, ping the default gateway to confirm local network access: 'ping -c 4 10.0.1.1'. Then, ping an external IP (8.8.8.8) to verify routing. Finally, ping a hostname (google.com) to test DNS. If DNS fails, check /etc/resolv.conf or the configuration file for correct nameserver entries. If all tests pass, the configuration is complete.

What This Looks Like on the Job

Imagine you are a junior Linux administrator at a small e-commerce company called 'ShopSense'. Your boss asks you to set up a new web server that will host the company's main website. The server has already been installed physically in the data centre and is connected to the network switch via an ethernet cable. The network team has reserved a static IP address for this server: 10.0.1.50, with a subnet mask of 255.255.255.0, default gateway 10.0.1.1, and a DNS server at 10.0.1.10. Your job is to configure the network interface on the Linux server itself.

You SSH into the server (or connect via a serial console) and begin. First, you identify the network interface name. You run 'ip link show' and see a list of interfaces. You spot 'enp0s3' — the first wired ethernet port. On modern systems, interfaces are named with a predictable scheme (like enp0s3 for ethernet, bus 0, slot 3) rather than the old 'eth0'. You note the name.

Next, you check the current configuration. You run 'ip addr show enp0s3' and see it has no IP address assigned. Perfect — it's a blank slate. Now you decide how to make the configuration persistent. Since this is a Red Hat Enterprise Linux 9 server, you edit the file /etc/sysconfig/network-scripts/ifcfg-enp0s3. You use vi or nano to change these lines:

BOOTPROTO=none (meaning no DHCP, static config)

ONBOOT=yes (start the interface at boot)

IPADDR=10.0.1.50

PREFIX=24 (this is the CIDR equivalent of a 255.255.255.0 mask)

GATEWAY=10.0.1.1

DNS1=10.0.1.10

After saving the file, you apply the changes. You can either restart the network service with 'systemctl restart NetworkManager' or use 'nmcli con up enp0s3' to bring the interface up with the new config. You verify with 'ip addr show enp0s3' and see that the IP 10.0.1.50/24 is now assigned.

Then you test connectivity. You ping the default gateway: 'ping -c 4 10.0.1.1'. If you get replies, the server can reach its local network. Next, you ping an external address like 'ping -c 4 8.8.8.8'. If that works, the default gateway is routing traffic out to the internet. Finally, you test DNS by pinging a hostname: 'ping -c 4 google.com'. If that fails but the IP ping worked, you know your DNS configuration is wrong — a common trap.

You also check that the server can be reached from other machines. From your own workstation, you try a quick SSH to 10.0.1.50. If it connects, the configuration is complete. You then document the IP, subnet, gateway, and DNS values in your team's inventory spreadsheet, and you add a note that the interface uses persistent configuration via ifcfg file rather than DHCP.

That same server might also host a test environment. For the test environment, you might assign a second IP to the same physical interface — a technique called IP aliasing. This is rare in modern practice but still tested on LFCS. You'd add 'ip addr add 10.0.1.51/24 dev enp0s3' and then ensure it survives reboot by adding a second IPADDR line in some distributions, or by using a separate ifcfg file like ifcfg-enp0s3:0.

Finally, you might need to troubleshoot if something goes wrong. Common real-world issues include: typo in the IP address (setting 10.0.1.5 instead of 10.0.1.50), forgetting the default gateway, or using the wrong subnet mask (like /16 instead of /24) causing the server to think another device is on the same network when it is actually across a router, leading to failed packets. You resolve these by carefully checking each parameter against the network team's documentation and using tools like traceroute and ss.

How LFCS Actually Tests This

The LFCS exam tests your ability to configure network interfaces both temporarily and permanently on Linux systems. Expect to see multiple choice questions and command-based simulation questions that require you to know the exact syntax and file locations for major distributions.

Key concepts that appear regularly:

The 'ip' command suite: 'ip addr', 'ip link', 'ip route'. You must know how to add and remove IP addresses, bring interfaces up and down ('ip link set dev eth0 up'), and add a default route.

The difference between 'ip' and 'ifconfig'. 'ifconfig' is legacy and not installed by default on many modern distributions. The exam assumes you know both but the 'ip' command is preferred.

Network configuration files: for RHEL/CentOS clones, know the ifcfg files in /etc/sysconfig/network-scripts/. For Debian/Ubuntu, know /etc/network/interfaces and netplan YAML files. The exam often gives you a scenario and asks which file to edit.

Persistent versus temporary configuration. A common trap: a candidate adds an IP with 'ip addr add' but does not save it to a configuration file. The exam will present a scenario where after reboot the IP is lost, and ask you to identify the cause. The correct answer is: the configuration was not made persistent.

DHCP vs static. You need to know how to switch between them. The exam may describe a server that currently gets its IP via DHCP, and ask you to change it to a static IP. They expect you to know that BOOTPROTO must be changed from dhcp to static or none, and the IP address must be defined.

DNS configuration: the file /etc/resolv.conf is the key. The exam tests that you know 'nameserver' directives, and that multiple nameservers can be listed. Also know that on systems using NetworkManager or systemd-resolved, manual edits to resolv.conf may be overwritten — you must use nmcli or systemd-resolve commands instead.

Hostname configuration: setting the hostname with 'hostnamectl set-hostname' and ensuring it survives reboot. The exam may ask how to change the hostname temporarily (hostname command) versus permanently (hostnamectl or /etc/hostname).

The /etc/hosts file: used for local static name resolution. The exam tests that this file takes precedence over DNS by default. They love to set up a trick where a hostname resolves to a wrong IP via /etc/hosts, and ask why ping fails even though DNS is correct.

Common traps the exam sets:

Asking you to configure an interface with a subnet mask that is inconsistent with the IP address class (e.g., a class C address with a /8 mask) — this will work technically but will cause routing issues.

Providing a scenario where you must add a second IP to the same interface and making you choose between a second 'IPADDR' line in the same config file versus a separate alias file. The correct answer often involves a second IPADDR line on RHEL7+ or a separate config file with the interface name and colon (e.g., ifcfg-eth0:1).

Mixing up 'gateway' and 'GATEWAY' (case sensitivity in config files).

Questions where a server can ping IP addresses but not hostnames — the answer is always DNS misconfiguration (or missing /etc/resolv.conf).

To prepare, you should practise configuring network interfaces in both CentOS/RHEL and Ubuntu virtual machines. Run 'ip addr', 'ip route', and test DNS. Know how to bring an interface down and up without rebooting. Understand that 'systemctl restart networking' works on Debian but 'systemctl restart network' on RHEL — the service name differs.

Definition to memorise:

Loopback interface: lo, always 127.0.0.1, used for internal communication.

CIDR notation: /24 means 255.255.255.0, /16 means 255.255.0.0, /8 means 255.0.0.0.

Default gateway: the router IP that handles traffic not destined for the local subnet.

DHCP: dynamic assignment of network parameters.

Static assignment: manual, fixed IP address.

Key Takeaways

A network interface must have a valid IP address, subnet mask, default gateway, and DNS server to communicate outside its local subnet.

The 'ip' command (ip addr, ip link, ip route) is the modern tool for runtime network configuration; 'ifconfig' is legacy.

Temporary changes made with 'ip addr add' are lost after reboot — you must edit persistent configuration files to keep them.

On RHEL-based systems, network interface config files are in /etc/sysconfig/network-scripts/ with the naming pattern ifcfg-<interface_name>.

On Debian-based systems, network configuration is done in /etc/network/interfaces or via netplan YAML files in /etc/netplan/.

The loopback interface (lo, IP 127.0.0.1) is always present and used only for local communication within the same host.

DHCP automatically assigns IP, subnet, gateway, and DNS; static configuration requires you to set each parameter manually.

DNS resolution is configured in /etc/resolv.conf, but on modern systems you should use NetworkManager or systemd-resolved instead of editing it directly.

The /etc/hosts file overrides DNS resolution and can be used for local name mapping or troubleshooting.

Setting the wrong subnet mask can cause a server to think remote hosts are local, leading to failed ARP requests and connectivity issues.

Easy to Mix Up

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

Static IP

IP address is manually set and never changes, providing predictability for servers and monitoring systems.

Configuration must be edited manually in files like ifcfg-eth0; no automatic renewal.

Requires careful documentation and tracking to avoid IP conflicts on the network.

DHCP

IP address is automatically assigned by a DHCP server, ideal for workstations and mobile devices.

Configuration is automatic and renews periodically (lease time); minimal human intervention needed.

No manual documentation needed, but DHCP server must be managed and monitored for availability and address scope.

IPv4

32-bit addresses expressed as four octets (e.g., 192.168.1.1); limited address space (approx 4.3 billion addresses).

Still the dominant protocol on most internal networks and the internet.

Uses ARP (Address Resolution Protocol) for mapping IP to MAC addresses.

IPv6

128-bit addresses expressed as eight groups of hexadecimal (e.g., 2001:db8::1); virtually unlimited address space.

Adoption is growing but less common on internal LANs; used heavily by large ISPs and mobile networks.

Uses NDP (Neighbor Discovery Protocol) instead of ARP for address resolution.

ifconfig

Legacy tool from net-tools package; no longer actively developed and missing on many modern minimal installs.

Syntax: ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up

Cannot manage advanced features like network namespaces or policy routing.

ip (iproute2)

Modern tool from iproute2 package; actively maintained and installed by default on all major distributions.

Syntax: ip addr add 192.168.1.10/24 dev eth0 ; ip link set eth0 up

Supports advanced features including network namespaces, VRF, and policy routing.

/etc/hosts

Local static file mapping hostnames to IP addresses; changes take effect immediately without restart.

Takes precedence over DNS queries by default in most systems (checked first in name resolution order).

Best for small networks or testing, but does not scale; every machine must be updated manually.

DNS (resolv.conf)

Centralised name resolution service that queries remote DNS servers for hostname-to-IP mappings.

Queried only after local files (like /etc/hosts) are checked; configured via /etc/resolv.conf or NetworkManager.

Scalable to millions of records; requires network connectivity and DNS server management.

Watch Out for These

Mistake

If I can ping 127.0.0.1 (localhost), my network interface is working correctly.

Correct

Pinging 127.0.0.1 only tests that the loopback interface (lo) is functional. It does not test your physical or virtual ethernet interface, nor does it test connectivity to other devices on the network.

Beginners often think localhost and the real network interface are the same thing. They are separate interfaces, and testing one does not verify the other.

Mistake

Setting an IP address with 'ip addr add' makes it permanent.

Correct

The 'ip' command only makes temporary changes that vanish after a reboot. To make the configuration persistent, you must edit the appropriate network configuration file (e.g., /etc/sysconfig/network-scripts/ifcfg-eth0 on RHEL).

New users mistake command-line changes for permanent ones because they see the change take effect immediately. They are not familiar with the distinction between runtime and boot-persistent configuration.

Mistake

Editing /etc/resolv.conf directly is always the correct way to set DNS servers.

Correct

On systems using NetworkManager or systemd-resolved, manual edits to /etc/resolv.conf are overwritten at the next network restart. You must use tools like nmcli or systemd-resolve to set DNS permanently.

Older Linux distributions allowed direct editing. Modern systems abstract DNS management through services, so beginners are frustrated when their changes disappear and think the system is broken.

Mistake

If I can ping an IP address, the network is fully configured and DNS is irrelevant.

Correct

Pinging an IP address only verifies IP-layer connectivity. It does not test DNS. You can have perfect IP connectivity and still fail to resolve hostnames if DNS is misconfigured.

Beginners conflate two separate layers: IP routing and name resolution. They assume connectivity at one level implies connectivity at all levels.

Mistake

All Linux distributions use the same configuration files for network interfaces.

Correct

Configuration file locations and syntax vary significantly between distributions. RHEL/CentOS uses /etc/sysconfig/network-scripts/ifcfg-*, Debian/Ubuntu uses /etc/network/interfaces or netplan YAML, and SUSE uses /etc/sysconfig/network/ifcfg-*.

New users often learn on one distribution (like Ubuntu) and assume the same approach works universally on the LFCS exam, which tests multiple distributions.

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

How do I set a static IP address on a Linux server?

Edit the network configuration file for your interface (e.g., /etc/sysconfig/network-scripts/ifcfg-eth0 on RHEL), set BOOTPROTO=static, add IPADDR, PREFIX, and GATEWAY lines, then restart the network service with 'systemctl restart network'.

What is the difference between ifconfig and ip command?

'ifconfig' is a legacy tool from net-tools that is no longer maintained and may not be installed by default. The 'ip' command is part of the iproute2 suite and is the modern, preferred way to manage network interfaces, addresses, and routes.

Why does my Linux server lose its IP address after a reboot?

You likely set the IP with 'ip addr add' which only makes a temporary runtime change. To make it persistent, edit the network configuration file for your interface and set BOOTPROTO accordingly so the IP is applied automatically on boot.

How do I set up a second IP address on the same interface?

You can add a second IP temporarily with 'ip addr add 10.0.1.51/24 dev eth0'. To make it persistent on RHEL, either add a second IPADDR2 line in the same ifcfg file or create a separate alias config file like ifcfg-eth0:1.

What are the minimum settings needed for a server to connect to the internet?

You need a valid IP address, a subnet mask that matches your network, a default gateway that routes traffic outside your subnet, and at least one DNS server address to resolve domain names into IP addresses.

How do I change the hostname of a Linux server permanently?

Use 'hostnamectl set-hostname new-hostname' on modern systems. This updates /etc/hostname and ensures the change persists across reboots. You can also edit /etc/hostname directly, but hostnamectl is the recommended method.

Terms Worth Knowing

Keep going

You've finished Network Interface Configuration. Continue through the LFCS study guide to build a complete picture of the exam.

Done with this chapter?