Score:0

"Open" port is not really open

us flag
gws

I used the following command to open port 2022 in Ubuntu:

sudo iptables -A INPUT -p tcp --dport 2022 -j ACCEPT

But if I start a web server on port 2022 it is not reachable.

If I run the command to see open ports:

sudo iptables -vnL

The output starts with

enter image description here

Now, ports that show up there like 3000 or 4000 work, but 2022 does not.

What's going on and how can I enable port 2022?

Score:1
in flag

The order matters. Your entry for 2022 in the iptables is behind DROP, so DROP is matched first and your ACCEPT entry is never reached.

You need to Insert instead of Append (-I instead of -A).

Score:0
za flag

Open port is a port that the packet filter doesn't block. In order for this port to be reachable something has to bind to it, and, in the TCP case, start to listen on it.

You can check whether something's doing it with ss -nl or netstat -an | grep LISTEN.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.