11

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 .

1
  • In the /etc/hosts file above localhost points to 2 different IP addresses, is this allowed? Will it work? Commented Jan 25, 2021 at 9:56

2 Answers 2

11

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.

2
  • 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
    Commented Jan 10, 2019 at 4:16
  • Thanks for making me think in the correct direction. If you landed here due to google firebase echosystem, please refer to - stackoverflow.com/questions/58260877/… Commented Jul 30, 2021 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.

1
  • This will work if ufw was his problem -- in his question he disabled ufw and still could not connect.
    – Ed King
    Commented Jul 31, 2021 at 16:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .