Which Linux command provides information about a wireless network connection?

Linux provides many command-line tools to help sysadmins manage, configure, and troubleshoot network settings.

Posted: August 26, 2020 |%t min read| by Ricardo Gerardi (Sudoer, Red Hat)

Image

Which Linux command provides information about a wireless network connection?

Image by Michael Schwarzenberger from Pixabay

More Linux resources

  • Advanced Linux commands cheat sheet
  • Download RHEL 9 at no charge through the Red Hat Developer program
  • A guide to installing applications on Linux
  • Linux system administration skills assessment

Networking configuration and troubleshooting are crucial tasks that sysadmins need to perform regularly. Some of these tasks can be challenging. However, when dealing with connectivity issues, using the right tools will assist you in achieving the results in a faster and consistent way.

The ip command

The

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
2 command is an all-around utility to show and manipulate network objects on your Linux system, including IP addresses, routes, and ARP tables. It's a useful tool to configure the network, as well as to troubleshoot network connectivity issues.

The

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
2 command replaces the functionality of many commands provided with the old
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
4 package such as
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
5,
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
6, and
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
7, but it adds many other features.

In its most basic form, you can just run

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
2 and provide a network object to manipulate, such as an address, link, or route, and a subcommand to perform an action. If you do not give a subcommand, many objects default to the
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
9 subcommand to display information related to that object.

Here is the basic syntax:

ip <OBJECT> [COMMAND]

For example, to see the link status on all network devices, run

$ ip a show dev enp1s0
0:

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff

Because

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
9 is the default subcommand, you can also obtain the same result by running
$ ip a show dev enp1s0
2 or even
$ ip a show dev enp1s0
3 (many objects recognize an abbreviation).

The

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
2 command manages many objects. The main ones are:

  • $ ip a show dev enp1s0
    5 or
    $ ip a show dev enp1s0
    6 - controls the status of network devices
  • $ ip a show dev enp1s0
    7 or
    $ ip a show dev enp1s0
    8 - manipulates IP addresses on devices
  • $ ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
        link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
        inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
           valid_lft forever preferred_lft forever
        inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
           valid_lft forever preferred_lft forever
    6 or
    $ sudo ip a change 192.168.122.170 dev enp1s0
    0 - handles routing table entries
  • $ sudo ip a change 192.168.122.170 dev enp1s0
    1 or
    $ sudo ip a change 192.168.122.170 dev enp1s0
    2 - controls ARP table entries

You can see a full list of objects and commands by running

$ sudo ip a change 192.168.122.170 dev enp1s0
3.

Some useful examples of the ip command

Show network statistics

$ sudo ip a change 192.168.122.170 dev enp1s0
4 in human readable format
$ sudo ip a change 192.168.122.170 dev enp1s0
5 for a specific network interface:

$ ip -s -h l show dev enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    820M       303k     0       182k    0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    19.9M      60.9k    0       0       0       0    

Show the IP addresses of all interfaces:

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

Show the IP address of a single interface e.g., enp1s0:

$ ip a show dev enp1s0

Add another IP address to an interface (requires

$ sudo ip a change 192.168.122.170 dev enp1s0
6 or
$ sudo ip a change 192.168.122.170 dev enp1s0
7 user):

$ sudo ip a change 192.168.122.170 dev enp1s0

Display the routing table:

$ ip route
default via 192.168.122.1 dev enp1s0 proto static metric 100 
192.168.122.0/24 dev enp1s0 proto kernel scope link src 192.168.122.169 metric 100

Add a route (default gateway):

$ sudo ip route add default via 192.168.122.1 dev enp1s0

The

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
2 command is a lower-level interface to configure network options on your Linux system. While it's useful as a troubleshooting tool, it may be harder to set the network with it. For this reason, many distributions provide a higher-level interface to accomplish the same task. Next, let's take a look at the Network Manager configuration tool
$ sudo ip a change 192.168.122.170 dev enp1s0
9, which provides an integrated way to configure the network.

The nmcli tool

Network Manager is a network configuration application available by default with many Linux distributions, including RHEL and Fedora. Network Manager runs as a daemon, and its goal is to provide a higher-level interface to make network configuration easier and more automated.

It's common for users of desktop Linux or servers with a graphical interface to use Network Manager GUI clients to configure the network. For cases where you work with headless servers or if you want to automate configuration via shell scripts, the

$ sudo ip a change 192.168.122.170 dev enp1s0
9 tool comes in handy.

Network Manager and

$ sudo ip a change 192.168.122.170 dev enp1s0
9 are a versatile combination that allow you to verify and configure many network options. The basic syntax for
$ sudo ip a change 192.168.122.170 dev enp1s0
9 is:

