The network is up and nothing resolves INC-2330

Open2 versionsNetworking · Medium · Investigate · about 25 min ·Linux

Lab machine

A private Linux machine with the problem already set up. Sessions last up to 60 minutes.
Depot-5 on-call opened INC-2330 at 07:20SEV-3

Since this morning's scanner container restart, depot-5 cannot resolve the API name. The on-call wants to hardcode the IP.

depot-5 is the airport depot; its scanners upload customs data that has to arrive before each flight closes.

"Network's up, API's up. Should I just hardcode the IP in scanner.conf?" (depot-5 on-call)

The IP works because the network is fine. The name fails because something between the name and the IP is not. A hardcoded IP would work until the API moves, and then fail with nobody remembering why.

Your task

Find which resolver the container uses and what it answers, then repair the container's resolver configuration so the API name resolves to its LAN address. Leave the API name in scanner.conf, and do not pin it in /etc/hosts.

On the machine

  • The container's depot/etc/nsswitch.conf, depot/etc/resolv.conf, depot/etc/hosts, depot/etc/scanner.conf
  • depot/bin/getent hosts NAME and depot/bin/curl -v URL use the container's resolver
  • dig -p <port> @<server> against each DNS server (port in TICKET.md)
  • The DHCP lease under depot/, and CHG-4471 and the image notes under docs/

Timeline

Last weekCHG-4471 retires the old depot resolver.
06:55depot-5 scanner container restarts after an image update.
07:02"Could not resolve host: api.northstar.example". Scan events queue locally.
07:20INC-2330: "Should I just hardcode the IP?"

Done when

  1. The name resolves to the API LAN address (10.0.4.12 in production, 127.0.4.12 in the lab).
  2. HTTP by name reaches the service.

Hints

Hint 1

By IP the API answers. The network is fine; the problem is turning the name into that IP.

Hint 2

Ask each DNS server directly with dig. If one gives the answer, DNS works, and the question is why the container does not get it.

Hint 3

Two files decide how the container looks up a host name: which sources to ask (nsswitch.conf), and which DNS servers (resolv.conf).

Hint 4

Fix the container's configuration, not the DNS servers, and keep the scanner addressing the API by name.

Show the solution

Confirm the layer first: by IP the API answers, by name it does not, and `dig -p <port> @127.0.10.53` returns the A record, so DNS itself works. Then find why the container's own lookups fail. Either `depot/etc/resolv.conf` still lists the retired 127.0.0.53, which answers SERVFAIL (point it at 127.0.10.53 from the DHCP lease and CHG-4471), or `depot/etc/nsswitch.conf` has `hosts: files` without `dns`, so the container never asks DNS at all (make it `hosts: files dns`). Test with `depot/bin/getent hosts` and `depot/bin/curl` by name. In production, fix the image so the next rebuild does not bring the fault back.