프록시 연결 중 업스트림 시간 초과(110: 연결 시간 초과) - Nginx/Raspberry Pi/Ubuntu 20.04

프록시 연결 중 업스트림 시간 초과(110: 연결 시간 초과) - Nginx/Raspberry Pi/Ubuntu 20.04

UDP에 대한 도움을 찾을 수 없어서 여기에 문의했습니다.

Ubuntu 20.04 및 Nginx를 실행하는 Raspberry Pis에 DNS 클러스터가 설정되어 있습니다. 프록시는 포트 53의 UDP에 사용됩니다. 이것을 프로덕션에 적용해야 하지만 오류 로그에 다음과 같은 내용이 일관되게 표시되므로 피곤합니다.

upstream timed out (110: Connection timed out) while proxying connection, udp client: 192.168.1.172, server: 0.0.0.0:53, upstream: "192.168.70.80:53", bytes fro
m/to client:72/52, bytes from/to upstream:52/72

다음은 Nginx 액세스 로그의 일부입니다(502 오류 확인).

192.168.1.136 | [29/Dec/2020:09:35:08 -0600] | UDP | 200 | 147 | 54 | 0.032 | "192.168.70.80:53"
192.168.1.172 | [29/Dec/2020:09:35:12 -0600] | UDP | 200 | 126 | 30 | 0.020 | "192.168.70.82:53"
192.168.1.172 | [29/Dec/2020:09:35:17 -0600] | UDP | 502 | 150 | 88 | 599.998 | "192.168.70.82:53"
192.168.1.172 | [29/Dec/2020:09:35:17 -0600] | UDP | 502 | 73 | 72 | 599.999 | "192.168.70.82:53"
192.168.1.172 | [29/Dec/2020:09:35:17 -0600] | UDP | 502 | 154 | 56 | 600.000 | "192.168.70.84:53" <--- HERE
192.168.2.47 | [29/Dec/2020:09:35:22 -0600] | UDP | 200 | 66 | 50 | 0.040 | "192.168.70.80:53"
192.168.1.172 | [29/Dec/2020:09:35:24 -0600] | UDP | 200 | 142 | 37 | 0.001 | "192.168.70.80:53"
192.168.1.172 | [29/Dec/2020:09:35:41 -0600] | UDP | 200 | 165 | 40 | 0.017 | "192.168.70.82:53"
192.168.1.172 | [29/Dec/2020:09:35:48 -0600] | UDP | 502 | 61 | 90 | 600.005 | "192.168.70.83:53" <--- HERE
192.168.1.172 | [29/Dec/2020:09:35:48 -0600] | UDP | 502 | 47 | 62 | 599.998 | "192.168.70.83:53" <--- HERE
192.168.1.172 | [29/Dec/2020:09:35:57 -0600] | UDP | 200 | 61 | 45 | 0.001 | "192.168.70.82:53"
192.168.1.136 | [29/Dec/2020:09:35:59 -0600] | UDP | 200 | 44 | 28 | 0.028 | "192.168.70.82:53"
192.168.1.172 | [29/Dec/2020:09:36:02 -0600] | UDP | 200 | 47 | 31 | 0.017 | "192.168.70.82:53"
192.168.1.172 | [29/Dec/2020:09:36:02 -0600] | UDP | 200 | 58 | 42 | 0.019 | "192.168.70.82:53"
192.168.1.172 | [29/Dec/2020:09:36:13 -0600] | UDP | 200 | 126 | 30 | 0.017 | "192.168.70.82:53"
192.168.1.136 | [29/Dec/2020:09:36:16 -0600] | UDP | 200 | 77 | 37 | 0.029 | "192.168.70.82:53"
192.168.2.47 | [29/Dec/2020:09:36:16 -0600] | UDP | 200 | 147 | 54 | 0.033 | "192.168.70.82:53"

백엔드가 dnsmasq를 실행 중입니다. 이 DNS 프록시를 사용하는 소수의 클라이언트가 있는데 하루 종일 로그에서 이 프록시를 보았음에도 불구하고 아무도 문제를 보고하지 않습니다.

이 Nginx 튜토리얼UDP 프록시를 설정하는 데 도움을 주었습니다.

내 내용은 다음과 같습니다 /etc/nginx/nginx.conf(http 블록은 기본값이며 사용되지 않음).

load_module /usr/lib/nginx/modules/ngx_stream_module.so;
    
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
    
events {
        worker_connections 1024;
        #multi_accept on;
}
stream {
   
    log_format dns '$remote_addr | [$time_local] | $protocol | $status | $bytes_sent | $bytes_received | $session_time | "$upstream_addr"';
    
    access_log /var/log/nginx/access.log dns;
    error_log /var/log/nginx/error.log;
    
  upstream dns_servers {
    least_conn;
    server 192.168.70.80:53 fail_timeout=20s;
    server 192.168.70.82:53 fail_timeout=20s;
    server 192.168.70.83:53 fail_timeout=20s;
    server 192.168.70.84:53 fail_timeout=20s;
  }
  server {
    listen 53 udp;
    proxy_pass dns_servers;
    proxy_timeout 10m;
    proxy_responses 1;
  }
}
http {
    
        ##
        # Basic Settings
        ##
    
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        server_tokens off;
    
        server_names_hash_bucket_size 64;
        server_name_in_redirect off;
    
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
    
        ##
        # SSL Settings
        ##
    
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;
    
        ##
        # Logging Settings
        ##
        log_format dns '[$time_local] | $remote_addr | $remote_user | $server_name $host to: $upstream_addr | '
                           '"$request" | $status | upstream_response_time $upstream_response_time msec '
                           '$msec | request_time $request_time';
    
        access_log /var/log/nginx/access.log dns;
        error_log /var/log/nginx/error.log;
    
        ##
        # Gzip Settings
        ##
    
        gzip on;
    
        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

Nginx를 사용한 것은 이번이 처음인데 왜 이것이 내 로그에 계속 나타나는지 알 수 없습니다. 이 문제를 해결하는 누락된 지시문이 있습니까? 아니면 현재 지시문 중 하나가 잘못 구성되어 있습니까?

관련 정보