nmcli <OBJECT> [COMMAND] [ARGUMENTS]

The most common objects are:

  • $ ip route
    default via 192.168.122.1 dev enp1s0 proto static metric 100 
    192.168.122.0/24 dev enp1s0 proto kernel scope link src 192.168.122.169 metric 100
    3 - shows Network Manager status and permissions
  • $ ip route
    default via 192.168.122.1 dev enp1s0 proto static metric 100 
    192.168.122.0/24 dev enp1s0 proto kernel scope link src 192.168.122.169 metric 100
    4 - shows, enables, and disables networking
  • $ ip route
    default via 192.168.122.1 dev enp1s0 proto static metric 100 
    192.168.122.0/24 dev enp1s0 proto kernel scope link src 192.168.122.169 metric 100
    5 - shows, enables, and disables WiFi and WWAN
  • $ ip route
    default via 192.168.122.1 dev enp1s0 proto static metric 100 
    192.168.122.0/24 dev enp1s0 proto kernel scope link src 192.168.122.169 metric 100
    6 - shows and manipulates the status of network devices
  • $ ip route
    default via 192.168.122.1 dev enp1s0 proto static metric 100 
    192.168.122.0/24 dev enp1s0 proto kernel scope link src 192.168.122.169 metric 100
    7 - manages Network Manager connection profiles

It's impossible to cover all the options on a single blog post. Let's check some examples of how to use

$ sudo ip a change 192.168.122.170 dev enp1s0
9 for common network configurations tasks. For more examples, consult the official nmcli-examples page or the man pages with
$ ip route
default via 192.168.122.1 dev enp1s0 proto static metric 100 
192.168.122.0/24 dev enp1s0 proto kernel scope link src 192.168.122.169 metric 100
9.

Check the status of network devices:

$ nmcli device status
DEVICE  TYPE      STATE      CONNECTION 
enp1s0  ethernet  connected  enp1s0
enp7s0  ethernet  disconnected  --
lo      loopback  unmanaged  -- 

Show all connection profiles:

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
0

Show details about a specific connection (e.g., enp1s0):

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
1

Retrieve specific parameters from a connection (e.g., IP address and DNS):

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
2

Modify connection parameters, e.g., switch from DHCP to manual connection:

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
3

Restart the connection to enable new options:

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
4

Add a new connection profile:

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
5

$ sudo ip a change 192.168.122.170 dev enp1s0
9 also allows you to edit a connection profile interactively. This interface provides help and auto-completion via the Tab key, which guides you through the many options available. Activate the editor using
$ sudo ip route add default via 192.168.122.1 dev enp1s0
1:

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
6


In the editor, you can define specific parameters with the

$ sudo ip route add default via 192.168.122.1 dev enp1s0
2 command. Use the Tab key auto-completion to see all available options:

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
7

Then you can

$ sudo ip route add default via 192.168.122.1 dev enp1s0
3 the current values:

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
8

When you finish your changes,

$ sudo ip route add default via 192.168.122.1 dev enp1s0
4 them to the connection and
$ sudo ip route add default via 192.168.122.1 dev enp1s0
5 to complete the operation:

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
9

Finally, restart the connection to make the changes effective.

Network Manager and

$ sudo ip a change 192.168.122.170 dev enp1s0
9 are a complete solution for network configuration. If you have never used it before, start with some of the basic commands and gradually move to more complex settings. Consult the man pages and examples to execute specific tasks.

Next, let's review some commands that help you with network troubleshooting, starting with name resolution.

The nslookup command

When managing connectivity issues, DNS name resolution is often a source of headaches. The

$ sudo ip route add default via 192.168.122.1 dev enp1s0
7 utility helps you check and troubleshoot DNS name resolution.

This command is available with the

$ sudo ip route add default via 192.168.122.1 dev enp1s0
8 package on RHEL8 and Fedora systems. Install it with
$ sudo ip route add default via 192.168.122.1 dev enp1s0
9:

$ ip -s -h l show dev enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    820M       303k     0       182k    0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    19.9M      60.9k    0       0       0       0    
0

To quickly check the name resolution for a particular host, use

$ sudo ip route add default via 192.168.122.1 dev enp1s0
7 with the hostname as an argument. The command uses the default DNS configuration for the name resolution:

$ ip -s -h l show dev enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    820M       303k     0       182k    0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    19.9M      60.9k    0       0       0       0    
1

If the name resolution fails, you can use an alternative name server for the resolution by providing its address as the third argument:

$ ip -s -h l show dev enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    820M       303k     0       182k    0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    19.9M      60.9k    0       0       0       0    
2

