Chapter 8: Linux Networking Fundamentals

15 min read ▅▅ Beginner 📅 Updated July 2026

OSI Model Quick Reference

Understanding layers helps troubleshoot network issues[cite: 21]:

LayerNameExampleLinux Tools
7ApplicationHTTP, SSH, DNScurl, ssh, dig[cite: 21]
6PresentationSSL/TLS, JPEGopenssl[cite: 21]
5SessionNetBIOS, RPCnetstat[cite: 21]
4TransportTCP, UDPss, netstat[cite: 21]
3NetworkIP, ICMPping, traceroute, ip route[cite: 21]
2Data LinkEthernet, MACip link, arp[cite: 21]
1PhysicalCables, Hubsethtool, mii-tool[cite: 21]

TCP vs UDP Comparison

FeatureTCPUDP
ConnectionConnection-orientedConnectionless[cite: 21]
ReliabilityGuaranteed delivery, orderingBest effort, no guarantee[cite: 21]
SpeedSlower (overhead)Faster (no handshake)[cite: 21]
Use CasesHTTP, SSH, SMTP, FTPDNS, DHCP, Streaming, VoIP[cite: 21]
Header Size20-60 bytes8 bytes[cite: 21]

Common Ports Reference

PortServiceProtocolDescription
22SSHTCPSecure Shell[cite: 21]
53DNSTCP/UDPDomain Name System[cite: 21]
80HTTPTCPWeb traffic[cite: 21]
443HTTPSTCPSecure web traffic[cite: 21]
25SMTPTCPEmail sending[cite: 21]
110POP3TCPEmail retrieval[cite: 21]
143IMAPTCPEmail access[cite: 21]
3306MySQLTCPDatabase[cite: 21]
5432PostgreSQLTCPDatabase[cite: 21]
6379RedisTCPIn-memory store[cite: 21]

🎯 Learning Objectives

  • Understand Linux networking architecture[cite: 21].
  • Identify network interfaces[cite: 21].
  • Learn IPv4, IPv6 and CIDR notation[cite: 21].
  • View network configuration and routing[cite: 21].
  • Understand basic DNS configuration[cite: 21].

📋 Prerequisites

Complete Chapters 1–7 before starting this chapter[cite: 21].

1. Linux Networking Architecture

Application ──► TCP / UDP ──► IP Layer ──► Network Interface ──► Physical Network[cite: 21]
              

Linux networking is layered, allowing applications to communicate reliably across local and remote networks[cite: 21].

2. Network Interfaces

ip link
ip addr
ip -br addr
hostname -I
InterfacePurpose
loLoopback interface[cite: 21].
eth0 / ens*Ethernet interface[cite: 21].
VLANLogical network segmentation[cite: 21].
BridgeVirtual switching[cite: 21].
Virtual NICUsed by virtual machines[cite: 21].

3. IP Addressing

ConceptExample
IPv4192.168.1.10/24[cite: 21]
Private Range10.0.0.5/16[cite: 21]
Private Range172.16.20.50/24[cite: 21]
IPv62001:db8::10/64[cite: 21]

CIDR notation combines the IP address with the network prefix length, replacing traditional subnet mask notation[cite: 21].

4. Viewing Network Information

CommandPurpose
ip addrShow IP configuration[cite: 21].
ip routeDisplay routing table[cite: 21].
hostname -IDisplay assigned IP addresses[cite: 21].
ss -tulnShow listening TCP/UDP ports[cite: 21].

5. DNS Basics

FilePurpose
/etc/resolv.confDNS server configuration[cite: 21].
/etc/hostsLocal hostname resolution[cite: 21].

6. Linux vs IBM AIX

LinuxIBM AIX
ip addrifconfig -a[cite: 21]
ip routenetstat -rn[cite: 21]
ss -tulnnetstat -an[cite: 21]

7. Hands-on Practice

  1. List all interfaces using ip link[cite: 21].
  2. Display IP addresses with ip addr[cite: 21].
  3. Show routing information[cite: 21].
  4. View listening ports[cite: 21].
  5. Inspect /etc/resolv.conf and /etc/hosts[cite: 21].

8. Common Mistakes

  • Confusing IP addresses with hostnames[cite: 21].
  • Ignoring the default gateway[cite: 21].
  • Editing DNS files without backups[cite: 21].
  • Overlooking IPv6 configuration[cite: 21].

9. Part 1 Summary

📌 Key Takeaways

  • Linux networking starts with interfaces, IP addressing and routing[cite: 21].
  • Use ip commands to inspect network configuration[cite: 21].
  • DNS relies on /etc/resolv.conf and /etc/hosts[cite: 21].
  • ss helps identify listening services[cite: 21].

10. Connectivity Testing (ping, traceroute)

ping -c 4 google.com
traceroute google.com
tracepath google.com

ping verifies basic IP connectivity[cite: 21]. traceroute and tracepath display the route packets take to a host[cite: 21].

11. Routing & Default Gateways

Route TypePurpose
Default GatewayRoute used for external networks[cite: 21].
Static RouteManually configured network path[cite: 21].
Connected RouteAutomatically created for local networks[cite: 21].

12. Network Configuration (nmcli, curl)

nmcli acts as the terminal manager for NetworkManager setups[cite: 21]. Transfer network metrics or download assets using web tools[cite: 21]:

curl https://example.com
wget https://example.com/file.zip

13. OpenSSH Remote Administration (ssh, scp)

SSH encrypts remote machine communication channels securely[cite: 21]. HARDEN access rules inside /etc/ssh/sshd_config by shutting off root parameters and passwords[cite: 21]. Distribute key pairs via ssh-keygen and ssh-copy-id[cite: 21].

14. Production Networking Troubleshooting

ProblemPossible CauseUseful Commands
Cannot SSHSSH service stopped or firewall blockedsystemctl, ss, journalctl[cite: 21]
DNS FailureIncorrect resolver configurationcat /etc/resolv.conf, ping[cite: 21]
Wrong GatewayIncorrect default routeip route[cite: 21]

Commands Covered in This Chapter

  • ip - Show or manipulate routing, devices, and policy routing[cite: 21]
  • ping - Send ICMP ECHO_REQUEST packets to network hosts[cite: 21]
  • traceroute - Print the route packets take to a network host[cite: 21]
  • ss - Dump socket statistics cleanly (modern netstat alternative)[cite: 21]
  • dig / nslookup - DNS resolution queries[cite: 21]
  • ssh / scp / sftp - OpenSSH remote suite tools[cite: 21]
  • curl / wget - Network page and asset transfer downloaders[cite: 21]
  • ufw / iptables - System packet filtering and firewall controls[cite: 21]