5.2 KiB
Introduction
This reference guide is designed to assist with diagnosing and troubleshooting common networking issues on Debian-based Linux systems, following the relevant layers of the OSI model. It includes detailed commands and explanations for each layer, along with general tips and a troubleshooting scenario.
Layer 1 (Physical Layer)
Verify Physical Connection:
- Ensure the Ethernet cable is properly connected.
- Check for link lights on the Ethernet port as a quick physical connectivity indicator.
Layer 2 (Data Link Layer)
Check Interface Status:
ip link show
Look for the UP state to confirm that the interface is active.
Ensure the Correct MAC Address:
ip link show enp6s0
This command checks the MAC address and other physical layer properties.
Layer 3 (Network Layer)
Verify IP Address Assignment:
ip addr show enp6s0
This confirms if an IP address is correctly assigned to the interface.
Check Routing Table:
ip route show
Ensure there's a valid route to the network or default gateway.
Ping Test for Local Network Connectivity:
ping -c 4 <gateway_ip>
ping -c 4 8.8.8.8
ping -c 4 www.google.com
Replace <gateway_ip> with your gateway IP address. Also, ping a public IP address (e.g., Google's DNS server 8.8.8.8) and a domain name to test external connectivity.
Layer 4 (Transport Layer)
Testing Port Accessibility:
nc -zv <destination_ip> <port>
Netcat (nc) can test TCP port accessibility to a destination IP and port.
Layer 7 (Application Layer)
DNS Resolution Test:
dig @<dns_server_ip> www.google.com
Replace <dns_server_ip> with your DNS server IP to test DNS resolution.
HTTP Connectivity Test:
curl -I www.google.com
This command checks for HTTP connectivity to a web service. The -I flag fetches only the headers. Omit it to retrieve the full webpage content.
Additional Commands and Tips
- Renew IP Address:
sudo dhclient -r enp6s0 && sudo dhclient enp6s0
This releases and renews the DHCP lease for the enp6s0 interface.
- Restart and Check Network Manager Status:
sudo systemctl restart NetworkManager
sudo systemctl status NetworkManager
This restarts the network management service and checks its status.
- View Network Manager Logs:
sudo journalctl -u NetworkManager --since today
View today's logs for NetworkManager to identify issues.
- Use
ethtoolfor Diagnosing Physical Link Status and Speed:
ethtool enp6s0
This tool provides a detailed report on the physical link status.
- System Logs for Networking Events:
dmesg | grep -i enp6s0
Check kernel ring buffer messages for the enp6s0 interface.
Troubleshooting Scenario: No Internet Connectivity
- Verify physical connection (Layer 1)
- Check interface status and IP address assignment (Layer 2 & 3)
- Ping gateway, public IP, and domain (Layer 3)
- Check DNS resolution (Layer 7)
- Restart NetworkManager and check status
- Review NetworkManager logs for any errors
- Check system logs for interface-specific messages
Notes:
- Consistent Naming Convention: This guide uses
enp6s0as an example network interface name. Replaceenp6s0with your actual interface name as necessary. - Permissions: Some commands may require
sudoto execute with administrative privileges.
This guide aims to be a comprehensive resource for networking issues on Debian-based Linux systems, following a systematic approach from the physical layer up to the application layer.
To enable (bring up) or disable (bring down) a network interface on a Debian-based Linux system, similar to performing a shut or no shut on a Cisco IOS device, you can use the ip command. This command is part of the iproute2 package, which is installed by default on most Linux distributions.
To Disable (Bring Down) the Interface:
sudo ip link set enp6s0 down
This command effectively "shuts down" the interface enp6s0, making it inactive and unable to send or receive traffic, similar to the shutdown command in Cisco IOS.
To Enable (Bring Up) the Interface:
sudo ip link set enp6s0 up
This command activates the interface enp6s0, allowing it to send and receive traffic, akin to the no shutdown command in Cisco IOS.
Verifying the Interface Status:
After enabling or disabling the interface, you may want to verify its status:
ip addr show enp6s0
or
ip link show enp6s0
These commands display the current status of the enp6s0 interface, including whether it is UP (enabled) or DOWN (disabled), along with other details like its IP address if it is configured and active.
Note:
- These commands need to be executed with
sudoor as the root user, as changing the state of network interfaces requires administrative privileges. - The changes made using these commands are temporary and will be reverted upon system reboot. To make permanent changes to the network interface state, you would need to configure the interface's startup state in the system's network configuration files or use a network manager's configuration tools.