Sample Header Ad - 728x90

Iptables blocks localhost from accessing redis

0 votes
1 answer
781 views
I have the following iptables rules:
`
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -s MY_IP_ADDRESS/32 -p tcp -m tcp --dport 6379 -j ACCEPT
-A INPUT -s 127.0.0.1/32 -i lo -p tcp -m tcp --dport 6379 -j ACCEPT
-A INPUT -j DROP
-A OUTPUT -p tcp -m tcp --sport 22 -j ACCEPT
`` As you can see, I can ssh into my server from everywhere, and I can access my redis db from my local IP (MY_IP_ADDRESS) and localhost. From my computer itself,
-cli -h xx.xx.xx.xx -p 6379
works. But on the server itself, I cannot connect to the redis db from
-cli
. When I delete the following iptables rule, it works again:
`
-A INPUT -j DROP
` How can I allow localhost connections to my redis server?
Asked by Sam Leurs (131 rep)
Sep 28, 2021, 08:41 PM
Last activity: Sep 28, 2021, 08:51 PM