This question already has an answer here:

I'm new to ubuntu, does it come with a firewall installed or will I have to install one, if so which one is best.

marked as duplicate by Richard, muru, g_p, Mitch Jan 14 '15 at 8:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Your question looks really broad, however just to mention that "Ubuntu has pre installed firewall and a Set of Rules what so called "IPTABLES".

You can do

sudo ufw status #this gives you the status if firewall is active or inactive


sudo ufw enable #enables the firewall


sudo ufw -h #displays all possible options

To enable the firewall just type sudo ufw enable ssh #this will enable firewall for ssh.

You can add some rules using iptables Command

sudo iptables -L -n #will list available rules for IPTABLES such as (INPUT, OUTPUT,NAT,etc.)

  • 1
    UFW is a separate package, it's description is: "The Uncomplicated FireWall is a front-end for iptables, to make managing a Netfilter firewall easier. It provides a command line interface with syntax similar to OpenBSD's Packet Filter. It is particularly well-suited as a host-based firewall." It's supposed to be far easier using ufw to add rules than using iptables directly – Xen2050 Jan 14 '15 at 1:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.