Cannot open port via iptables nor ufw

December 9, 2015 1.1k views
Firewall Networking Linux Basics Ubuntu

I am trying to open port 53589 to start a taskwarrior server.
I did this:

sudo iptables -I INPUT -p tcp -m tcp --dport 53589 -j ACCEPT

and this:

sudo ufw allow 53589/tcp

I start the server, but it does not seem to work.
I tried to connect via telnet to test the port, but still nothing

telnet my.domain 53589

when I try to connect to port 80 or 22 it works

I am on Ubuntu 15.04

1 comment
  • For the record, the command you gave is the correct one for both iptables and ufw, if we ignore previously existing rules.

3 Answers

Doesn't work is not a helpful statement. What did you do, what was the expected result, and what did you see instead? Was there an error? Be specific!

I had a similar issue on a 14.04 droplet last week. The problem ended up being that the new ALLOW iptables rule was being run after the DROP input rule. I did the following:

iptables-save > iptables_rules.txt

Edit iptables_rules.txt and find this line:


Add your rule right above it:

-A INPUT -p tcp -m tcp --dport 53589 -j ACCEPT

Make sure that you remove it from later in the file. Save the file and reload your iptables rules:

iptables-restore < iptables_rules.txt

For good measure I like to do a service iptables restart

I hope that helps!

so, very sorry, but the "problem" was at our internal firewall at the office.
I asked the system administrator, and he was like "of course it is it is closed".
thank you for the answers tho.

Have another answer? Share your knowledge.