how to deny a connection to a specific network interface with ufw using ubuntu via command

 

UFW, or Uncomplicated Firewall, is a simplified firewall administration interface that hides the complexity of lower-level packet filtering applied sciences such as iptables and nftables. If you’re searching to get began securing your network, and you’re now not positive which device to use, UFW can also be the proper desire for you.


In this post, We will deny a connection to a specific network interface with ufw firewall on ubuntu 22.04 LTS


Step 1: Deny a connection to a specific network interface with ufw 


In order to deny a connection to a specific network interface with ufw firewall, You need to execute the following command, You need to replace the network device name in command in my case my using ens033


sudo ufw deny in one ends03 to any port 22


Step 2: Verify UFW status


You need to use the given command to check the status of UFW is enabled or not.


sudo ufw status


You will get a warning that says the command may additionally disrupt current SSH connections. We already set up a firewall rule that permits SSH connections, so it must be best to continue. Respond to the instant with y and hit ENTER.


The firewall is now active. Run the sudo ufw status verbose command to see the policies that are set. The relaxation of this tutorial covers how to use UFW in extra detail, like permitting or denying distinct sorts of connections.





Conclusion

Your firewall is now configured to permit (at least) SSH connections. Be positive to enable any different incoming connections that your server needs, whilst limiting any needless connections, so your server will be practical and secure. 



how to deny a connection to a specific network interface with ufw using ubuntu via command

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top