<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:宋体;}
h2
{mso-style-priority:9;
mso-style-link:"标题 2 Char";
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:18.0pt;
font-family:宋体;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.gmail-p1, li.gmail-p1, div.gmail-p1
{mso-style-name:gmail-p1;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:宋体;}
span.gmail-s1
{mso-style-name:gmail-s1;}
span.gmail-apple-converted-space
{mso-style-name:gmail-apple-converted-space;}
p.gmail-p2, li.gmail-p2, div.gmail-p2
{mso-style-name:gmail-p2;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:宋体;}
span.2Char
{mso-style-name:"标题 2 Char";
mso-style-priority:9;
mso-style-link:"标题 2";
font-family:"Cambria","serif";
font-weight:bold;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ZH-CN" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D"> I have open a ticket for this issue in
<a href="https://trac.nginx.org/nginx/ticket/1298">https://trac.nginx.org/nginx/ticket/1298</a>, but from the response, there is no perfect solution for it.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D"> Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D"> Nick<o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt">发件人<span lang="EN-US">:</span></span></b><span lang="EN-US" style="font-size:10.0pt"> nginx-devel [mailto:nginx-devel-bounces@nginx.org]
</span><b><span style="font-size:10.0pt">代表 </span></b><span lang="EN-US" style="font-size:10.0pt">Rajesh Mahindra via nginx-devel<br>
</span><b><span style="font-size:10.0pt">发送时间<span lang="EN-US">:</span></span></b><span lang="EN-US" style="font-size:10.0pt"> 2017</span><span style="font-size:10.0pt">年<span lang="EN-US">8</span>月<span lang="EN-US">3</span>日<span lang="EN-US"> 1:43<br>
</span><b>收件人<span lang="EN-US">:</span></b><span lang="EN-US"> nginx-devel@nginx.org<br>
</span><b>抄送<span lang="EN-US">:</span></b><span lang="EN-US"> Rajesh Mahindra<br>
</span><b>主题<span lang="EN-US">:</span></b><span lang="EN-US"> UDP proxy<o:p></o:p></span></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">Hi <o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">I am trying to setup nginx as a UDP load balancer using ngx_stream_core_module to load balance udp traffic across backend instances. <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">However, i see that for every incoming UDP packet from a client, nginx uses a different source port when sending the packet to the backend instance for the same UDP connection. That is throwing the backend off. I dont
want to use nginx as a transparent proxy to avoid setting up routes (since i am deploying on Google Cloud). Is there a way nginx can load balancer based on the UDP connection?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">I am using the following config:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="gmail-p1"><span class="gmail-s1"><span lang="EN-US">upstream test_upstreams {</span></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="gmail-p1"><span class="gmail-apple-converted-space"><span lang="EN-US">
</span></span><span class="gmail-s1"><span lang="EN-US">server <a href="http://104.199.242.111:6121">
104.199.242.111:6121</a>;</span></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="gmail-p1"><span class="gmail-apple-converted-space"><span lang="EN-US">
</span></span><span class="gmail-s1"><span lang="EN-US">server <a href="http://104.199.242.111:6122">
104.199.242.111:6122</a>;</span></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="gmail-p1"><span class="gmail-apple-converted-space"><span lang="EN-US"> </span></span><span lang="EN-US">hash $remote_addr consistent;<o:p></o:p></span></p>
<p class="gmail-p1"><span class="gmail-apple-converted-space"><span lang="EN-US">
</span></span><span class="gmail-s1"><span lang="EN-US">}</span></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="gmail-p2"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="gmail-p1"><span class="gmail-apple-converted-space"><span lang="EN-US">
</span></span><span class="gmail-s1"><span lang="EN-US">server {</span></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="gmail-p1"><span class="gmail-apple-converted-space"><span lang="EN-US">
</span></span><span class="gmail-s1"><span lang="EN-US">listen 443 udp;</span></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="gmail-p2"><span class="gmail-apple-converted-space"><span lang="EN-US"> </span></span><span lang="EN-US">preread_buffer_size 1500;<o:p></o:p></span></p>
<p class="gmail-p1"><span class="gmail-apple-converted-space"><span lang="EN-US">
</span></span><span class="gmail-s1"><span lang="EN-US">proxy_pass test_upstreams;</span></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="gmail-p1"><span class="gmail-apple-converted-space"><span lang="EN-US">
</span></span><span class="gmail-s1"><span lang="EN-US">proxy_timeout 10s;</span></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="gmail-p1"><span class="gmail-apple-converted-space"><span lang="EN-US"> </span></span><span lang="EN-US">proxy_responses 1;<o:p></o:p></span></p>
<p class="gmail-p2"><span class="gmail-apple-converted-space"><span lang="EN-US"> </span></span><span lang="EN-US">access_log logs/quic_access.log quic;<o:p></o:p></span></p>
<p class="gmail-p1"><span class="gmail-apple-converted-space"><span lang="EN-US">
</span></span><span class="gmail-s1"><span lang="EN-US">error_log logs/udp.log;</span></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="gmail-p1"><span class="gmail-apple-converted-space"><span lang="EN-US">
</span></span><span class="gmail-s1"><span lang="EN-US">}</span></span><span lang="EN-US"><o:p></o:p></span></p>
</div>
<h2 align="center" style="margin-bottom:18.0pt;text-align:center"><span lang="EN-US" style="font-family:"Arial","sans-serif";color:black"><o:p> </o:p></span></h2>
<div>
<p class="MsoNormal"><span lang="EN-US">Thanks<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Rajesh<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>