CertNote/ Commute Study Notes
Roadmap
KOEN
CLF-C02 · FoundationalCloud Practitioner - Foundational
DVA-C02 · AssociateDeveloper - Associate
SAA-C03 · AssociateSolutions Architect - Associate
SOA-C02 · AssociateCloudOps Engineer - Associate
SAP-C02 · ProfessionalSolutions Architect - Professional
DOP-C02 · ProfessionalDevOps Engineer - Professional
Linux Master 2 · 2급KAIT Linux Master - Level 2
SCS-C03 · SpecialtySecurity - Specialty
Linux Master 1 · 1급KAIT Linux Master - Level 1
  • Week 1
    • 1.Operating Systems and Linux: What the Kernel Does
    • 2.Free Software and Distributions: The Ecosystem Built by Licenses
    • 3.Installation and Booting: From the Moment You Power On
    • 4.Filesystem Structure and File Types: Everything Is a File
    • 5.Week 1 Comprehensive Review: Time to See Through the Concepts
  • Week 2
  • Week 3
  • Week 4
  • Week 5
  • Week 6
  • Week 7
  • Week 8
    • 1.Networking Basics: The OSI 7 Layers and IP Address / Subnet Calculation
    • 2.Network Configuration: Setting Up Interfaces, Gateways, and DNS by Hand
    • 3.Network Diagnostics: Commands That Narrow Down the Problem, from ping to tcpdump
    • 4.Network Devices, Protocols, and Redundancy: Infrastructure Threaded Together by Layers
    • 5.Week 8 Comprehensive Review: Threading Networking Together on a Single Layer Map
  • Week 9
  • Week 10
  • Week 11
  • Week 12
  • Week 13
  • Week 14
MLA-C01 · AssociateMachine Learning Engineer - Associate
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
MLS-C01 · SpecialtyMachine Learning - Specialty
SQLD · 개발자SQL Developer (SQLD)

© CertNote · 주간랩스

  • About
  • Changelog
  • Contact
  • Terms
  • Privacy
← Linux Master 1/Week 8/Day 2

Based on the Linux Master 1 exam syllabus·Report an error

Linux Master 1· AssociateWeek 8 · Day 2~20 min read

Day 2 - Network Configuration: Setting Up Interfaces, Gateways, and DNS by Hand

📌 Key Takeaways

  • Network configuration has three axes — address (ip addr/IPADDR) · route (ip route/GATEWAY) · name (resolv.conf/hosts).
  • The tools split by generation: legacy ifconfig, route, arp ↔ modern ip (iproute2) and nmcli. The exam asks for the 1:1 mapping table.
  • The biggest trap is temporary vs permanent. ip addr add, ifconfig, and editing resolv.conf directly are temporary (or at risk of being overwritten), while ifcfg files and nmcli con mod are permanent.
  • In ifcfg-eth0, if ONBOOT=no, the interface does not come up at boot even if the IP settings are all correct. BOOTPROTO decides between static and dhcp.
  • Name resolution follows the hosts: files dns order in /etc/nsswitch.conf — /etc/hosts is matched before DNS.

The ip Command — The Standard Tool for Modern Linux Networking

  • The ip command (from the iproute2 package) unifies and replaces the old ifconfig, route, and arp.
  • It is now the standard tool on all major distributions.
# Check interfaces and IP addresses
ip addr show          # short form: ip a
ip addr show eth0     # a specific interface only
 
# Check interface link (L2) status
ip link show          # short form: ip l
 
# Add/remove an IP address (temporary — lost on reboot)
ip addr add 192.168.1.10/24 dev eth0
ip addr del 192.168.1.10/24 dev eth0
 
# Enable/disable an interface
ip link set eth0 up
ip link set eth0 down
 
# Check the routing table
ip route show         # short form: ip r

The ip command has a consistent syntax: the object (addr, link, route, neigh) first, then the action (show, add, del, set). ip a = addresses, ip l = links, ip r = routing, ip neigh = ARP table. Just learning these four abbreviations covers 80% of diagnosis.

⚠️ Trap: an IP assigned with ip addr add is temporary — it disappears on reboot. For permanent configuration, use the configuration files below (network-scripts) or nmcli. If the exam asks for "a configuration method that persists after reboot", ip addr add is never the answer.

ifconfig and route — Legacy Commands You Should Know

  • These are legacy commands from the net-tools package. Modern distributions often do not install it by default.
  • They still show up on the exam and on legacy systems, so it is efficient to memorize the mapping table as a whole.
