> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Demo Checking Network Configuration

> Step by step Linux network troubleshooting guide covering interface and IP inspection, routing checks, connectivity tests, packet tracing, and listing open ports and listening services.

In this guide you'll verify a Linux system's network configuration step by step. We'll inspect interfaces and IP addresses, review the routing table, test connectivity (including DNS resolution), trace a packet path, and list open ports and listening services. Follow the sequence below as a practical troubleshooting workflow.

<Callout icon="lightbulb" color="#1CB2FE">
  Some commands (for example `ss -p` or certain `ip` operations) require root privileges to show process or full interface details. Prefix them with `sudo` or run as root when necessary.
</Callout>

## Quick command reference

| Command | Purpose | Example / Notes |
| -: | - | - |
| `ip link` | List network interfaces and link/admin state | Shows interfaces even if they have no IP address |
| `ip addr` | Show IP addresses assigned to interfaces | Use to find `inet` (IPv4) and `inet6` (IPv6) addresses |
| `ip -brief address` | Compact, one-line-per-interface summary | Good for quick inspection |
| `ip route` | Display kernel routing table (default gateway & routes) | Look for `default via ...` for outbound access |
| `ping -c <n> <target>` | Test ICMP reachability to gateway, IP or hostname | Use to verify network and DNS |
| `tracepath <host>` | Trace hop-by-hop path to a destination | Helps locate where packets are dropped |
| `ss -tulnp` | List listening TCP/UDP sockets and their processes | `-p` requires root to show processes |

## 1) Show interfaces and their status

List interfaces and their administrative/link state:

```bash theme={null}
ip link
```

Show IP addresses assigned to each interface (IPv4 and IPv6):

```bash theme={null}
ip addr
```

Example combined output demonstrating link-level state and assigned addresses. If an interface lacks `inet` or `inet6`, it cannot exchange IP traffic:

```bash theme={null}
root@control:~# ip link
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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 08:00:27:f0:46:06 brd ff:ff:ff:ff:ff:ff
    altname enx080027f04606

root@control:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
        valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
        valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:f0:46:06 brd ff:ff:ff:ff:ff:ff
    altname enx080027f04606
    inet 10.0.2.3/24 brd 10.0.2.255 scope global dynamic noprefixroute enp0s3
        valid_lft 524sec preferred_lft 524sec
    inet6 fe80::a00:27ff:fef0:4606/64 scope link noprefixroute
        valid_lft forever preferred_lft forever
```

Tip: An interface can be administratively `UP` but still lack an IP address (no `inet`/`inet6`). That interface will not participate in IP networking until an address is assigned.

## 2) Check the routing table

Display the kernel routing table to find the default gateway and any specific routes:

```bash theme={null}
ip route
```

Interpretation notes:

* Look for a line beginning with `default via` — that is the system's default route for outbound traffic.
* If the default route is missing, the system likely cannot reach external networks beyond its local subnets.

## 3) Test connectivity with ping

Use `ping` to test reachability at different layers:

* Ping the local gateway (e.g., `10.0.2.1`) — verifies local network and L2/L3 connectivity.
* Ping an external IP (e.g., `8.8.8.8`) — verifies upstream routing and Internet access.
* Ping a hostname (e.g., `google.com`) — verifies DNS resolution and downstream reachability.

Example session:

