Linux Networking: Managing Network Interfaces on Ubuntu
Linux Networking: ifconfig, Managing Network Interfaces on Ubuntu – in this guide, we’ll dive into the basics of network management in Linux using the ifconfig
command. This command allows you to configure, manage, and troubleshoot network interfaces on Ubuntu systems. Whether you’re setting up a static IP address, bringing network interfaces up or down, or monitoring network settings, ifconfig
is a crucial tool in your networking toolbox. You’ll learn how to use it to manage network interfaces effectively, troubleshoot network issues, and gain a deeper understanding of Ubuntu’s networking functionalities. Let’s explore how to efficiently configure and monitor your network interfaces using ifconfig
!
Using the ifconfig Command
The ifconfig command is part of the net-tools package, which may not be installed by default on newer distributions because it has been deprecated in favor of the ip command from the iproute2 package.
Install net-tools package
If you need to use ifconfig, you can install it using the following command:
sudo apt install net-tools -y
Displaying Interface Information
To display the current configuration for all active interfaces, simply run:
ifconfig
Information about a specific interface:
ifconfig eth0
Enabling / Disabling Interfaces
To enable an interface, you can use:
# Enable interface
ifconfig eth0 up
# Disable interface
ifconfig eth0 down
Configure IP for eth0 interface
To set IP Adress to the interface you can type:
ifconfig eth0 192.168.19.40 netmask 255.255.255.0
This change is not persistent across reboots!
The IP address is applied temporarily, and the configuration will reset once the server restarts.
To make the change persistent across reboots, modify the network configuration files. On newer versions of Ubuntu, use Netplan to configure static IPs, while older versions rely on the /etc/network/interfaces
file.
Check the foolowing link to see how to configure static IP Address with netplan.