Skip to content

Instantly share code, notes, and snippets.

@joshrosso
Last active September 11, 2017 15:45
Show Gist options
  • Select an option

  • Save joshrosso/e051dc5cdf4f1c9c8a81f0e1d81cf4d8 to your computer and use it in GitHub Desktop.

Select an option

Save joshrosso/e051dc5cdf4f1c9c8a81f0e1d81cf4d8 to your computer and use it in GitHub Desktop.

This details an attempt to specify how docker should timeout on nameserver resolutions.

  1. systemd-resolved is on

root@ip-172-31-22-219:~ip-172-31-22-219 ~ # systemctl status systemd-resolved --no-pager ● systemd-resolved.service - Network Name Resolution Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2017-09-11 15:32:43 UTC; 7min ago Docs: man:systemd-resolved.service(8) http://www.freedesktop.org/wiki/Software/systemd/resolved http://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers http://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients Main PID: 870 (systemd-resolve) Status: "Processing requests..." Tasks: 1 Memory: 1.3M CPU: 60ms CGroup: /system.slice/systemd-resolved.service └─870 /usr/lib/systemd/systemd-resolved

Sep 11 15:32:43 localhost systemd[1]: Starting Network Name Resolution... Sep 11 15:32:43 localhost systemd-resolved[870]: Positive Trust Anchors: Sep 11 15:32:43 localhost systemd-resolved[870]: . IN DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5 Sep 11 15:32:43 localhost systemd-resolved[870]: Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa 19.172.in-addr.arpa 20.172.in-addr.arpa... Sep 11 15:32:43 localhost systemd-resolved[870]: Defaulting to hostname 'linux'. Sep 11 15:32:43 localhost systemd[1]: Started Network Name Resolution. Sep 11 15:32:44 ip-172-31-22-219 systemd-resolved[870]: System hostname changed to 'ip-172-31-22-219'. Hint: Some lines were ellipsized, use -l to show in full.


2. systemd-resolved is off; for testing purposes, to allow easy edits to /etc/resolv.conf manually.

root@ip-172-31-22-219:~ip-172-31-22-219 ~ # systemctl stop systemd-resolved && systemctl status systemd-resolved --no-pager ● systemd-resolved.service - Network Name Resolution Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: disabled) Active: inactive (dead) since Mon 2017-09-11 15:42:06 UTC; 10ms ago Docs: man:systemd-resolved.service(8) http://www.freedesktop.org/wiki/Software/systemd/resolved http://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers http://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients Main PID: 870 (code=exited, status=0/SUCCESS) Status: "Shutting down..."

Sep 11 15:32:43 localhost systemd[1]: Starting Network Name Resolution... Sep 11 15:32:43 localhost systemd-resolved[870]: Positive Trust Anchors: Sep 11 15:32:43 localhost systemd-resolved[870]: . IN DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5 Sep 11 15:32:43 localhost systemd-resolved[870]: Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa 19.172.in-addr.arpa 20.172.in-addr.arpa... Sep 11 15:32:43 localhost systemd-resolved[870]: Defaulting to hostname 'linux'. Sep 11 15:32:43 localhost systemd[1]: Started Network Name Resolution. Sep 11 15:32:44 ip-172-31-22-219 systemd-resolved[870]: System hostname changed to 'ip-172-31-22-219'. Sep 11 15:42:06 ip-172-31-22-219.us-east-2.compute.internal systemd[1]: Stopping Network Name Resolution... Sep 11 15:42:06 ip-172-31-22-219.us-east-2.compute.internal systemd[1]: Stopped Network Name Resolution. Hint: Some lines were ellipsized, use -l to show in full.


3. `/etc/resolv.conf` altered on the host with 1 bad nameserver and default timeout still in place (should be 5 seconds)

root@ip-172-31-22-219:~ip-172-31-22-219 ~ # cat /etc/resolv.conf

bad nameserver

nameserver 172.2.3.4

good nameserver

nameserver 172.31.0.2

#timeout is disabled

timeout:1

search us-east-2.compute.internal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment