Linux ip Command: Inspect and Configure Network Interfaces and Routes

ip is an iproute2 tool for checking or changing network interfaces, IP addresses, routing, and neighbor tables. It is not a command to check just a single address, but manages Linux network states by dividing them into multiple objects.

What is the ip command?

The basic format is ip [options] object command. link deals with the interface itself, address with the assigned IP address, route with the next path of packets, and neigh with neighbor information on the same link. Queries usually end with show, but add/del/set actually change the network.

Basic syntax

ip [options] object command [arguments]

The installed implementations and options may vary depending on the distribution. Check the current system's description with man ip.

Examples

Checking interfaces and addresses

You can see the device's UP status along with assigned IPv4 and IPv6 addresses.

ip -br address show

Checking the routing table

You can check the default route and the exit interface for each destination network.

ip route show

Calculate the path to a specific destination

Check the kernel's choice of which interface and source address to use.

ip route get 192.0.2.1

How to read interface status and addresses

ip -brief address shows the name, status, and assigned address of each interface in one line. In the following example, 192.0.2.10 is a documentation address and not the value used in actual settings.

ip -brief address

Example output:

lo      UNKNOWN  127.0.0.1/8 ::1/128
eth0    UP       192.0.2.10/24

UP is the status of the interface, and /24 is the IPv4 network prefix length. Even if there is an address, it does not guarantee an internet connection, so use ip route to check routes and ping or DNS lookup to verify connectivity to the destination separately. During remote access, changing addresses or routes may disconnect the session.

To narrow a network problem, check the address with ip -brief address, the default route with ip route, and name resolution with resolvectl or a DNS tool. A valid-looking address alone does not provide outside connectivity if the default gateway is missing.

Main Options and Format

Options/Format Description
link show Display network interfaces and link status.
address show Display the IP addresses set on the interfaces.
route show Display the routing table.
neigh show Display ARP and NDP neighbor entries.
-br Output supported lookup commands in a simple table format.
-4 / -6 Limit to IPv4 or IPv6 entries.

Precautions when using

If you run ip link set ... down or change the address/default route on a remote server, the connection may be immediately lost. Record the current settings and prepare console access and a recovery plan. Changes made directly with ip may be reset by network management services or lost on reboot, so for permanent settings, follow the distribution's management method.

Frequently Asked Questions

What is the difference between ip address and ip route?

The ip address shows the addresses on interfaces, and ip route shows the routes and next hops for sending packets to destinations.

Official Documentation

The exact behavior of options and differences between implementations can be checked in the official documentation for ip.

More in This Category
Linux timedatectl Command: Check Time Zone and Time Synchronization

Linux timedatectl Command: Check Time Zone and Time Synchronization

Learn how to check Time Zone and Time Synchronization with the Linux timedatectl command, including practical examples, key options, and important precautions.

Linux env Command: Display Variables and Run Commands with a Custom Environment

Linux env Command: Display Variables and Run Commands with a Custom Environment

Learn how to use the Linux env command to display environment variables or run a command with temporary variable values, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux command Command: Run Commands While Bypassing Aliases and Functions

Linux command Command: Run Commands While Bypassing Aliases and Functions

Learn how to use the Linux command command to check command availability and bypass shell aliases or functions, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux df Command: Check Filesystem Free Space

Linux df Command: Check Filesystem Free Space

Learn how to check Filesystem Free Space with the Linux df command, including practical examples, key options, and important precautions.

Linux ssh-copy-id Command: Install a Public Key on a Remote Account

Linux ssh-copy-id Command: Install a Public Key on a Remote Account

Learn how to install a Public Key on a Remote Account with the Linux ssh-copy-id command, including practical examples, key options, and important precautions.

Linux groups Command: Show a User's Group Memberships

Linux groups Command: Show a User's Group Memberships

Learn how to show a User's Group Memberships with the Linux groups command, including practical examples, key options, and important precautions.

Linux csplit Command: Split Files at Lines or Patterns

Linux csplit Command: Split Files at Lines or Patterns

Learn how to split Files at Lines or Patterns with the Linux csplit command, including practical examples, key options, and important precautions.

Linux printf Command: Print Values with a Defined Format

Linux printf Command: Print Values with a Defined Format

Learn how to print Values with a Defined Format with the Linux printf command, including practical examples, key options, and important precautions.

Linux stat Command: Display Detailed File Metadata

Linux stat Command: Display Detailed File Metadata

Learn how to use the Linux stat command to inspect file size, permissions, ownership, timestamps, inode, and filesystem metadata, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux Tutorial / Understand Users, Groups, and File Ownership

Linux Tutorial / Understand Users, Groups, and File Ownership

Understand UIDs, GIDs, primary and supplementary groups, and file ownership, then inspect them safely with id, groups, getent, ls, and stat.