Validate Network Interface Status and IP Addresses
In this step, you will learn how to validate the network interface status and IP addresses on your Red Hat Enterprise Linux system using command-line tools. Understanding your network configuration is crucial for troubleshooting connectivity issues and managing network services.
First, let's explore the ip link command, which lists all available network interfaces on your system. This command provides a high-level overview of your network adapters, including their state (UP/DOWN), MAC addresses, and MTU (Maximum Transmission Unit).
Open your terminal. You should see a prompt similar to [labex@host ~]$.
ip link show
You will see output similar to this, showing interfaces like lo (loopback), eth0 and eth1 (Ethernet interfaces with alternative names):
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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:16:3e:0f:9e:4e brd ff:ff:ff:ff:ff:ff
altname enp0s6
altname ens6
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:16:3e:0f:9e:51 brd ff:ff:ff:ff:ff:ff
altname enp0s7
altname ens7
Note that your system has two Ethernet interfaces (eth0 and eth1) with alternative names (enp0s6/ens6 and enp0s7/ens7 respectively). The qdisc mq indicates a multi-queue network scheduler is being used for better performance.
Next, we will use the ip addr command to view detailed device and address information for a specific network interface. This command provides information about assigned IP addresses (IPv4 and IPv6), broadcast addresses, and subnet masks.
Let's check the details for your eth0 interface:
ip addr show eth0
The output will show the IP addresses assigned to eth0, including both IPv4 and IPv6 addresses if configured:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:16:3e:0f:9e:4e brd ff:ff:ff:ff:ff:ff
altname enp0s6
altname ens6
inet 172.16.50.116/24 brd 172.16.50.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::216:3eff:fe0f:9e4e/64 scope link
valid_lft forever preferred_lft forever
Notice that eth0 has the IP address 172.16.50.116/24 with the noprefixroute flag, which indicates that NetworkManager is managing the routing for this interface.
The ip -s link show command can also show statistics about network performance, such as the number of bytes and packets transmitted and received, as well as any errors or dropped packets. This is useful for a quick check of network traffic.
ip -s link show eth0
You will see statistics for the eth0 interface:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:16:3e:0f:9e:4e brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped missed mcast
90512 884 0 0 0 0
TX: bytes packets errors dropped carrier collsns
1430185 1069 0 0 0 0
altname enp0s6
altname ens6
Finally, let's verify the routing table using the ip route command. The routing table determines how network traffic is directed to its destination.
ip route
This command will display the IPv4 routing table, showing default routes and routes for specific networks. Since you have two network interfaces, you'll see multiple routes:
default via 172.16.50.253 dev eth0 proto dhcp src 172.16.50.116 metric 100
default via 172.16.50.253 dev eth1 proto dhcp src 172.16.50.117 metric 200
172.16.50.0/24 dev eth0 proto kernel scope link src 172.16.50.116 metric 100
172.16.50.0/24 dev eth1 proto kernel scope link src 172.16.50.117 metric 200
Notice there are two default routes with different metrics (100 and 200), meaning eth0 has priority due to its lower metric value. Both interfaces are connected to the same network segment (172.16.50.0/24) and use the same gateway (172.16.50.253). The eth0 interface has IP address 172.16.50.116/24 and eth1 has 172.16.50.117/24.
To view the IPv6 routing table, use the ip -6 route command:
ip -6 route
You will see the IPv6 routing entries for both interfaces:
::1 dev lo proto kernel metric 256 pref medium
fe80::/64 dev eth0 proto kernel metric 256 pref medium
fe80::/64 dev eth1 proto kernel metric 256 pref medium