This information is useful for troubleshooting as it helps to identify whether the issue is local due to a specific server, or something more extensive.

You can also use it to run reverse DNS queries by providing the IP address instead of a hostname:

$ ip -s -h l show dev enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    820M       303k     0       182k    0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    19.9M      60.9k    0       0       0       0    
3

The

$ sudo ip route add default via 192.168.122.1 dev enp1s0
7 utility is a useful tool to help troubleshoot network issues related to DNS name resolution. Next, let's take a look at troubleshooting local network sockets.

The ss utility

Another common task when troubleshooting network connectivity issues is determining whether a connection is established or a particular service is available on a server.

The

nmcli <OBJECT> [COMMAND] [ARGUMENTS]
2 command, short for socket statistics, is a convenient tool that displays network socket information. It's the modern replacement for
nmcli <OBJECT> [COMMAND] [ARGUMENTS]
3 that provides similar functionality, but includes a few extra features.

Use

nmcli <OBJECT> [COMMAND] [ARGUMENTS]
2 with no options to see the complete list of all established network sockets for socket types TCP, UDP, and UNIX.

$ ip -s -h l show dev enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    820M       303k     0       182k    0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    19.9M      60.9k    0       0       0       0    
4

Since the default command displays all established network connections, this list can be extensive on a busy machine, with over a thousand entries. To help you with troubleshooting,

nmcli <OBJECT> [COMMAND] [ARGUMENTS]
2 provides several filtering options.

You can display socket information for specific socket types with the following command-line parameters:

nmcli <OBJECT> [COMMAND] [ARGUMENTS]
6 for TCP,
nmcli <OBJECT> [COMMAND] [ARGUMENTS]
7 for UDP, and
nmcli <OBJECT> [COMMAND] [ARGUMENTS]
8 for UNIX.

For example, display TCP socket information with

nmcli <OBJECT> [COMMAND] [ARGUMENTS]
9:

$ ip -s -h l show dev enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    820M       303k     0       182k    0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    19.9M      60.9k    0       0       0       0    
5

You can also filter the list by source or destination hostname or IP address. For example, here is a list of established connections for destination IP address 192.168.122.1:

$ ip -s -h l show dev enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    820M       303k     0       182k    0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    19.9M      60.9k    0       0       0       0    
6

These commands are useful to troubleshoot network connectivity in general or between specific hosts in the network. Another practical application for

nmcli <OBJECT> [COMMAND] [ARGUMENTS]
2 is to verify whether network services are listening on the local machine with the correct address and port. To verify listening sockets, use the option
$ nmcli device status
DEVICE  TYPE      STATE      CONNECTION 
enp1s0  ethernet  connected  enp1s0
enp7s0  ethernet  disconnected  --
lo      loopback  unmanaged  -- 
1:

$ ip -s -h l show dev enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    820M       303k     0       182k    0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    19.9M      60.9k    0       0       0       0    
7

You can use the same filtering options described above to filter specific socket types. For example, to list all listening TCP sockets enter:

$ ip -s -h l show dev enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    820M       303k     0       182k    0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    19.9M      60.9k    0       0       0       0    
8

Instead of displaying the service name, like

$ nmcli device status
DEVICE  TYPE      STATE      CONNECTION 
enp1s0  ethernet  connected  enp1s0
enp7s0  ethernet  disconnected  --
lo      loopback  unmanaged  -- 
2 or
$ nmcli device status
DEVICE  TYPE      STATE      CONNECTION 
enp1s0  ethernet  connected  enp1s0
enp7s0  ethernet  disconnected  --
lo      loopback  unmanaged  -- 
3,
nmcli <OBJECT> [COMMAND] [ARGUMENTS]
2 can display port numbers by using the
$ nmcli device status
DEVICE  TYPE      STATE      CONNECTION 
enp1s0  ethernet  connected  enp1s0
enp7s0  ethernet  disconnected  --
lo      loopback  unmanaged  -- 
5 option:

$ ip -s -h l show dev enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    820M       303k     0       182k    0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    19.9M      60.9k    0       0       0       0    
9

Finally, another useful option is

$ nmcli device status
DEVICE  TYPE      STATE      CONNECTION 
enp1s0  ethernet  connected  enp1s0
enp7s0  ethernet  disconnected  --
lo      loopback  unmanaged  -- 
6 to display process related information such as user name and process ID (PID). Some services may require elevated privileges via
$ sudo ip a change 192.168.122.170 dev enp1s0
6 or as
$ sudo ip a change 192.168.122.170 dev enp1s0
7 to list process information:

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
0

The

