Linux network device name

HowTo: Linux Show List Of Network Cards

H ow do I display a list of all network cards under Linux operating systems?

You can use any one of the following command to list network cards installed under Linux operating systems. Please note that the ifconfig and ip commands will also display interfaces information about vpn, loopback, and other configured interfaces.

Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Linux
Est. reading time 2m
  1. lspci command : List all PCI devices.
  2. lshw command : List all hardware.
  3. dmidecode command : List all hardware data from BIOS.
  4. ifconfig command : Outdated network config utility.
  5. ip command : Recommended new network config utility.
  6. hwinfo command : Probe Linux for network cards.
  7. ethtool command : See NIC/card driver and settings on Linux.

We use standard terms, such as the network interface controller (NIC). Also known as a network interface card, network adapter, LAN adapter or physical network interface, and so on. Let us see some useful examples for displing out NIC info on Linux.

Use lspci command Linux command to show list of network cards

Type the following lspci command along with egrep command to filter out devices:
# lspci | egrep -i —color ‘network|ethernet’
# lspci | egrep -i —color ‘network|ethernet|wireless|wi-fi’
Sample outputs from my Linux server:

How to use lshw command for displaying network cards (NIC) on Linux

The lshw command can extract detailed information on the hardware configuration of the machine including network cards. Type the following command:
# lshw -class network
Detailed hardware information about network cards on Linux:

Here is another outputs:

  1. -class network : View all network cards on your Linux system
  2. -short : Display device tree showing hardware paths, very much like the output of HP-UX’s ioscan

Let us see mask, IP and other information set up for wlp82s0:
$ ip a show wlp82s0

Linux ethtool command for Ethernet hardware devices

Want to see/query or control network driver and hardware settings on Linux? Try the the ethtool command:
$ sudo ethtool enp0s31f6
And it spitted out tons of useful information for my Ethernet network card on Linux:

We can display driver information for network card too:
$ sudo ethtool -i eth0
$ sudo ethtool -i enp0s31f6

ifconfig and ip commands

To see all configured network devices, enter:
# ifconfig -a
OR
# ip link show
OR
# ip a
Sample outputs:

Want to list all IP addresses and interfaces on Linux in a tabular format for better readability? Try:
$ ip -br -c link show
$ ip -br -c addr show

Listing network cards on Linux using hwinfo command

Open the terminal and then type:
$ sudo hwinfo —network —short

We can now obtain more info for eth0 using the ip command:
$ ip a s eth0
My IP address assigned to eth0:

The /proc/net/dev file

The dev pseudo-file contains network device status information. This gives the number of received and sent packets, the number of errors and collisions and other basic statistics. Open the terminal and then type the following cat command:
$ cat /proc/net/dev
Stats:

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

Conclusion

We learned about various Linux commands to display information about installed and running network cards.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Category List of Unix and Linux commands
Documentation help • mandb • man • pinfo
Disk space analyzers df • duf • ncdu • pydf
File Management cat • cp • less • mkdir • more • tree
Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04
Linux Desktop Apps Skype • Spotify • VLC 3
Modern utilities bat • exa
Network Utilities NetHogs • dig • host • ip • nmap
OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04
Package Manager apk • apt
Processes Management bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop
Searching ag • grep • whereis • which
Shell builtins compgen • echo • printf
Text processing cut • rev
User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w
WireGuard VPN Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04

Comments on this entry are closed.

In which distro are you using the ip command? I’m trying it in Ubuntu and it seems to be a command to manipulate routing

@Chex, thanks! On Ubuntu, I was getting an error trying to run ‘ip -a’, but your command worked — and it’s very useful info.

It was a typo on part.

However, ip link show should be used.

For wireless cards I find “iwconfig” useful. I used to have problems with a wireless adapter going offline, which I worked around with “iwconfig wlan0 power off” to turn off its power management feature.

It would be most useful to correlate the HW info to the logical device name, such as the Broadcom NIC is eth1.

Try ethtool or lspci it will map both along with driver name:

Writing a shell script left as an exercise for the reader.

At any point is this site going to post anything that isn’t basic common knowledge to any linux users that isnt a complete noob?

Because if not, then I’m going to unsubscribe from your RSS feed.

I can not stop you or anyone else from unsubscribing to our RSS feed. The /faq/ section is for new users only so it has all sort of questions and answers. As you may have noticed that I’ve already started to display the difficulty level for each Q & A. I’m also working on rss feed for all three difficulties. So that users can only subscribe as follows:

  • Easy – for beginners.
  • Moderate – for Intermediate users.
  • Hard – for Advanced users.

This is going to take a little more time as need some sort of coding and modification on my part. Hope this helps.

ok, so idioms for the easy/intermediate/hard would be ubuntu/debian/all others? ^^

