The Linux ip Command Explained Step by Step

 

Networking can feel complicated when you first start learning Linux. There are many terms, tools, and configurations that can make even simple tasks seem intimidating.

The good news is that most day to day networking checks in Linux rely on a single tool: the ip command. Once you understand a few basic ip commands, you can inspect network interfaces, check IP addresses, verify routing, and troubleshoot many connectivity issues.

This guide walks through the most practical and beginner friendly uses of the ip command, step by step. Each command is explained clearly, with examples and real world situations where it is useful.

All examples and commands in this guide come from the original tutorial script:


Understanding Network Interfaces

Before working with networking in Linux, it helps to understand one basic concept: network interfaces.

A network interface is simply a connection your system uses to communicate on a network. Common examples include:

• Ethernet connections
• WiFi connections
• Virtual interfaces created by software or containers

To view the interfaces on your system, run:

ip link

Example Output

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
3: wlan0: <BROADCAST,MULTICAST> mtu 1500

What This Output Means

lo

The lo interface is the loopback interface.
This allows the system to communicate with itself.

eth0

This is a typical Ethernet interface.

wlan0

This represents a wireless network interface.

Depending on the system, you may see modern interface names such as:

enp0s3 
ens33
wlp2s0

These names follow newer Linux naming conventions but function the same way.

Real World Example

If someone reports:

“My computer cannot connect to the network.”

One of the first things an administrator checks is whether the system even has a network interface available and active.

The ip link command quickly answers that question.


Viewing IP Addresses

Once you know the network interfaces on a system, the next step is checking which IP addresses are assigned.

Run the following command:

ip addr

Example Output

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> 
inet 192.168.1.25/24
inet6 fe80::a00:27ff:fe4e:66a1/64

Breaking Down the Output

inet

inet 192.168.1.25/24

This line shows the IPv4 address assigned to the interface.

192.168.1.25 is the address of the machine.

The /24 indicates the size of the network. For beginners, the important part is recognizing the actual IP address.

inet6

inet6 fe80::a00:27ff:fe4e:66a1/64

This line shows an IPv6 address.

Most modern Linux systems display both IPv4 and IPv6 addresses.

Real World Example

If a server cannot be reached on the network, one of the first troubleshooting steps is verifying that the system actually has an IP address assigned.

If there is no IP address present, the system cannot communicate with other machines.


Viewing Information for One Interface

On systems with multiple interfaces, the output of ip
addr
can become lengthy.

To check a specific interface, you can filter the command like this:

ip addr show eth0

Example Output

2: eth0 
inet 192.168.1.25/24

Why This Is Useful

Instead of scanning through multiple interfaces, you immediately see the configuration for the interface you care about.

Real World Example

This is especially helpful on systems such as:

• servers
• virtualization hosts
• container environments

These systems often have many network interfaces.


Checking the Routing Table

Networking requires more than just an IP address. The system must also know where to send traffic.

That information is stored in the routing table.

To view it, run:

ip route

Example Output

default via 192.168.1.1 dev eth0 
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.25

What This Means

default via 192.168.1.1

This line defines the default gateway.

If traffic is not destined for the local network, it will be sent to 192.168.1.1. This is typically the network router.

192.168.1.0/24

This represents the local network.

Traffic intended for this network remains inside the local environment.

Real World Example

If a machine can communicate with local systems but cannot access the internet, one of the first things to check is whether a default gateway exists.

The ip route command quickly confirms that.


Bringing an Interface Up or Down

Sometimes a network interface may be disabled or need to be restarted.

The ip command can enable or disable an interface directly.

Disable an Interface

sudo ip link set eth0 down

Enable an Interface

sudo ip link set eth0 up

Expected Behavior

If the command succeeds, it usually produces no output.

To verify the change, run:

ip link

Real World Example

Restarting an interface can resolve temporary connectivity problems without requiring a full system reboot.

Administrators often use this when troubleshooting unstable network connections.


Common Beginner Mistakes

Forgetting sudo

Commands that change network settings require administrative privileges.

If you see an error such as:

Operation not permitted

Run the command again using sudo.

Example:

sudo ip link set eth0 down

Using the Wrong Interface Name

Interface names differ across systems.

Before modifying an interface, always confirm the correct name:

ip link

Expecting a Success Message

Many ip commands do not display output when successful.

If nothing appears, that usually means the command worked.

You can verify by checking the interface again.


A Practical Troubleshooting Example

Imagine a situation where someone reports:

“My server cannot reach the internet.”

A simple three step workflow can often identify the problem.

Step 1 — Check Interfaces

ip link

Confirm that the network interface exists and is UP.


Step 2 — Check the IP Address

ip addr show eth0

Verify the system has a valid IP address assigned.


Step 3 — Check the Routing Table

ip route

Confirm that a default gateway is present.

If the default route is missing, the system does not know where to send internet traffic.

These three commands alone solve a large percentage of Linux networking issues.


A Small Next Step

Once you are comfortable with the commands above, a useful next step is learning how to assign a temporary IP address.

Example:

sudo ip addr add 192.168.1.50/24 dev eth0

This adds a new IP address to the interface.

This change is temporary and will disappear after the system reboots.

Temporary addresses are commonly used when testing network configurations.


Conclusion

The ip command is one of the most important networking tools in Linux. The key commands most beginners should focus on are:

ip link 
ip addr
ip route

These commands allow you to:

• view network interfaces
• check IP addresses
• inspect routing configuration

With just these tools, you can diagnose many networking issues quickly.

Work through these commands several times and the output will begin to feel familiar.