```bash theme={null}
root@control:~# ping -c 4 10.0.2.1
PING 10.0.2.1 (10.0.2.1) 56(84) bytes of data.
64 bytes from 10.0.2.1: icmp_seq=1 ttl=255 time=0.309 ms
64 bytes from 10.0.2.1: icmp_seq=2 ttl=255 time=1.160 ms
64 bytes from 10.0.2.1: icmp_seq=3 ttl=255 time=0.285 ms
64 bytes from 10.0.2.1: icmp_seq=4 ttl=255 time=0.346 ms

--- 10.0.2.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3062ms
rtt min/avg/max/mdev = 0.285/0.526/1.164/0.368 ms

root@control:~# ping -c 4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=255 time=18.1 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=255 time=16.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=255 time=18.0 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=255 time=18.4 ms

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 16.812/17.823/18.429/0.607 ms

root@control:~# ping -c 5 google.com
PING google.com (172.217.23.46) 56(84) bytes of data.
64 bytes from lcbuda-an-in-f14.1e100.net (172.217.23.46): icmp_seq=1 ttl=255 time=21.5 ms
64 bytes from lcbuda-an-in-f14.1e100.net (172.217.23.46): icmp_seq=2 ttl=255 time=19.5 ms
64 bytes from lcbuda-an-in-f14.1e100.net (172.217.23.46): icmp_seq=3 ttl=255 time=21.2 ms
64 bytes from lcbuda-an-in-f14.1e100.net (172.217.23.46): icmp_seq=4 ttl=255 time=21.0 ms
64 bytes from lcbuda-an-in-f14.1e100.net (172.217.23.46): icmp_seq=5 ttl=255 time=21.7 ms
```

Troubleshooting hints:

* If you can ping an IP (e.g., `8.8.8.8`) but not a hostname, DNS is likely the issue.
* If you can ping the gateway but not an external IP, check the default route or upstream connectivity.
* Some networks block or rate-limit ICMP. A lack of responses is not definitive proof of total unreachability.

## 4) Trace the path to a destination

Use `tracepath` to reveal each hop packets take and identify where packets are delayed or dropped:

```bash theme={null}
tracepath google.com
```

Interpreting `tracepath` output:

* Each line represents a hop (router) along the path.
* Increasing latencies are expected; repeated `*` or timeouts show where responses are blocked or lost.
* Use this to narrow the location of failures (local router, ISP, or remote network).

Example invocation (output varies by network):

```bash theme={null}
root@control:~# tracepath google.com
```

## 5) Show open ports and listening services

To see which sockets are listening and which processes own them, use `ss`:

```bash theme={null}
ss -tulnp
```

Options explained:

* `-t` : TCP sockets
* `-u` : UDP sockets
* `-l` : only listening sockets
* `-n` : numeric addresses and ports (no name resolution)
* `-p` : show process using the socket (requires root)

<Callout icon="warning" color="#FF6B6B">
  `ss -p` requires root privileges to display processes. Run as `sudo ss -tulnp` to see process names/PIDs owning the sockets. Misinterpreting listening addresses can cause services to be bound only to localhost (127.0.0.1) and appear unreachable remotely.
</Callout>

Use the output to confirm which services are bound to which interfaces and ports, and whether they are accepting connections from other hosts.

## 6) Show interfaces in a brief, summarized form

For a compact view (one line per interface) with primary addresses:

```bash theme={null}
ip -brief address
```

Example:

```bash theme={null}
root@control:~# ip -brief address
lo               UNKNOWN        127.0.0.1/8 ::1/128
enp0s3           UP             10.0.2.3/24 fe80::a00:27ff:fef0:4606/64
```

This command is useful for quick status checks or scripts that parse interface state.

***

Conclusion and practical workflow

A reliable sequence for troubleshooting network issues is:

1. Inspect link state and interfaces (`ip link`, `ip addr`, or `ip -brief address`)
2. Verify routing (`ip route`)
3. Test layer-3 reachability (`ping` to gateway, external IP, and hostname)
4. Trace the path to the destination (`tracepath`)
5. Inspect listening sockets and services (`ss -tulnp`)

Following these steps helps you pinpoint where configuration or connectivity breaks occur — whether local interface, routing, DNS, upstream connectivity, or service binding.

Links and references

* [Linux ip(8) manual](https://man7.org/linux/man-pages/man8/ip.8.html)
* [ss(8) — socket statistics](https://man7.org/linux/man-pages/man8/ss.8.html)
* [tracepath(8) manual page](https://man7.org/linux/man-pages/man8/tracepath.8.html)
* [Ping command reference](https://man7.org/linux/man-pages/man8/ping.8.html)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/red-hat-certified-system-administrator-rhcsa/module/6bd67b03-1052-4557-8920-4b79d1b17abf/lesson/f900e6aa-6cb8-4545-b8ad-282a76cfd830" />
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.