Nah, but linux is no longer for those who actually are bothered to learn how to use a computer (as opposed to the in ‘noob-land’), learn how to use windows. Now, many of the windows users who are just ‘end users’ and not computer savvy, migrate to linux, and will inadvertedly land on ubuntu like distros.

I recall on youtube, some user saying, I have been using Ubuntu for 6 months and consider myself fairly knowledgable, and then went on about DE if they are installable in other distros and what not. I don’t even know what it was, but it was so absurd, I am glad that person uttered Ubuntu and not linux, as clearly the person was clueless in the latter.

You can blame Canonical for such issue. Just visit http://www.ubuntu.com/desktop home page and try to find out word Linux. I think they are ashamed of using word Linux.

PS: I use Debian Linux 🙂

[updated] Various aspects of nixCraft can be monitored with RSS feeds including ability to sort out feed – https://www.cyberciti.biz/nixcraft-rss-feed-syndication/

Hope this helps!

@root
I don’t suppose you have noticed that at least 99% of the worlds population are at least some variant of a linux ‘noob’. It would indeed be pointless to run a web site for just the 1% who are whizz kids as you would have very few visitors indeed.

Also, I believe it should be ‘to any linux user who isn’t’

I’ve clearly lost the plot a little myself, ‘at least’ and ‘indeed’ twice in above comment. Have to stop taking these tablets.

In your scripts, the easiest way is to do something like this.

for x in `/sbin/ifconfig | grep Link | awk ‘’ | sort | egrep -v ‘inet6|lo’`
do
echo $x
done

Or you can /sbin/ifconfig $x | grep to extract and read the data into a variable to work on later.

Here is a small code you can use in your scripts.

for x in `/sbin/ifconfig | grep Link | awk ‘’ | sort | egrep -v ‘inet6|lo’`
do
echo $x
done

You can replace echo $x with
/sbin/ifconfig $x | grep (any property you are looking for) and read that into a variable.

I think some of the posts are not being accepted in the comments, Vivek. Not sure why. I thought first it was something in my browser.
I sure hope I didn’t have duplicates in the comments. 🙂

We cache page for 15 minutes. So you will not see updates immediately.

how to check the nic card settings in linux

What distro?
What specifics you are looking for?
If you mean network settings for each card, depending on your distro, it can be found at

For Redhat based distros
/etc/sysconfig/network-scripts/ifcfg-[device Name]

For Debian based distros
/etc/network/interfaces

For in depth, in detail information other settings about your network card, use ethtool.

Run
man ethtool

i have dell and i have wireless in my neighbours but shows me red cross so what i do please

I am new in linux.
now I have problem with my X-Server installation.

my machine used Red Hat V7,2
and my card is used AGX3281.

this is I did for replaced the old card, but I did with the same type.

after I finished the install the X-server, and run startx,
[root@barco1 root]# startx

xinit: No such file or directory (errno 2): no server “X” in PATH

Use the — option, or make sure that /usr/X11R6/bin is in your path and
that “X” is a program or a link to the right type of server
for your display. Possible server names include:

XFree86 XFree86 displays

giving up.
xinit: Connection refused (errno 111): unable to connect to X server
xinit: No such process (errno 3): Server error.

and when I start lspci
[root@barco1 root]# lspci
00:00.0 Host bridge: Intel Corp.: Unknown device 2770 (rev 02)
00:02.0 Display controller: Intel Corp.: Unknown device 2772 (rev 02)
00:1c.0 PCI bridge: Intel Corp.: Unknown device 27d0 (rev 01)
00:1c.1 PCI bridge: Intel Corp.: Unknown device 27d2 (rev 01)
00:1c.2 PCI bridge: Intel Corp.: Unknown device 27d4 (rev 01)
00:1c.3 PCI bridge: Intel Corp.: Unknown device 27d6 (rev 01)
00:1d.0 USB Controller: Intel Corp.: Unknown device 27c8 (rev 01)
00:1d.1 USB Controller: Intel Corp.: Unknown device 27c9 (rev 01)
00:1d.2 USB Controller: Intel Corp.: Unknown device 27ca (rev 01)
00:1d.3 USB Controller: Intel Corp.: Unknown device 27cb (rev 01)
00:1d.7 USB Controller: Intel Corp.: Unknown device 27cc (rev 01)
00:1e.0 PCI bridge: Intel Corp. 82801BAM PCI (rev e1)
00:1f.0 ISA bridge: Intel Corp.: Unknown device 27b8 (rev 01)
00:1f.2 IDE interface: Intel Corp.: Unknown device 27c0 (rev 01)
00:1f.3 SMBus: Intel Corp.: Unknown device 27da (rev 01)
0b:05.0 PCI bridge: Intel Corp.: Unknown device b154
0b:0b.0 Ethernet controller: Intel Corp. 82541PI Gigabit Ethernet Controller (re
v 05)
0c:00.0 VGA compatible controller: ATI Technologies Inc: Unknown device 4c57
0c:01.0 VGA compatible controller: ATI Technologies Inc: Unknown device 4c57
0c:02.0 VGA compatible controller: ATI Technologies Inc: Unknown device 4c57
0c:03.0 VGA compatible controller: ATI Technologies Inc: Unknown device 4c57
0c:04.0 Host bridge: NEC Corporation Vrc5074 [Nile 4] (rev 03)

