Linux provides a range of network configuration tools, from traditional ones like ifconfig and route to modern alternatives such as ip, nmcli, and nmtui.
The choice of tool typically depends on the specific Linux distribution and the administrator’s preferences.
NetworkManager and systemd-networkd have revolutionized network management by offering both command-line (CLI) and graphical (GUI) tools for configuration.
These tools streamline the process of configuring and managing network connections.
Table of Contents
Configuring IP Addresses in Linux
Utilizing the ip command, you can effectively manage IP addresses:
- 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
Alternatively, nmcli for NetworkManager provides a user-friendly approach:
- Display Connection Details: nmcli connection show
- Set a Static IP: nmcli con mod “Connection Name” ipv4.addresses “192.168.1.10/24” ipv4.method manual
- Activate a Connection: nmcli con up “Connection Name”
Additionally, various Linux distributions offer intuitive network configuration utilities through their respective GUI environments.
Configuring Routing in Linux
Understanding routing tables is pivotal in managing network traffic. A routing table comprises rules dictating the traffic’s path. To interact with routing tables:
View Routing Table: ip route show
To modify the routing table:
- Add a Route: ip route add 192.168.2.0/24 via 192.168.1.1
- Delete a Route: ip route del 192.168.2.0/24
- Change the Default Gateway: ip route add default via 192.168.1.1
For NetworkManager-based routing management:
Display Routes: nmcli connection show “Connection Name” | grep route