Hello, I’ve reconfigured security group to drop Inbound default policy because I want to access some ports from only my IP (I have Outbound default policy on accept). I’ve opened ports that I wanted and as I read on google I also needed to open 53 for DNS. I opened it for all IPs on UDP and TCP protocols. I’ve also opened ICMP. But I have problems accessing websites with the hostname. For example if I try to ping google.com it is not working but if I try to ping it with IP it works just fine. When I open all ports than it starts to work with hostnames too. I’m so confused. There is my configuration (The hidden IP is my local PC’s IP):
You opened port 53 for incoming packets. That allows the world to query a DNS server running on your instance. Looking up a hostname like “google.com” sends outgoing packets on port 53.
Before I go into detail about allowing outgoing DNS queries, much of your story does not make sense. Why is your server “accessing websites”? What software is running on the server that is doing so? For now, I’m going with the theory that you really just want hostname lookup to work on your server.
The first thing to look at, is what DNS server you are using for hostname lookups. The /etc/resolv.conf file configures that. Second, use dig or host to test lookups without talking about “websites”. (Install bind-utils on Fedora or Cent-OS)
I’m making requests on API and store results on my database pretty simple stuff. I solved the problem I basically set inbound and outbound rules on default policy as it was. Then I’ve installed ufw on my machine and made firewall rules from there and that worked pretty well.