I've created an AWS instance in the default VPC and I've blocked all UDP traffic in the Network ACLs. Here's how my outbound rules look:
Rule number | Type | Protocol | Port range | Destination | Allow/Deny |
---|---|---|---|---|---|
99 | All UDP | UDP (17) | All | 0.0.0.0/0 | Deny |
100 | All TCP | TCP (6) | All | 0.0.0.0/0 | Allow |
* | All traffic | All | All | 0.0.0.0/0 | Deny |
If I use traceroute
, I get nothing, as expected:
[ec2-user@ip-172-31-32-169 ~]$ traceroute 1.1.1.1
traceroute to 1.1.1.1 (1.1.1.1), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
...
However, if I use nc
, I do get a response back, which is unexpected:
[ec2-user@ip-172-31-32-169 ~]$ nc -vzu 1.1.1.1 53
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to 1.1.1.1:53.
Ncat: UDP packet sent successfully
Ncat: 1 bytes sent, 0 bytes received in 2.01 seconds.
Why does that happen? Also, it always takes 2 seconds to get a response back. Why 2 seconds?