On Windows

How To Allow a Port

  • Open Windows Defender Firewall
  • Go to Advanced Settings
  • Click on Inbound Rules
  • ActionNew Rule
  • Select Port
  • Select UDP then specify your port, our example: 27960
  • Ensure you Allow connection
  • Choose which network profile. Usually this would not matter for a desktop at home. Select all.
  • Give it a name and click Finish
  • Correctly added and opened, will show a green icon next to your new rule
Note: Basically same procedure to allow a program, just select Program instead of Port at the start.

How To Block a Program

  • Open Windows Defender Firewall
  • Go to Advanced Settings
  • Click on Outbound Rules
  • ActionNew Rule
  • Select Program
  • Click Browse and select the executable you want to block
  • Ensure you tick Block the connection
  • Choose which network profile. Usually this would not matter for a desktop at home. Select all.
  • Give it a name and click Finish
Note: Basically same procedure to block a port, just select Port instead of Program at the start.

On Linux

Blocking Outbound Traffic

UFW can also control outbound traffic. By default, UFW allows all outbound connections. You can change this to block specific outbound traffic or deny all outbound traffic by default. To deny all outbound connections by default:
sudo ufw default deny outgoing
To block outbound traffic to a specific port (example: SMTP on port 25 TCP):
sudo ufw deny out 25/tcp
To block outbound traffic to a specific IP address:
sudo ufw deny out to 192.168.1.100
To block outbound traffic to a specific IP and port:
sudo ufw deny out to 192.168.1.100 port 443 proto tcp
To block a specific protocol entirely (example: all outbound UDP):
sudo ufw deny out proto udp
Note: UFW does not block traffic by executable path. It filters by IP address, port number, and protocol (TCP/UDP).