UDP/TCP ports on AWS ec2 public IP blocked

amazon ec2amazon-web-serviceselastic-beanstalkport

My goal is to receive/send UDP packet traffic on specific ports on my EC2 instance (on my eth0 private IP) via my public IP.

I am asking because I have set my security group to allow all inbound/outbound traffic on the public IP. Even thought I set my security group for the all traffic category, the ports to the public IP are not all open. After running netcat -zv publicIP 1-80 on my local machine I can see that only ports 22 and 80 are open? In the higher range +49k, none are open. Is it just something I have configured wrong, and if so what else should be configuring in order to allow the UDP traffic on port XXXXX through, or is this not possible? Thanks!

Best Answer

Running netcat -zv publicIP 1-80 will show you only the open ports for TCP, not UDP. As testing for open UDP ports using netcat or nmap is tricky, i would recommend trying the following steps to confirm that your server is listening on specific UDP port and it can accept connections to that UDP port remotely.

  1. Stop the service listening on the specific port and run netcat -luv port, replace port with the port number of the service you are testing. This will make the server listen on the specified port number.

  2. From a remote host run echo "test" | netcat -vu publicIP port, replace publicIP and port with an IP address and port number respectively. If you the text 'test' gets displayed on the server in part (1), then all is good. Otherwise check your security group and local host firewall rules. You can also use tcpdump for troubleshooting.

Related Topic