41 Network Verification Commands

Опубликовано: 02 Ноябрь 2024
на канале: Engineering Academy Online
No
0

Network Verification Commands in Linux

Network verification commands are essential tools for diagnosing and troubleshooting network connectivity issues. These commands allow users to check network configuration, connectivity, routing, and overall network status. Here are some of the most commonly used network verification commands in Linux:

#### *1. `ping`*

**Usage**: Tests connectivity to another host.

```bash
ping hostname_or_IP
```

**Example**:
```bash
ping 8.8.8.8
```

**Description**: Sends ICMP echo request packets to the specified address and waits for replies. Useful for checking if a host is reachable.

#### *2. `traceroute` / `tracepath`*

**Usage**: Traces the path packets take to a network host.

```bash
traceroute hostname_or_IP
```
or
```bash
tracepath hostname_or_IP
```

**Example**:
```bash
traceroute google.com
```

**Description**: Displays each hop along the route to the destination, helping identify where packet loss occurs.

#### *3. `ifconfig` / `ip addr`*

**Usage**: Displays network interface configurations.

**Ifconfig**:
```bash
ifconfig
```

**ip addr**:
```bash
ip addr show
```

**Description**: Shows the current configuration, including IP addresses, netmask, and status of network interfaces.

#### *4. `netstat` / `ss`*

**Usage**: Displays network connections, routing tables, interface statistics, etc.

*Netstat* (older systems):
```bash
netstat -tuln
```

*SS* (preferred in modern systems):
```bash
ss -tuln
```

**Description**: Shows active listening ports and established connections. The `-tuln` flags display TCP/UDP connections, show listening ports, and do not resolve hostnames.

#### *5. `route` / `ip route`*

**Usage**: Displays or modifies the IP routing table.

**Route**:
```bash
route -n
```

**IP Route**:
```bash
ip route show
```

**Description**: Lists routing entries, helping verify correct routing configurations.

#### *6. `nslookup` / `dig`*

**Usage**: Queries DNS to obtain domain name or IP address mapping.

**Nslookup**:
```bash
nslookup example.com
```

**Dig**:
```bash
dig example.com
```

**Description**: Provides detailed information about DNS records, including A, AAAA, MX, and more.

#### *7. `curl` / `wget`*

**Usage**: Tests connectivity to web servers and downloads files.

**Curl**:
```bash
curl -I http://example.com
```

**Wget**:
```bash
wget http://example.com
```

**Description**: `curl` retrieves HTTP headers, while `wget` can download files. Both can be used to verify web server accessibility.

#### *8. `mtr`*

**Usage**: Combines the functionality of `ping` and `traceroute`.

```bash
mtr hostname_or_IP
```

**Example**:
```bash
mtr google.com
```

**Description**: Provides a continuous view of the route taken by packets and their round-trip times, making it useful for real-time diagnostics.

Conclusion

Using these network verification commands can help diagnose and troubleshoot connectivity issues effectively. Familiarity with these tools is essential for system administrators and users working with networked environments. If you have any questions about specific commands or need further assistance, feel free to ask!