TaskLegacy (net-tools)Modern (iproute2)
Check IP addressesifconfigip addr
Set IP temporarilyifconfig eth0 192.168.1.10 netmask 255.255.255.0ip addr add 192.168.1.10/24 dev eth0
Bring up an interfaceifconfig eth0 upip link set eth0 up
Check routingroute -nip route
Add default gatewayroute add default gw 192.168.1.1ip route add default via 192.168.1.1
ARP tablearp -nip neigh
# Legacy: add a gateway
route add default gw 192.168.1.1 eth0
 
# Modern: the same task
ip route add default via 192.168.1.1 dev eth0

Key distinction: ifconfig only shows the IP address and cannot properly handle secondary IPs or policy routing. ip fully supports them. If the exam asks for "the command that replaces ifconfig", it is ip addr. It is efficient to memorize the 1:1 mapping table of the two commands as a whole.

nmcli — Command-Line Control of NetworkManager

  • On Red Hat-family systems (RHEL/CentOS/Rocky) and modern distributions, NetworkManager manages the network.
  • The tool that controls it from the command line is nmcli, and settings made with nmcli are saved permanently.
# Check connection and device status
nmcli connection show          # short form: nmcli con show
nmcli device status            # short form: nmcli dev status
 
# Configure a static IP permanently
nmcli con mod eth0 ipv4.addresses 192.168.1.10/24
nmcli con mod eth0 ipv4.gateway 192.168.1.1
nmcli con mod eth0 ipv4.dns 8.8.8.8
nmcli con mod eth0 ipv4.method manual    # static
nmcli con up eth0                        # apply the changes
 
# Switch to DHCP
nmcli con mod eth0 ipv4.method auto

nmcli distinguishes between a "connection (configuration profile)" and a "device (physical device)". You edit the profile with con mod and apply it with con up. ipv4.method manual = static, auto = DHCP. nmcli settings are written to configuration files, so they persist after reboot.

Configuration Files — /etc/sysconfig/network-scripts

  • The traditional permanent network configuration on Red Hat-family systems lives in the /etc/sysconfig/network-scripts/ifcfg-<interface> file.
# Example /etc/sysconfig/network-scripts/ifcfg-eth0 (static IP)
DEVICE=eth0
BOOTPROTO=static        # static = static, dhcp = automatic
ONBOOT=yes              # activate automatically at boot
IPADDR=192.168.1.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
ItemMeaning
DEVICEInterface name
BOOTPROTOstatic / dhcp / none
ONBOOTIf yes, activate automatically at boot
IPADDR / NETMASKIP address / subnet mask
GATEWAYDefault gateway
DNS1 / DNS2Name servers

