DF Remote uses UDP port 1235 by default.
Normally, built-in Windows and macOS firewalls will prompt to allow connections to your DF Remote server when it's enabled for the first time. If that didn't happen, or if you've accidentally dismissed the prompt, below are the instructions how to add an exception for Remote server. Note that these instructions only apply to default built-in firewall, if your're using a third-party firewall software, please refer to its documentation.
Remote server can automatically configure Windows firewall for you. To do this, execute the following command in DFHack console:
remote connect -firewall
Go to System Preferences -> Security & Privacy -> Firewall.
If the firewall is On, click the lock and then "Firewall Options..." button.
Click the plus button, and select
dwarfort.exe file in your Dwarf Fortress folder.
Due to the differences between Linux distributions, refer to the documentation for your OS.
On Ubuntu, the firewall is disabled by default. If it's enabled, you can add an exception for DF Remote with the following command in a terminal:
sudo ufw allow 1235/udp