...

Linux Networking: A Simplified Guide to IP Addresses and Routing

Linux Networking: A Simplified Guide to IP Addresses and Routing
Linux Networking: A Simplified Guide to IP Addresses and Routing
by George Whittaker
Introduction

Every Linux enthusiast or administrator, at some point, encounters the need to configure or troubleshoot network settings. While the process can appear intimidating, with the right knowledge and tools, mastering Linux networking can be both enlightening and empowering. In this guide, we’ll explore the essentials of configuring IP addresses and routing on Linux systems.

Understanding Basic Networking Concepts

What is an IP address?

Every device connected to a network has a unique identifier known as an IP address. This serves as its ‘address’ in the vast interconnected world of the Internet.

  • IPv4 vs. IPv6: While IPv4 is still prevalent, its successor, IPv6, offers a larger address space and improved features. IPv4 addresses look like 192.168.1.1, whereas IPv6 addresses resemble 1200:0000:AB00:1234:0000:2552:7777:1313.

  • Public vs. Private IPs: Public IPs are globally unique and directly reachable over the Internet. Private IPs are reserved for internal network use and are not routable on the public Internet.

Subnet Masks and Gateways

A subnet mask determines which portion of an IP address is the network and which is the host. The gateway, typically a router, connects local networks to external networks.

Routing

At its core, routing is the mechanism that determines how data should travel from its source to its destination across interconnected networks.

Network Configuration Tools in Linux

Linux offers both traditional tools like ifconfig and route and modern ones like ip, nmcli, and nmtui. The choice of tool often depends on the specific distribution and the administrator’s preference.

NetworkManager and systemd-networkd have also modernized network management, providing both CLI and GUI tools for configuration.

Configuring IP Addresses in Linux

  1. Using the ip command:

    • Display Current Configuration: ip addr show
    • Assign a Static IP: ip addr add 192.168.1.10/24 dev eth0
    • Remove an IP Address: ip addr del 192.168.1.10/24 dev eth0
  2. Using nmcli for NetworkManager: