Add docs/tech_docs/linux/linux_troubleshooting2.md

This commit is contained in:
2024-03-30 03:43:41 +00:00
parent f616a6078a
commit 3ff55860d5

View File

@@ -0,0 +1,150 @@
Certainly! Below is a structured reference guide that incorporates your updates and organizes the troubleshooting steps from Layer 1 to Layer 7 of the OSI model, specifically tailored for Debian-based Linux systems. This guide is designed to be a comprehensive resource for diagnosing and resolving common networking issues.
---
### 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:
```bash
ip link show
```
Look for the `UP` state to confirm that the interface is active.
#### Ensure the Correct MAC Address:
```bash
ip link show enp6s0
```
This command checks the MAC address and other physical layer properties.
### Layer 3 (Network Layer)
#### Verify IP Address Assignment:
```bash
ip addr show enp6s0
```
This confirms if an IP address is correctly assigned to the interface.
#### Check Routing Table:
```bash
ip route show
```
Ensure there's a valid route to the network or default gateway.
#### Ping Test for Local Network Connectivity:
```bash
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:
```bash
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:
```bash
dig @<dns_server_ip> www.google.com
```
Replace `<dns_server_ip>` with your DNS server IP to test DNS resolution.
#### HTTP Connectivity Test:
```bash
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:**
```bash
sudo dhclient -r enp6s0 && sudo dhclient enp6s0
```
This releases and renews the DHCP lease for the `enp6s0` interface.
- **Restart and Check Network Manager Status:**
```bash
sudo systemctl restart NetworkManager
sudo systemctl status NetworkManager
```
This restarts the network management service and checks its status.
- **View Network Manager Logs:**
```bash
sudo journalctl -u NetworkManager --since today
```
View today's logs for NetworkManager to identify issues.
- **Use `ethtool` for Diagnosing Physical Link Status and Speed:**
```bash
ethtool enp6s0
```
This tool provides a detailed report on the physical link status.
- **System Logs for Networking Events:**
```bash
dmesg | grep -i enp6s0
```
Check kernel ring buffer messages for the `enp6s0` interface.
### Troubleshooting Scenario: No Internet Connectivity
1. Verify physical connection (Layer 1)
2. Check interface status and IP address assignment (Layer 2 & 3)
3. Ping gateway, public IP, and domain (Layer 3)
4. Check DNS resolution (Layer 7)
5. Restart NetworkManager and check status
6. Review NetworkManager logs for any errors
7. Check system logs for interface-specific messages
### Notes:
- **Consistent Naming Convention:** This guide uses `enp6s0` as an example network interface name. Replace `enp6s0` with your actual interface name as necessary.
- **Permissions:** Some commands may require `sudo` to 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.
---