10

I am trying to let other computers to access my local server but I tried myself locally that I cannot access it locally even myself.

Several things you should know:

My target

Visit my server via http://172.26.141.106:5201/

What I can do now

I can access my server via these two ways:

IP configuration

Result of ifconfig | grep inet

      inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
      inet addr:172.26.141.106  Bcast:172.26.141.255  Mask:255.255.255.0
      inet6 addr: fe80::f767:cd56:9641:d3a9/64 Scope:Link
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host

Hosts

Output of cat /etc/hosts:

127.0.0.1   localhost.localdomain localhost
127.0.0.1   hearen.pc
127.0.0.1   hearen-OptiPlex-7050
127.0.0.1   staging
127.0.0.1   arthas
172.26.141.106  localhost hearen.pc

Firewall

$ sudo ufw disable
Firewall stopped and disabled on system startup
$ sudo ufw status
Status: inactive

Is there some way that I missed out? All I want is to let others access my server via http://172.26.141.106:5201/

Any help will be appreciated :)

Updated 2019-01-10

With the help of @Ed King, I check the ports via sudo lsof -i -P -n | grep LISTEN | grep 5201 and only 127.0.0.1 was listenned on.

Problem solved after I configured my Angular server to listen on 0.0.0.0 .

Hearen
  • 243
  • 1
  • 2
  • 11

2 Answers2

10

Check that your server is listening:

sudo lsof -n | grep TCP | grep LISTEN

You can also check the route using nc. Start nc on the server listening on an unused port and then connect from another machine -- this will verify iptables and routes are correct.

My guess is that you're listening on the localhost only.

Ed King
  • 325
  • 2
  • 5
  • Thank you, you are leading the right direction. It is and now I configure it to listen on `0.0.0.0`. Problem solved. Thanks for the help. I will mark your answer after minutes when I am allowed. – Hearen Jan 10 '19 at 04:16
  • Thanks for making me think in the correct direction. If you landed here due to google firebase echosystem, please refer to - https://stackoverflow.com/questions/58260877/access-firebase-emulator-from-local-network – Mohit Mittal Jul 30 '21 at 12:54
3

I fixed this issue with following ways:

  1. I run the command

    sudo ufw status 
    

    And I found that the port 80 (in my case) was not in the list.

  2. Then I run the command

    sudo ufw allow 80
    

    This fixed the issue.

zx485
  • 2,249
  • 11
  • 24
  • 34
vicky_kqr
  • 39
  • 2
  • This will work if ufw was his problem -- in his question he disabled ufw and still could not connect. – Ed King Jul 31 '21 at 16:57