Источник

Red Hat Customer Portal

Log in to Your Red Hat Account

Your Red Hat account gives you access to your profile, preferences, and services, depending on your status.

If you are a new customer, register now for access to product evaluations and purchasing capabilities.

Need access to an account?

If your company has an existing Red Hat account, your organization administrator can grant you access.

Red Hat Account

Customer Portal

For your security, if you’re on a public computer and have finished using your Red Hat services, please be sure to log out.

Select Your Language

Red Hat Training

A Red Hat training course is available for RHEL 8

Chapter 1. Consistent network interface device naming

Red Hat Enterprise Linux provides methods for consistent and predictable device naming for network interfaces. These features help locating and differentiating network interfaces.

The kernel assigns names to network interfaces by concatenating a fixed prefix and a number that increases as the kernel initialize the network devices. For instance, eth0 would represent the first device being probed on start-up. However, these names do not necessarily correspond to labels on the chassis. Modern server platforms with multiple network adapters can encounter non-deterministic and counter-intuitive naming of these interfaces. This affects both network adapters embedded on the system board and add-in adapters.

In Red Hat Enterprise Linux, the udev device manager supports a number of different naming schemes. By default, udev assigns fixed names based on firmware, topology, and location information. This has the following advantages:

  • Device names are fully predictable.
  • Device names stay fixed even if you add or remove hardware, because no re-enumeration takes places.
  • Defective hardware can be seamlessly replaced.

1.1. Network interface device naming hierarchy

If consistent device naming is enabled, which is the default in Red Hat Enterprise Linux, the udev device manager generates device names based on the following schemes:

Device names incorporate firmware or BIOS-provided index numbers for onboard devices. If this information is not available or applicable, udev uses scheme 2.

Device names incorporate firmware or BIOS-provided PCI Express (PCIe) hot plug slot index numbers. If this information is not available or applicable, udev uses scheme 3.

Device names incorporate the physical location of the connector of the hardware. If this information is not available or applicable, udev uses scheme 5.

Device names incorporate the MAC address. Red Hat Enterprise Linux does not use this scheme by default, but administrators can optionally use it.

The traditional unpredictable kernel naming scheme. If udev cannot apply any of the other schemes, the device manager uses this scheme.

By default, Red Hat Enterprise Linux selects the device name based on the NamePolicy setting in the /usr/lib/systemd/network/99-default.link file. The order of the values in NamePolicy is important. Red Hat Enterprise Linux uses the first device name that is both specified in the file and that udev generated.

If you manually configured udev rules to change the name of kernel devices, those rules take precedence.

1.2. How the network device renaming works

By default, consistent device naming is enabled in Red Hat Enterprise Linux. The udev device manager processes different rules to rename the devices. The following list describes the order in which udev processes these rules and what actions these rules are responsible for:

  1. The /usr/lib/udev/rules.d/60-net.rules file defines that the /lib/udev/rename_device helper utility searches for the HWADDR parameter in /etc/sysconfig/network-scripts/ifcfg-* files. If the value set in the variable matches the MAC address of an interface, the helper utility renames the interface to the name set in the DEVICE parameter of the file.
  2. The /usr/lib/udev/rules.d/71-biosdevname.rules file defines that the biosdevname utility renames the interface according to its naming policy, provided that it was not renamed in the previous step.
  3. The /usr/lib/udev/rules.d/75-net-description.rules file defines that udev examines the network interface device and sets the properties in udev -internal variables, that will be processed in the next step. Note that some of these properties might be undefined.

The /usr/lib/udev/rules.d/80-net-setup-link.rules file calls the net_setup_link udev built-in which then applies the policy. The following is the default policy that is stored in the /usr/lib/systemd/network/99-default.link file:

With this policy, if the kernel uses a persistent name, udev does not rename the interface. If the kernel does not use a persistent name, udev renames the interface to the name provided by the hardware database of udev . If this database is not available, Red Hat Enterprise Linux falls back to the mechanisms described above.

Alternatively, set the NamePolicy parameter in this file to mac for media access control (MAC) address-based interface names.

