RabbitMQ How to Bind to 0.0.0.0
We are going to show you how to configure RabbitMQ to bind to 0.0.0.0. This is easy! Most of the other documentation I have been able to find for this is pretty bad. Hopefully this helps.
NOTE - Check first, it may already be bound to the IP that you want.
Just edit the config file like this. Set your IP and port to whatever you want.
/etc/rabbitmq/rabbitmq-env.confNODE_IP_ADDRESS=0.0.0.0 NODE_PORT=12345
Restart RabbitMQ to apply the changes:
sudo systemctl restart rabbitmq-server
Verify:
sudo netstat -nptl |grep -i beam
Key points:
- Can be configured manually
- Set to 0.0.0.0 by default in the Ubuntu package
So for me, I didn’t have to do anything. RabbitMQ was already setup to bind to 0.0.0.0 by default after I installed it from the repo on Ubuntu. This isn’t the most recommended way of installing because it may not necessarily give you the most up to date version. It is fast and easy though.
You can see in this output that it is bound to 0.0.0.0 on port 25672:
-bash-5.1# netstat -nptl |grep -i beam
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 635257/beam.smp
tcp6 0 0 :::5672 :::* LISTEN 635257/beam.smp
-bash-5.1#
I installed RabbitMQ with this command:
sudo apt install rabbitmq-server
The above package works for a quick and easy install but for prod or for a more permanant testing solution you might want to install it a bit differently. See our RabbitMQ Tutorial for more detailed instructions on how to install.