Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Windows besides the Windows firewall a user could have installed a firewall program, or there is another service listening to that port.

In Ubuntu how can I see what blocks/filters open ports? Iptables rules? What about outbound connections?


share|improve this question

To list rules on local machine use

sudo iptables -L -n

Ubuntu is shipped with firewall(ufw), which is not enabled by default

  • To check status of firewall:sudo ufw status
  • To enable: sudo ufw enable
  • To disable: sudo ufw disable
  • To allow traffic on port: sudo ufw allow <port_num>
  • To block a port: sudo ufw block <port_num>

To check what outbound connections are running use command

sudo lsof -i -P -n
share|improve this answer

In Linux, all the firewalls are actually interfaces to setting up the rules of the kernel iptables.

To list all rules, type

sudo iptables -S

You can also see what firewall packages are installed by writing

dpkg -l | grep -i firewall
share|improve this answer
What happens in systems where iptables is not installed? Is there any other way to list the kernel iptables? – Sitoplex Oct 14 '12 at 11:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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