Skip to content


See a full list of ip route commands with the following command:

ip route help

json output

ip -j -br -c r show |jq
ip -j -br -c a show |jq
ip r show
ip a show
ip link show
ip m show
ip -s link

You can also see similar information for an individual network interface with:

ip -s link ls eno1

In case you need even more details, add another -s to the syntax:

ip -s -s link ls [interface]

To see a list of only the running interfaces use:

ip link ls up
ip link help

ip monitor

ip addr help

Display all devices by using the following command:

ip addr

To list all network interfaces and the associated IP address, use the command:

ip addr show

You can also see information about an individual network:

ip addr show dev [interface]

To list the IPv4 addresses, use:

ip -4 addr show

To list IPv6 addresses type:

ip -6 addr show 

Add an IP address to an interface using the command:

ip addr add [ip_address] dev [interface]

Note: If the interface specified does not exist, the output will display the Cannot find device [interface] message.

If you need to add a broadcast address to an interface use the command:

ip addr add brd [ip_address] dev [interface]

To remove an IP address from an interface type:

ip addr del [ip_address] dev [interface]

Display IP Routing Table

List all the route entries use either of the following commands:

ip route 
ip route list

With the commands above, the output displays all of the route entries in the kernel. If you need to narrow down the search, add the SELECTOR object:

ip route list SELECTOR

To view routing for a distinct network, use the following syntax:

ip route list [ip_address]

ip route add [ip_address] dev [interface]

Or you can add a new route via gateway by typing: ip route add [ip_address] via [gatewayIP]

Also, the command allows you to add a route for all addresses via the local gateway by adding the default option:

ip route add default [ip_address] dev [device]
ip route add default [network/mask] via [gatewayIP]

To delete an existing entry in the routing table, use the commands:

ip route del [ip_address]
ip route del default
ip route del [ip_address] dev [interface]

For a full list of all neigh command options use:

ip neigh help

To display neighbor tables, use the following command:

ip neigh show

The output shows the MAC addresses of devices which are part of the system and their state. The state of a device can be:

State Description
REACHABLE Signifies a valid, reachable entry until the timeout expires
PERMANENT Signifies an everlasting entry that only an administrator can remove
STALE Signifies a valid, yet unreachable entry; to check its state, the kernel checks it at the first transmission
DELAY Signifies that the kernel is still waiting for validation from the stale entry

Modify IP Neighbor Entries

  • Add a new table entry with the command:
ip neigh add [ip_address] dev [interface]
  • Or, remove an existing ARP entry:
ip neigh del [ip_address] dev [interface]

How to change MAC address on Linux

ip link show $NIC
ip link set dev $NIC down
ip link set dev $NIC address XX:YY:ZZ:AA:BB:CC
ip link set dev $NIC up

Configure color output

ip route
command ip link

Please note that this flag is ignored if -json option passsed to the ip command.

ip -c route
ip -c link

# The 'always' is default and color output is enabled regardless of stdout state

ip -c=always command1

If parameter is 'auto', stdout is checked to be a terminal before enabling color output

ip -c=auto command2

If parameter is 'never', color output is disabled ip bash

ip -c=never command3

  • Comments are closed on this article!

Last update: December 4, 2022 13:11:41