Welcome! Log In Create A New Profile

Advanced

Howto force Nginx resolver to use new source UDP port

November 17, 2022 05:17AM
We're using Nginx as ingress controller in a Kubernetes environment. Nginx uses a DNS service inside k8s with 1 single service-IP and multiple DNS PODs behind that.

The translation from service-IP to any of the multiple DNS PODs is done via DNAT rules.

The problem:
- Nginx establishes an UDP 'connection' on for example localIP 1.1.1.1 source-port 12345 towards serviceIP 1.2.3.4
- DNAT translates this as sourceport 12345 towards any DNS-POD; for example 2.3.4.5:53
- If DNS-POD 2.3.4.5 terminates Nginx is not aware of this because of the 'connection' towards serviceIP 1.2.3.4
- Nginx will send all future DNS request using the same tuple of serviceIP:sourcePort, so 1.1.1.1:12345 -> 1.2.3.4:53
- This will result in a timeout because the destination POD isn't there anymore

Is it possible to force Nginx to use different source UDP ports every X seconds, of after a timeout?
Subject Author Posted

Howto force Nginx resolver to use new source UDP port

jeanpaul November 17, 2022 05:17AM

Re: Howto force Nginx resolver to use new source UDP port

Maxim Dounin November 17, 2022 03:22PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 174
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready