# Exercise 2 — Reading a Routing Table

## Scenario

A Linux server has the following routing table (simplified from `ip route`), plus one network interface per subnet it's directly attached to:

```
Destination        Gateway          Interface   Notes
10.0.1.0/24         (directly connected)  eth0    "app" subnet
10.0.2.0/24         (directly connected)  eth1    "db" subnet
10.0.0.0/16         10.0.1.254       eth0    route to the wider internal network
0.0.0.0/0           203.0.113.1      eth2    default route (internet)
```

## Deliverables

1. **Route selection, four cases.** For each destination below, state which routing table row wins, and why (cite the longest-prefix-match rule from theory section 1):
   - `10.0.1.55`
   - `10.0.2.10`
   - `10.0.9.200`
   - `142.250.80.14`

2. **Explain the overlap.** Notice that `10.0.1.0/24` and `10.0.0.0/16` both technically contain `10.0.1.55`. Explain precisely why the `/24` row wins for that address and describe, in general terms, when a `/16` "wider" route like this one is actually useful given a more specific route already exists.

3. **Diagnose a symptom.** A teammate reports: "this server can reach `10.0.1.x` and `10.0.2.x` fine, and it can reach the internet fine, but it can't reach `10.0.5.30`, which should be part of the internal `10.0.0.0/16` network." Using only the routing table above, explain exactly why this fails, and what's missing (not: what's misconfigured, but what row's *absence* causes this).

4. **Local vs remote test.** For a host on the `10.0.1.0/24` subnet with address `10.0.1.55`, walk through the mask-AND test (theory section 3) that decides whether traffic to `10.0.1.200` is sent directly vs sent to a gateway, and do the same for traffic to `10.0.9.200`.
