UFW Allow From Specific IP on Specific Port

Arif
Dec 7, 2020

--

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 10.0.0.46 on TCP port 3308.

Here is the command:

$ sudo ufw allow from 10.0.0.46 proto tcp to any port 3308

You can view your current rules with:

$ sudo ufw statusStatus: activeTo                         Action      From
-- ------ ----
3308/udp ALLOW 10.0.0.46

To delete this rule, preface the command with delete:

$ sudo ufw delete allow from 10.0.0.46 proto tcp to any port 3308

Cool!

--

--

Arif
Arif

Written by Arif

Blue Team at Indonesian SOCs

No responses yet