nmcli <OBJECT> [COMMAND] [ARGUMENTS]
2 tool is an essential command in the sysadmin toolbox for network troubleshooting tasks. Next, let's take a look at
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
00 to trace network connectivity between hosts.

The tracepath command

The

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
00 command is a network troubleshooting tool that displays the network connectivity path between the local host and a remote host, identifying all routers used to route the traffic between them.

In case you're unable to connect to a network service in a remote host,

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
00 helps you determine where the issue is.

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
00 is a replacement for
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
04, offering similar functionality. The main difference is that
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
00 uses random UDP ports instead of the ICMP protocol for the trace, thus not requiring elevated privileges to run.

For the basic usage, provide the hostname or IP address of the destination host. You can also provide the option

$ nmcli device status
DEVICE  TYPE      STATE      CONNECTION 
enp1s0  ethernet  connected  enp1s0
enp7s0  ethernet  disconnected  --
lo      loopback  unmanaged  -- 
5 to display IP addresses for the routers instead of their names:

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.169/24 brd 192.168.122.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7ecf:5cc8:5c1f:1009/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
1

If

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
00 cannot connect to a network hop, it displays no reply. By default, the maximum number of hops it tries is 30, which is usually enough. You can change that with the option
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
08.

Suppose it receives no replies after a particular hop. That is a good indicator where to go next for your troubleshooting task.

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
00 information is not definitive, as the traffic could be blocked for several reasons. However, it helps you narrow down the issue and focus on the resolution efforts.

For security reasons, many routers on the Internet block traffic, so

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
00 may not be as useful for tracing connectivity with Internet services. It's still useful for local network troubleshooting.

What's next?

In this article, we explored five essential network configuration and troubleshooting tools for Linux systems. These tools are powerful and provide many options that are hard to cover in a single post. We encourage you to check them out and look at documentation and man pages to see how you can incorporate them into your workflow.

There are other useful Linux network tools, such as

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
11,
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
12, and
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:b5:c7:2b brd ff:ff:ff:ff:ff:ff
13. These tools are covered in other Enable Sysadmin articles.

[ Network hard to manage? Check out Network Automation for Everyone, a free book from Red Hat. ]

Image

Which Linux command provides information about a wireless network connection?

My go-to Linux network troubleshooting commands

Every sysadmin needs a good troubleshooting strategy, and you can't fix a problem if you cannot identify it. These are my favorite commands to quickly filter through the possibilities of a given problem.

Posted: November 29, 2019

Author: Tyler Carrigan (Editorial Team, Red Hat)

Image

Which Linux command provides information about a wireless network connection?

A beginner's guide to network troubleshooting in Linux

Every system administrator needs to have at least a basic understanding of network troubleshooting. And the first rule of network troubleshooting to remember is, "Packets don't lie."

Posted: September 24, 2019

Author: Anthony Critelli (Sudoer)

Image

Which Linux command provides information about a wireless network connection?

Becoming friends with NetworkManager

Need to configure a Linux machine with NetworkManager? Learn how, and why.

Posted: August 5, 2019

Author: Francesco Giudici (Red Hat)

Topics:   Networking   Linux  

Which Linux command provides information about a wireless network connection?

Ricardo Gerardi

Ricardo Gerardi is a Senior Consultant at Red Hat Canada where he specializes in IT automation with Ansible and OpenShift.  More about me

Red Hat Summit 2022: On Demand

Get the latest on Ansible, Red Hat Enterprise Linux, OpenShift, and more from our virtual event on demand.

Register for free

Image

Which Linux command provides information about a wireless network connection?

Learn how Unix influenced Linux, understand Ansible lists and dictionaries, and more tips for sysadmin

What is the Linux command to display network connections?

netstat command – It is used to display network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. ifconfig command – It is used to display or configure a network interface. nmcli command – A command to show or configure a network interface on Linux.

How can I check Wi

Wireless connection troubleshooter.
Open a Terminal window, type lshw -C network and press Enter . ... .
Look through the information that appeared and find the Wireless interface section. ... .
If a wireless device is listed, continue on to the Device Drivers step..

How to connect to a wireless network in Linux command

Below you will see Steps to connect to a wireless network using the command line..
Determine your Network Interface. ... .
Turn on your Wireless Interface. ... .
Scan for available wireless access points. ... .
Create a WPA supplicant configuration file. ... .
Find name of your wireless driver. ... .
Connect to the internet..

Which command will show the configuration details of a wireless connection in Linux?

iwconfig Linux iwconfig is used to configure the wireless network interface. It is used to set and view the basic WI-FI details like SSID and encryption. To know more about this command, refer to the man page.