I am trying to open a port in Ubuntu 17.10, but first some background.

For the last 16 hours I've been working on getting a BBS mailer set up under dosbox. In my dosbox conf, I have set up "serial1=modem listenport:601" to listen on port 601. To test this, I was able to open a terminal and do "telnet localhost 601" and I could connect everytime. The moment I try to open the port in iptables and in ufw (I found out how from stack exchange) now the port seems to be closed and dosbox reports "Serial1: Modem could not open TCP port 601."

But this worked all day until I opened the ports.

Here is what iptables and ufw are reporting:

iptables -L | grep 601

ACCEPT tcp -- anywhere anywhere tcp dpt:601

ACCEPT udp -- anywhere anywhere udp dpt:601

ufw status Status: active

To Action From -- ------ ---- 601 ALLOW Anywhere
601 (v6) ALLOW Anywhere (v6)

So my question is two-fold:

1) why did this work before I opened the port but now won't work when the port is open? 2) How do I make it work?

My end goal is to be able to access the BBS mailer from outside my network, but for now I just need to test locally with ports open. (after this, my next step is to get a dynamic dns so I can begin testing from outside the network)


By using UFW you don't need to take care of iptables. UFW will to this for you.

So here's one possible explanation what could have happened:

  • UFW was not active at the time when testing with telnet.
  • Then you started UFW and the default ufw rule is deny or drop incoming traffic.
  • Then you've opened the port 601 for udp/tcp, but only for IPv6 by accident.
  • Now telnet does not work anymore, as you connect via IPv4 and your connection get's dropped/denied according to your ufw settings.

But it's not that important to find out why it did work before. More important is to make it work again, I guess. You can do so, by adding the correct UFW rules:

sudo ufw allow proto tcp from any to any port 601

And then check ufw settings with:

 sudo ufw status verbose

The output from this command should look like this, for example:

Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
601/tcp                    ALLOW IN    Anywhere
601/tcp (v6)               ALLOW IN    Anywhere (v6)

Then it should work again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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