CentOS 8 / RHEL 8 uses a consistent and predictable device name for network interfaces. You are currently viewing LQ as a guest. SIOCGIFFLAGS, SIOCSIFFLAGS Get or set the active flag word of the device. Auto-negotiation : If enabled, the ethernet device itself decides whether to use either full duplex or half duplex based on the network the ethernet device attached to. $ ifconfig …

This feature helps us in locating and differentiating network interfaces. Find Available Network Interfaces On Linux. Method 1 – Using ‘ifconfig’ Command: The most commonly used method to find the network interface details is using ‘ifconfig’ command. SIOCGIFINDEX Retrieve the interface index of the interface into ifr_ifindex. We can find the available network cards in couple ways. Interface Name Before Disabling Consistent Device Naming As you can see in the below output of ip a command, my Debian system is having a network adapter called enp0s3. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Here's a small script to solve the problem . To see the status, you could use the ip command on any link objects - you can parse the output to get the particular fields you want e.g.

Use awk to print the 5th text block for Interface NAME Due to this predictable naming, your machine’s network interface name might have got changed to ensXX or enpXsX from eth0.

Use "ip route get " to figure out which ACTIVE interface has the route to internet ( or currently being used ) Output should look like : via dev enp0s3 src cache. I believe some of Linux users might still use this. 2. In order to test empirically, you can use the following to see that 16 bytes fails and 15 bytes works:

The above ethtool eth0 output displays that the “Auto-negotiation” parameter is in enabled state. Change NIC Parameter Using ethtool Option -s autoneg. If it finds an ifcfg file with a HWADDR entry matching the MAC address of an interface it renames the interface to the name given in the ifcfg file by the DEVICE directive. Welcome to, a friendly and active Linux Community. This is the only ioctl which returns its result in ifr_name. IFNAMSIZ is used in defining struct net_device's name field here. As far as the Linux-specific part of this, in recent kernel versions this is defined by IFNAMSIZ to be 16 bytes, so 15 user-visible bytes (assuming it includes a trailing null). to see just the device name and state $ ip -o link show | awk '{print $2,$9}' lo: UNKNOWN eth0: DOWN wlan0: UP SIOCGIFNAME Given the ifr_ifindex, return the name of the interface in ifr_name. What you're asking for is the network NAME .. Change Network Interface Name to eth0 on CentOS 8.