ufw Allow From Specific IP on Specific Port

By | 2011/10/10

ufw is the friendly command line firewall utility in Debian and Ubuntu.

I’ll show you how to create a specific rule syntax for allowing traffic in from a specific ip on a specific port.


Say for example you want to allow traffic from 192.168.1.215 on udp port 88.

Here is the command:

$ sudo ufw allow from 192.168.1.215 proto udp to any port 88


You can view your current rules with:

$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
88/udp                     ALLOW       192.168.1.215


To delete this rule, preface the command with delete:

$ sudo ufw delete allow from 192.168.1.215 proto udp to any port 88

Cool!