question

GRuchi-8865 avatar image
0 Votes"
GRuchi-8865 asked srbose-msft answered

Can Azure Container Instances communicate using UDP port.

I have created the UDP service which is currently deploying Azure VMs. I want to deploy the service using container instance. So want to check can Azure Container Instances communicate using UDP port.

azure-container-instances
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

srbose-msft avatar image
0 Votes"
srbose-msft answered

@GRuchi-8865 , Thank you for your question.

Azure Container instances can communicate using UDP protocol.

For Inbound traffic, please ensure that you set protocol in the ContainerPort Object appropriately.

 Name        Type    Required    Value
 protocol    enum    No          The protocol associated with the port. - TCP or UDP

[Reference]

For Outbound traffic you can verify if the Azure Container Instance is sending UDP packets executing a tool like netcat on the container. Here is an example:

 az container exec --resource-group myResourceGroup --name mynginx --exec-command "/bin/bash"
 [root@SandboxHost-xxxxxxxxxxxxxxxxxx /]# nc -vvvv -u -z -w 3 microsoft.com 20-30
 Ncat: Version 7.50 ( https://nmap.org/ncat )
 NCAT DEBUG: Using system default trusted CA certificates and those in /usr/share/ncat/ca-bundle.crt.
 NCAT DEBUG: Unable to load trusted CA certificates from /usr/share/ncat/ca-bundle.crt: error:02001002:system library:fopen:No such file or directory
 libnsock nsi_new2(): nsi_new (IOD #1)
 libnsock msevent_new(): msevent_new (IOD #1) (EID #8)
 libnsock nsock_connect_udp(): UDP connection requested to 40.113.200.201:20 (IOD #1) EID 8
 libnsock nsp_add_event(): NSE #8: Adding event
 libnsock nsock_loop(): nsock_loop() started (no timeout). 1 events pending
 libnsock nsock_trace_handler_callback(): Callback: CONNECT SUCCESS for EID 8 [40.113.200.201:20]
 Ncat: Connected to 40.113.200.201:20.
 libnsock nsi_new2(): nsi_new (IOD #2)
 libnsock msevent_new(): msevent_new (IOD #1) (EID #19)
 libnsock nsock_write(): Write request for 1 bytes to IOD #1 EID 19 [40.113.200.201:20]
 libnsock nsp_add_event(): NSE #19: Adding event
 libnsock msevent_new(): msevent_new (IOD #NULL) (EID #28)
 libnsock nsock_timer_create(): Timer created - 2000ms from now.  EID 28
 libnsock nsp_add_event(): NSE #28: Adding event
 libnsock msevent_delete(): msevent_delete (IOD #1) (EID #8)
 libnsock nsock_trace_handler_callback(): Callback: WRITE SUCCESS for EID 19 [40.113.200.201:20]
 libnsock msevent_new(): msevent_new (IOD #1) (EID #34)
 libnsock nsock_read(): Read request from IOD #1 [40.113.200.201:20] (timeout: -1ms) EID 34
 libnsock nsp_add_event(): NSE #34: Adding event
 libnsock msevent_delete(): msevent_delete (IOD #1) (EID #19)
 libnsock nsock_trace_handler_callback(): Callback: TIMER SUCCESS for EID 28
 Ncat: UDP packet sent successfully
 libnsock msevent_delete(): msevent_delete (IOD #NULL) (EID #28)
 Ncat: 1 bytes sent, 0 bytes received in 2.02 seconds.
 libnsock nsock_trace_handler_callback(): Callback: READ KILL for EID 34 [40.113.200.201:20]
 libnsock msevent_delete(): msevent_delete (IOD #1) (EID #34)
 libnsock nsi_delete(): nsi_delete (IOD #1)
 libnsock nsi_delete(): nsi_delete (IOD #2)

Thus we see:

 Ncat: UDP packet sent successfully

In the example above, nc is executed with the following flags:

 -v, --verbose              Set verbosity level (can be used several times)
 -u, --udp                  Use UDP instead of default TCP
 -z                         Zero-I/O mode, report connection status only

to send UDP packets to ports 20-30 of microsoft.com. Please use nc --help for Usage and other Options.


Hope this helps.

Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.