⚠️ Trap: with ONBOOT=no, the interface does not come up at boot even if all the IP settings are correct, so the network does not work. It is the cause of the "settings are right but no connection after boot" problem. Debian/Ubuntu-family systems use /etc/network/interfaces or netplan (/etc/netplan/*.yaml) instead of this file.

The ifcfg- file is the method Red Hat has used for a long time, and recent RHEL is internally moving to NetworkManager keyfiles (/etc/NetworkManager/system-connections/). The exam still asks about the traditional ifcfg-eth0 format and the meaning of the entries in it.

Gateways and Routing — The Way Out

  • Hosts within the same network (subnet) communicate directly.
  • To reach a different network, traffic must go through a gateway (router).
  • The routing table decides "which path to send traffic on to reach which destination".
# Check the routing table
ip route show
# default via 192.168.1.1 dev eth0           ← default gateway
# 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.10
 
# Add a default gateway (temporary)
ip route add default via 192.168.1.1
 
# Add a static route to a specific network
ip route add 10.0.0.0/24 via 192.168.1.254
 
# Delete a route
ip route del 10.0.0.0/24

Key distinction: the default (0.0.0.0/0) route is the default gateway that handles "all other destinations". If the routing table has no default, hosts on the same subnet can communicate but the Internet is unreachable. "Internal ping works but external ping fails" = most likely a default gateway configuration problem.

DNS Configuration — /etc/resolv.conf

  • The file that specifies which server to send DNS queries to (to convert names (domains) into IPs) is /etc/resolv.conf.
# Example /etc/resolv.conf
nameserver 8.8.8.8        # primary name server
nameserver 8.8.4.4        # secondary name server
search example.com        # automatic domain completion (appended when only a hostname is typed)
ItemMeaning
nameserverIP of the DNS server to send queries to (tried in order from the top)
searchDomain automatically appended when only a hostname is used, without a domain
domainLocal domain name

On systems managed by NetworkManager, even if you edit /etc/resolv.conf directly, the change can be overwritten on reboot or restart and lost. Permanent DNS configuration should be done with nmcli con mod ... ipv4.dns or DNS1/DNS2 in the ifcfg file. This "direct edit gets wiped" phenomenon is a trap both on the exam and in practice.

/etc/hosts — A Static Mapping Checked Before DNS

  • /etc/hosts is the static hostname-to-IP mapping file that the system consults first, before a DNS query.
# Example /etc/hosts
127.0.0.1   localhost
::1         localhost
192.168.1.50  webserver.local webserver
  • The name resolution order (which source to check first) is set by the hosts: line of /etc/nsswitch.conf.
# /etc/nsswitch.conf
hosts:  files dns       # files (= /etc/hosts) first, then dns

Because the order is files dns, if there is an entry in /etc/hosts it is matched before DNS. So if you write a wrong IP in hosts, you will be connected to the wrong place even when DNS is healthy. Conversely, it is useful for testing small host mappings without DNS.

Try It Yourself — A Configuration Check Routine

# 1. IP and interface status
ip addr show
 
# 2. Check the default gateway
ip route show | grep default
 
# 3. Check the DNS servers
cat /etc/resolv.conf
 
# 4. Can we reach the gateway?
ping -c 3 192.168.1.1
 
# 5. Does name resolution work?
ping -c 3 google.com
  • Following these 5 steps in order quickly narrows down where it is blocked along the "IP → route → name" axes.
  • If ping works by IP but not by domain name, it is a DNS problem; if it fails even to the gateway, it is an IP/route problem.

Tomorrow (Day 3) we cover the diagnostic commands that check whether these settings are actually working.

📖 Glossary

  • iproute2 / ip command: the modern standard tool that unifies ifconfig, route, and arp. It uses object (addr, link, route, neigh) + action (show, add, del, set) syntax.
  • Temporary vs permanent configuration: settings that vanish on reboot (ip addr add, ifconfig) vs settings written to files and kept (ifcfg, nmcli con mod).
  • NetworkManager / nmcli: the daemon that manages the network and its command-line tool. nmcli settings are saved to files and applied permanently.
  • connection vs device: the "configuration profile" and "physical device" that nmcli distinguishes. Edit with con mod and apply with con up.
  • ipv4.method manual / auto: the value in nmcli that decides whether to use a static IP or DHCP.
  • BOOTPROTO: the entry in an ifcfg file that decides whether it is static or dhcp (automatic).
  • ONBOOT: the entry that decides whether to bring the interface up automatically at boot. If no, the network does not work even if the settings are right.
  • Default gateway / default route: the exit that handles "all other destinations". Without it, internal communication works and only the Internet does not.
  • Static route: a rule that sends only a specific destination network to a specified gateway. ip route add network via gateway.
  • /etc/resolv.conf: the file listing the servers to send DNS queries to. In a NetworkManager environment, direct edits get overwritten.
  • search directive: the domain automatically appended when only a hostname is typed.
  • /etc/nsswitch.conf: the file that sets the order of where to look up names first. With hosts: files dns, hosts takes priority.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

What is the correct way to configure a static IP that persists after reboot on a Red Hat-family system?

Question 2

What is the most typical symptom when there is no default route in the ip route show output?

Question 3

Which modern command replaces ifconfig for checking IP addresses?

Question 4

Which statement about the relationship between /etc/hosts and DNS is correct?

Question 5

What happens when ifcfg-eth0 in /etc/sysconfig/network-scripts/ has ONBOOT=no?

Question 6

On a system managed by NetworkManager, you edited /etc/resolv.conf directly and the change disappeared after reboot. What is the correct way to configure DNS permanently?

Question 7

Which command adds a static route that sends traffic for another network, 10.0.0.0/24, to the gateway 192.168.1.254?

PreviousNetworking Basics: The OSI 7 Layers and IP Address / Subnet CalculationWeek 8 · Day 1Next Network Diagnostics: Commands That Narrow Down the Problem, from ping to tcpdumpWeek 8 · Day 3

Official references

  • Linux Master 1 official exam syllabus(opens in a new tab)

On this page

  • Key Takeaways
  • The ip Command — The Standard Tool for Modern Linux Networking
  • ifconfig and route — Legacy Commands You Should Know
  • nmcli — Command-Line Control of NetworkManager
  • Configuration Files — /etc/sysconfig/network-scripts
  • Gateways and Routing — The Way Out
  • DNS Configuration — /etc/resolv.conf
  • etc/hosts — A Static Mapping Checked Before DNS
  • Try It Yourself — A Configuration Check Routine
  • Glossary
  • Practice Questions