3

I'm new to redis, but I want to set one up on my Raspberry Pi 4 (RP) for using it in a Django application (with celery).

On my RP I have installed a firewall, ufw, and allowed incomming traffic from my PC's IP on port 6379 (redis port).

I have then editted my redis.config on RP with

bind 192...... #The IP address for my pc

But now the redis-server wont start. The log writes:

Could not create server TCP listening socket 192....:6379 bind: Cannot assign requested address

If I bind 0.0.0.0 it works fine, and I can access the server from my local PC.

As far as I understand, the "bind" is like an "allow connections from this ip"but I might've misunderstood it.

Any ideas on what that error setting "means"? Is it a firewall issue? Do I miss something in my redis.config?.

Veera Nagireddy
  • 523
  • 2
  • 6
CutePoison
  • 131
  • 1
  • 3
  • 1
    Do not redact [RFC1918](https://en.wikipedia.org/wiki/Private_network)-IP's. They won't reveal anything anyway, and redacting may hide problems. – vidarlo Sep 04 '22 at 08:10

2 Answers2

3

As far as I understand, the "bind" is like an "allow connections from this ip"but I might've misunderstood it.

You have. The configuration file for redis is fairly self documenting:

# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all available network interfaces on the host machine.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
# Each address can be prefixed by "-", which means that redis will not fail to
# start if the address is not available. Being not available only refers to
# addresses that does not correspond to any network interface. Addresses that
# are already in use will always fail, and unsupported protocols will always BE
# silently skipped.

The bind directive tells redis which network interfaces to listen to, not which IP's you should accept connections from. 0.0.0.0 means all available network interfaces.

vidarlo
  • 6,654
  • 2
  • 18
  • 31
0

You can use windows firewall to restrict connection to the REDIS port. https://manage.accuwebhosting.com/knowledgebase/2984/How-to-configure-the-Windows-Firewall-to-allow-only-specific-IP-Address-to-connect-your-ports.html

Vj.bob
  • 1
  • 1