Quantcast
Channel: Azure Networking (DNS, Traffic Manager, VPN, VNET) forum
Viewing all articles
Browse latest Browse all 6513

Outbound UDP specified source port changed when crossing public VIP

$
0
0

Hi!

We have an Azure VM and we need to send UDP messages from this machine's specific UDP port. We are using .NET Class UdpClient for communications.

If we try sending messages between machines in the same Virtual Network, receiver machine shows correct source host and port.

If we cross Public VIP (between VM in different Virtual Networks or onPremises listener), source port will show a port from 1024 and up, not the selected source port.

Sender: 1.2.3.4:5000

Receiver: 5.6.7.8:5001 -> says data received from 1.2.3.4:1025 -> 1025 source port should be 5000

'Sending
Private Sub Send()
   Dim data() As Byte = System.Text.Encoding.Unicode.GetBytes("Data")
   Dim client As UdpClient = New UdpClient(5000)
   client.Send(data, data.Length, "5.6.7.8", "5001")
   client.Close()
End Sub


'Recieving
Private Sub Recieve()
   While True
      Dim remoteIPEndPoint As IPEndPoint = New IPEndPoint(IPAddress.Any, 5001)
      Dim content() As Byte = udpClient.Receive(remoteIPEndPoint)
      If content.Length > 0 Then
         Dim message As String = Encoding.ASCII.GetString(content)
         message &= remoteIPEndPoint.Address.ToString & " " & remoteIPEndPoint.Port & " " & message & vbCrLf
      End If
   End While
End Sub

I've read something about SNat (source NAT) and I'm wondering if Azure Network always translate source UDP ports on outbound communications beyond public Gateway.

We really need to preserve source port information at destination in our platform, because we have thousands of devices on Internet that only listen on specified IP:UDPPort combination.

Thanks in advance,

Antonio Sanchez

Atlantis Global System




Viewing all articles
Browse latest Browse all 6513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>