Linux Essentials Preparation · lesson 17 of 23 · 25 min
Network Configuration Commands
Linux provides powerful command-line tools for network configuration and troubleshooting. The modern toolset uses the ip command (replacing legacy ifconfig/route).
ip addr — shows IP addresses for all interfaces. ip addr show eth0 for a specific interface. Replaces ifconfig.
ip link — shows and manages network interfaces (up/down state, MAC address). ip link set eth0 up.
ip route — shows and manages the routing table. ip route show. ip route add 10.0.0.0/8 via 192.168.1.1. Replaces route.
ss — socket statistics. Shows listening ports and active connections. ss -tuln — TCP/UDP listening ports with numeric output. Replaces netstat.
ping — tests ICMP connectivity. ping -c 4 8.8.8.8 sends 4 packets.
traceroute — traces the path to a destination. traceroute 8.8.8.8. Uses UDP by default on Linux (ICMP with -I).
dig — DNS lookup tool. dig Tech Camp for Kids.com. dig @8.8.8.8 Tech Camp for Kids.com queries a specific DNS server. More detailed than nslookup.
nslookup — interactive DNS query tool. nslookup Tech Camp for Kids.com.
curl — transfers data from/to URLs. curl https://example.com. curl -I shows headers only. curl -o file.html saves to file.
wget — downloads files from URLs. wget https://example.com/file.tar.gz.
Network Configuration Files
/etc/hosts — static hostname to IP mapping. Checked before DNS. Add entries: 192.168.1.10 myserver.local.
/etc/resolv.conf — DNS resolver configuration. Contains nameserver entries: nameserver 8.8.8.8. Often managed by NetworkManager or systemd-resolved.
/etc/hostname — the system’s hostname. Change with hostnamectl set-hostname newhostname.
NetworkManager — modern network management daemon. nmcli is the CLI tool. nmcli con show lists connections. nmcli device status shows interface status.
systemd-networkd — alternative network manager used in minimal/server systems. Config files in /etc/systemd/network/.
Exam Tip
ip replaces ifconfig/route. ss replaces netstat. /etc/hosts is checked before DNS. /etc/resolv.conf sets DNS servers. dig is more detailed than nslookup. ss -tuln shows listening ports.
Key Terms
Key Terms
Knowledge Check — 8 Questions
Linux Essentials — Networking on Linux
The modern replacement for ifconfig is:
- netstat
- ip addr
- ss
- route
- Answer: ip addr
The ip command (iproute2 suite) replaces legacy tools: ip addr replaces ifconfig, ip route replaces route, ss replaces netstat. ss -tuln shows:
- All network traffic
- Listening TCP and UDP ports with numeric output
- DNS cache
- Routing table
- Answer: Listening TCP and UDP ports with numeric output
ss -t (TCP) -u (UDP) -l (listening) -n (numeric) — shows which ports are open and listening on the system. /etc/hosts is checked:
- After DNS
- Before DNS
- Only if DNS fails
- Never by default
- Answer: Before DNS
/etc/hosts is checked before DNS queries (by default). Add entries here for local hostname resolution without DNS. dig @8.8.8.8 Tech Camp for Kids.com queries:
- The default DNS server
- Google’s DNS server (8.8.8.8) specifically
- All DNS servers
- The local /etc/hosts file
- Answer: Google’s DNS server (8.8.8.8) specifically
@server in dig specifies which DNS server to query — useful for testing specific DNS servers or bypassing the default. DNS server addresses are configured in:
- /etc/hostname
- /etc/hosts
- /etc/resolv.conf
- /etc/network
- Answer: /etc/resolv.conf
/etc/resolv.conf contains nameserver entries — the DNS servers the system uses for name resolution. ping -c 4 sends:
- 4 bytes per packet
- 4 packets then stops
- Packets for 4 seconds
- Packets to 4 hosts
- Answer: 4 packets then stops
-c count — ping sends exactly 4 ICMP echo requests then stops. Without -c, ping runs until interrupted (Ctrl+C). curl -I https://example.com shows:
- The full page content
- HTTP response headers only
- SSL certificate details
- DNS records
- Answer: HTTP response headers only
curl -I (or –head) sends a HEAD request — returns only the HTTP headers without the body. Useful for checking status codes and server info.
The command _____ traces the network path to a destination host.
Answer: traceroute
traceroute shows each hop (router) between your system and the destination — useful for identifying where connectivity fails.
Previous lesson: Disk management: fdisk, lsblk, df, du, mount, umount, /etc/fstab
Back to Linux Essentials Preparation
Next lesson: Boot process: BIOS/UEFI, GRUB, kernel, initramfs, systemd targets
