Skip to main content

Module 9: Networking

Lesson 80: ip Command

In this lesson, you'll learn how to use the ip command to assign IP addresses, manage network interfaces, configure routing, and manage ARP entries in Linux.

The ip command is a new networking command-line utility that is used to assign an IP address to a network interface or configure/update useful network variables on a Linux system.

It is a part of the iproute2 package and offers several network administration tasks such as bringing up or down network interfaces, assigning and removing IP addresses and routes, managing ARP cache, and much more.

The ip command is very similar to the old ifconfig command, but it is greatly more powerful with more functions and capabilities added to it.

The ifconfig command has been deprecated and replaced by the ip command in all modern Linux distributions.

However, the ifconfig command still works and is available for most Linux distributions.

Note: Please take a configuration file backup before making any changes.

ip Command Syntax

$ ip [OPTIONS] OBJECT [COMMAND]

ip Command Objects and Options

Object/Option Description
link Manage network interfaces
addr Manage IP addresses on interfaces
route Manage routing table entries
neigh Manage ARP cache (neighbouring objects)
show Display information about an object
add Add a new entry (address, route, ARP)
del Delete an entry
flush Remove all entries for an object
set Modify interface settings
--color Display output in colored format
-j Display output in JSON format
-p Pretty-print JSON output with indentation

1. Permanently Configure a Static IP Address

To permanently configure a static IP address in Linux, you need to update or edit the network configuration file. You must be a superuser.

Set Static IP Address in RHEL Systems:

Open and edit the network configuration file for (eth0 or eth1) using your favourite text editor. For example, assigning an IP address to the eth0 interface on RHEL-based distributions:

# vi /etc/sysconfig/network-scripts/ifcfg-eth0     # RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux

Set Static IP Address in Debian Systems:

To configure the permanent static IP address, modify the network interface configuration file /etc/network/interfaces for Debian-based distributions:

$ sudo nano /etc/network/interfaces     # Debian, Ubuntu and Mint

Next, restart network services after entering all the details using the following command:

$ sudo systemctl restart networking

2. Temporarily Configure a Static IP Address

Pro TecMint Β· Root Plan
This Article is for Root Members
Join Root to read the full article and unlock everything

Full Access to Every Article, Course & Certification Track

Join thousands of Linux professionals who use Pro TecMint to advance their careers.

Ad-free access to all premium articles
All courses: Learn Linux, Bash, Golang, Ubuntu and more
RHCSA, RHCE, LFCS & LFCA certification prep
New courses added every month
Private Telegram community & priority support
Root Plan
$8/mo
or $59/year billed annually
Save $37 with annual plan
Start Reading This Article in the Next 60 Seconds
Join Root Plan β†’