Troubleshooting: Ethernet connections.

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
3,489
Reaction score
3,222
Credits
31,259

Network Troubleshooting in Linux​

Network issues can be frustrating, but with the right tools and knowledge, you can diagnose and fix them efficiently. This article covers some essential commands and techniques for troubleshooting network problems in Linux.

Ping and ICMP​

The ping command is used to test the reachability of a host on an IP network. It uses the Internet Control Message Protocol (ICMP) to send echo request packets to the target host and waits for an echo reply.

Example of using ping with a DNS hostname:

Code:
 ping www.example.com

Example of using ping with a local IP address:

Code:
 ping 192.168.1.1

If you can't reach the internet, your local router/gateway is usually a good second test.

Checking Connection with ethtool​

The ethtool command is used to query and control network driver and hardware settings.

Example command:

Code:
 ethtool enp38s0 | egrep 'Speed|Duplex|Auto-nego'

Explanation:

  • Speed: Shows the speed of the connection (e.g., 1000Mb/s).
  • Duplex: Indicates whether the connection is full-duplex (both send and receive simultaneously) or half-duplex (send or receive, not both).
  • Auto-negotiation: Shows if auto-negotiation is enabled, which allows devices to automatically negotiate the best speed and duplex settings.
A "Link partner" is the device at the other end of the network connection, such as a switch or router.

Checking IP Address and Netmask with ip addr​

The ip addr command displays all IP addresses and network interfaces on the system.

Example command:

Code:
 ip addr

Explanation:

  • state UP: The interface is active and can transmit data.
  • state DOWN: The interface is inactive and cannot transmit data.
The lo interface (loopback) is normal to have on all computers. Do not delete this connection.

Network Statistics with netstat -i​

The netstat -i command displays network interface statistics.

Example command:

Code:
 netstat -i

Explanation of fields:

  • RX-OK: Number of packets received without errors.
  • RX-ERR: Number of packets received with errors.
  • RX-DRP: Number of received packets dropped.
  • RX-OVR: Number of received packets dropped due to buffer overflow.
  • TX-OK: Number of packets transmitted without errors.
  • TX-ERR: Number of packets transmitted with errors.
  • TX-DRP: Number of transmitted packets dropped.
  • TX-OVR: Number of transmitted packets dropped due to buffer overflow.
Sometimes, network issues can be caused by physical ports on your computer, the switch you are connected to, or the Ethernet cable.

Tracing Route with traceroute​

The traceroute command shows the path that packets take to reach a destination.

Example command:

Code:
 traceroute www.example.com

Example output:

1 192.168.1.1 (192.168.1.1) 1.123 ms 1.098 ms 1.076 ms
2 10.0.0.1 (10.0.0.1) 2.345 ms 2.321 ms 2.299 ms
3 172.16.0.1 (172.16.0.1) 3.567 ms 3.543 ms 3.521 ms
4 203.0.113.1 (203.0.113.1) 4.789 ms 4.765 ms 4.743 ms
5 198.51.100.1 (198.51.100.1) 5.901 ms 5.877 ms 5.855 ms
6 192.0.2.1 (192.0.2.1) 6.123 ms 6.099 ms 6.077 ms
7 203.0.113.2 (203.0.113.2) 7.345 ms 7.321 ms 7.299 ms
8 198.51.100.2 (198.51.100.2) 8.567 ms 8.543 ms 8.521 ms
9 192.0.2.2 (192.0.2.2) 9.789 ms 9.765 ms 9.743 ms
10 203.0.113.3 (203.0.113.3) 10.901 ms 10.877 ms 10.855 ms

DNS Issues​

Sometimes, network problems are DNS-related. If you can reach an address by IP but not by hostname, it's likely a DNS issue.
 


Staff online


Latest posts

Top