On macOS, you can open specific ports in the firewall by using the built-in firewall management tool called pfctl. Here's how you can open ports 2181 and 9092:
Open Terminal on your macOS.
Check the current status of your firewall by running the following command:
sudo pfctl -s rules
Create a new file called pf.conf by running the following command:
Explore My Other Channel for More Cool and Valuable Insights
π Youtube Learn Tech Tipsπ Tiktok
π Facebook:
sudo nano /etc/pf.conf
This command will open the `pf.conf` file in the nano text editor.
Add the following lines to the pf.conf file to allow incoming connections on ports 2181 and 9092:
rdr pass inet proto tcp from any to any port 2181 -> 127.0.0.1 port 2181
rdr pass inet proto tcp from any to any port 9092 -> 127.0.0.1 port 9092
These lines redirect incoming TCP connections on ports `2181` and `9092` to `127.0.0.1` (localhost) on the same ports.
Save the changes in the pf.conf file and exit the nano editor:
* Press Ctrl + X to exit.-> Press Y to save the changes. (Ctrl + 0 + enter for save)
* Press Enter to confirm the filename.
Load the new firewall rules by running the following command:
sudo pfctl -f /etc/pf.conf
This command will load the new rules from the `pf.conf` file.
Enable the firewall by running the following command:
sudo pfctl -e
This command will enable the firewall with the new rules.
Verify that the ports are now open by running the following command:
sudo pfctl -s rules
This command should display the updated firewall rules, including the rules for ports `2181` and `9092`.
After following these steps, the firewall on your macOS should allow incoming connections on ports 2181 and
9092.
Make sure to also check any additional firewall or security software you might have installed on your machine, as they may have their own firewall settings that need to be configured.
Please note that modifying firewall settings can have security implications. Ensure that you understand the risks and only open ports that are necessary for your specific use case.