I'm new in ubuntu & networking.

I opened port: 9876 ofr tcp and udp. I Created a java udp client and server. The server is listening to port 9876 and I connected to my server with my external ip adress. After I opened the port menually in my home router (see image), my udp client-server is working great.

enter image description here

My problem:

When I check if port 9876 is open in my machine from this site: https://www.yougetsignal.com/tools/open-ports/ , it say it's closed. Why? (even when I'm running the udp server which listen to this port). How can I open port 9876 in my machine to everyone in the internet?

Commands I run in my local machine:

stavalfi@laptop:~/IdeaProjects/torrentx$ netstat -tulnp | grep 9876
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
stavalfi@laptop:~/IdeaProjects/torrentx(stav)$ sudo ufw status verbose
Status: inactive
stavalfi@laptop:~/IdeaProjects/torrentx(stav)$ sudo ufw status
Status: inactive

If I understood currectrly, My firewall in my machine is off and port 9876 is not open.

  • Your port is already open. You need to start your server, nothing is listening (you could confirm this by reading the output as well "Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all." so run sudo netstat .... – Panther Nov 25 '17 at 14:41
  • Thanks, why yougetsignal.com/tools/open-ports say my port is closed? Also this site:portchecker.co/check and every other site. – Stav Alfi Nov 25 '17 at 14:42
  • Most port testers cannot tell the difference between blocked-at-firewall and nothing-listening-on-that-port (server not running). For the details on the tester you used, you must contact the test owner. – user535733 Nov 25 '17 at 15:11

There are three things to check:

  • Your local machine's port
  • Your local machine's firewall
  • Your router

Some of these steps you have probably already done. Do them again in order, to eliminate each possible issue methodically. Don't jump around.

Local Machine Port: Be sure the server is running, and that you can connect to it from a local client. Now you KNOW that the server is working and properly binding to it's listening port.

Local Machine Firewall: Connect to the server from a different machine on the same LAN. If it fails, fix your server's firewall rules. When you can connect across the LAN, you know that your server is working AND that your firewall is configured properly.

Router: Connect to the server from a machine outside your LAN. Really outside your LAN, not merely on-the-LAN-but-using-the-external-IP-address (the router treats it differently). If the connection fails, fix your router settings. Router settings are generally not an Ubuntu topic...unless you built your own Ubuntu router.

These steps will lead you to the proper follow-up questions.

| improve this answer | |
  • This is very good advice, however, it is more a comment. From what the OP has posted we know there is no server listening. The firewall is disabled, and the router is configured to forward ports. – Panther Nov 25 '17 at 15:33

You can download a package of ufw with gui - for a much simple approach

sudo apt-get install gufw

You can then create a rule in your firewall to allow connections to your machine via ports or define those that can listen to what you want.

See Image

Hope this helps.

| improve this answer | |
  • UFW is already disabled and so running GUFW and opening a port will not help. – Panther Nov 25 '17 at 14:39
  • using gufw can also start ufw - firewall enabled and then enable the rules i'm using it too. – Yien Nov 25 '17 at 14:46
  • 1
    The OP is not asking how to open a port in ufw/gufw so this is not really an answer. – Panther Nov 25 '17 at 15:27

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.