LINUX.ORG.RU

Таймаут в Unbound

 , ,


0

1

Привет, ЛОР!

У меня тут висит Unbound в качестве кэширующего ресолвера. С апстримом он общается по DoH.

Проблема: Unbound может очень долго держать сдохшее TCP-соединение, на все запросы при этом отвечая SERVFAIL. Как установить минимальный таймаут для DoH соединения в этой штуке? В опциях этого не нашёл.

Про костыль с перезапуском Unbound в случае SERVFAIL я уже сам подумал, спасибо.

★★★★★

Последнее исправление: hateyoufeel (всего исправлений: 2)


tcp-idle-timeout: <msec>
The period Unbound will wait for a query on a TCP connection. If this timeout expires Unbound closes the connection. This option defaults to 30000 milliseconds. When the number of free incoming TCP buffers falls below 50% of the total number configured, the option value used is progressively reduced, first to 1% of the configured value, then to 0.2% of the configured value if the number of free buffers falls below 35% of the total number configured, and finally to 0 if the number of free buffers falls below 20% of the total number configured. A minimum timeout of 200 milliseconds is observed regardless of the option value used.

kto_tama ★★★★★
()
Ответ на: комментарий от hateyoufeel

Уверен?

Unbound uses the nghttp2 library to handle the HTTP/2 framing layer. This library does not take care of any I/O handling, which makes it possible to easily integrate it in the existing Unbound event loop and TCP handling. Adding HTTP/2 on top of the existing TCP code makes it possible to also use the existing TCP configuration options for the DoH connections. These existing options include the number of allowed incoming TCP connections, the TCP timeout settings, and the limits on TCP connections per client IP address or netblock.

Это из официального мануала

Pinkbyte ★★★★★
()
Ответ на: комментарий от Pinkbyte

Я проверил, если что. В моём случае это не работает.

Если почитаешь дальше, это опции сервера, т.е. это работает для входящих соединений, где Unbound отвечает по TCP и/или TLS/HTTPS. В моём же случае, Unbound является клиентом в DoH и отвечает внутри локалки по UDP.

Есличо, вот мой unbound.conf.

server:

  access-control: 172.16.0.0/16 allow
  auto-trust-anchor-file: /var/lib/unbound/root.key
  chroot: ""
  directory: /var/lib/unbound
  do-daemonize: no
  interface: 0.0.0.0
  interface: ::
  ip-freebind: yes
  pidfile: ""
  tcp-idle-timeout: 300
  tls-cert-bundle: /etc/ssl/certs/ca-certificates.crt
  username: unbound
forward-zone:
  forward-addr: <REDACTED>
  forward-tls-upstream: yes
  name: .
remote-control:
  control-cert-file: /var/lib/unbound/unbound_control.pem
  control-enable: no
  control-interface: 127.0.0.1
  control-interface: ::1
  control-key-file: /var/lib/unbound/unbound_control.key
  server-cert-file: /var/lib/unbound/unbound_server.pem
  server-key-file: /var/lib/unbound/unbound_server.key
hateyoufeel ★★★★★
() автор топика
Последнее исправление: hateyoufeel (всего исправлений: 2)
Ответ на: комментарий от hateyoufeel

Да я без наездов, сам unbound тыкал всего пару раз, как-то у меня вокруг в основном bind да dnsmasq...

Окей, а эту опцию пробовал?

tcp-reuse-timeout: <msec>

    The period Unbound will keep TCP persistent connections open to authority servers. This option defaults to 60000 milliseconds.

Тут вроде как звучит как клиентский timeout(где клиент - сам unbound).

Там еще есть серверные таймауты по udp к клиентам, но если ты правильно определил проблему(залипшие сессии к апстрим серверам), то это не то.

Pinkbyte ★★★★★
()