The /usr/lib/udev/rules.d/80-net-setup-link.rules file defines that udev renames the interface based on the udev -internal parameters in the following order:

  1. ID_NET_NAME_ONBOARD
  2. ID_NET_NAME_SLOT
  3. ID_NET_NAME_PATH

If one parameter is not set, udev uses the next one. If none of the parameters are set, the interface is not renamed.

Steps 3 and 4 implement the naming schemes 1 to 4 described in Network interface device naming hierarchy.

Additional resources

  • Customizing the prefix of Ethernet interfaces
  • For details about the NamePolicy parameter, see the systemd.link(5) man page.

1.3. Predictable network interface device names on the x86_64 platform explained

When the consistent network device name feature is enabled, the udev device manager creates the names of devices based on different criteria. This section describes the naming scheme when Red Hat Enterprise Linux is installed on a x86_64 platform.

The interface name starts with a two-character prefix based on the type of interface:

  • en for Ethernet
  • wl for wireless LAN (WLAN)
  • ww for wireless wide area network (WWAN)

Additionally, one of the following is appended to one of the above-mentioned prefix based on the schema the udev device manager applies:

Note that all multi-function PCI devices have the [f ] number in the device name, including the function 0 device.

The [P ] part defines the PCI geographical location. This part is only set if the domain number is not 0 .

For USB devices, the full chain of port numbers of hubs is composed. If the name is longer than the maximum (15 characters), the name is not exported. If there are multiple USB devices in the chain, udev suppresses the default values for USB configuration descriptors ( c1 ) and USB interface descriptors ( i0 ).

1.4. Predictable network interface device names on the System z platform explained

When the consistent network device name feature is enabled, the udev device manager on the System z platform creates the names of devices based on the bus ID. The bus ID identifies a device in the s390 channel subsystem.

For a channel command word (CCW) device, the bus ID is the device number with a leading 0.n prefix where n is the subchannel set ID.

Ethernet interfaces are named, for example, enccw0.0.1234 . Serial Line Internet Protocol (SLIP) channel-to-channel (CTC) network devices are named, for example, slccw0.0.1234 .

Use the znetconf -c or the lscss -a commands to display available network devices and their bus IDs.

1.5. Disabling consistent interface device naming during the installation

This section describes how to disable consistent interface device naming during the installation.

Red Hat recommends not to disable consistent device naming. Disabling consistent device naming can cause different kind of problems. For example, if you add another network interface card to the system, the assignment of the kernel device names, such as eth0 , is no longer fixed. Consequently, after a reboot, the Kernel can name the device differently.

Procedure

  1. Boot the Red Hat Enterprise Linux 8 installation media.
  2. In the boot manager, select Install Red Hat Enterprise Linux 8 , and press the Tab key to edit the entry.

Append the net.ifnames=0 parameter to the kernel command line:

  • Press Enter to start the installation.
  • Additional resources

    1.6. Disabling consistent interface device naming on an installed system

    This section describes how to disable consistent interface device naming on a RHEL system that is already installed.

    Red Hat recommends not to disable consistent device naming. Disabling consistent device naming can cause different kinds of problems. For example, if you add another network interface card to the system, the assignment of the kernel device names, such as eth0 , is no longer fixed. Consequently, after a reboot, the Kernel can name the device differently.

    Prerequisites

    • The system uses consistent interface device naming, which is the default.

    Procedure

    Edit the /etc/default/grub file and append the net.ifnames=0 parameter to the GRUB_CMDLINE_LINUX variable:

    Rebuild the grub.cfg file:

    On a system with UEFI boot mode:

    On a system with legacy boot mode:

    Display the current profile names and the associated device names:

    Note which profile name and configuration file is associated with each device.

    Remove HWADDR parameters from all connection profiles:

    Display the MAC addresses that are associated with the Ethernet devices:

    Reboot the host:

    After the reboot, display the Ethernet devices and identify the new interface name based on the MAC address:

    If you compare the current output with the previous one:

    • Interface enp7s0 (MAC address 00:53:00:b6:87:c6 ) is now named eth0 .
    • Interface enp1s0 (MAC address 00:53:00:c5:98:1c ) is now named eth1 .

    Rename the configuration file:

    If no profile name is set in the configuration files, NetworkManager uses a default value. To determine the current profile name after you renamed and reloaded the connections, enter:

    You require the profile names in the next step.

    Rename the NetworkManager connection profiles and update the interface name in each profile:

    Reactivate the NetworkManager connections:

    1.7. Customizing the prefix of Ethernet interfaces

    You can customize the prefix of Ethernet interface names during the Red Hat Enterprise Linux installation.

    Red Hat does not support customizing the prefix using the prefixdevname utility on already deployed systems.

    After the RHEL installation, the udev service names Ethernet devices

    Источник

    Читайте также:  Драйвера для logitech b910 windows 10
    Оцените статью