1

I think this is not a usual "hostname not resolved" issue and I don't think this relates to the service I am talking about below:

  1. I have a cluster installed with Anaconda's jupyter notebook, the notebook is up and its port is up. Basically, jupyter notebook is a service running on the host and user accesses it from his or her workstation.
  2. To access the service, user will need to go to http://host:port
  3. On the host, I am able to use http://localhost:port
  4. On the same host, when I try http://host:port, I get rejected with the error: could not connect to host
  5. I am able to ping the host from my workstation and my colleague's workstation.

    So what is wrong here?

    Thank you very much. Any hint is appreciated.

PasLeChoix
  • 111
  • 1
  • 4
  • Your title is wrong: your error is "could not connect" and not "could not resolve". Your software is probably listening on the wrong network interface. It listens on localhost and hence you can access it through http://localhost but not through the server name tied to its "true" network interface through its IP address. – Patrick Mevzek Dec 06 '17 at 02:04
  • alright, in your opinion, what/where change should I make? Thanks. – PasLeChoix Dec 06 '17 at 03:49
  • @PasLeChoix just as Patrick described. Your notebook instance is not listening on an interface that can be accessed from outside the host itself. See https://jupyter-notebook.readthedocs.io/en/stable/public_server.html#notebook-public-server especially the `c.NotebookApp.ip = '*'` part – Valentin Bajrami Nov 04 '21 at 13:27

2 Answers2

0

This sort of issue is normally because the service is only configured for local network.

You can check this by entering the following command in a command prompt:

netstat -an 

Check the output for entries with your port number that has a LISTENING entry.

If it is listening on all interfaces it will have a ., or similar, depending on whether it is listening in IPv4 or IPv6, or both modes.

If that is the case, the service will need to be changed to use all interfaces.

sweetfa
  • 447
  • 4
  • 8
  • Thank you. This is what I got: $ netstat -an | grep 8880 tcp 0 0 127.0.0.1:8880 0.0.0.0:* LISTEN – PasLeChoix Dec 06 '17 at 14:37
  • 1
    So your service is only listening on the localhost network. You will need to change the configuration for your service, whatever that is. – sweetfa Dec 06 '17 at 21:55
0

first , please verify the port opening of the server. please telnet from another workstation.

telnet host port

if this is not working run the below command

sudo netstat -upant | grep <port>

there should be a

tcp        0      0 0.0.0.0:<port>           0.0.0.0:*               LISTEN 

if there is a 127.0.0.1 instead of having 0.0.0.0 that is the reason for this behavior

if you can see the 0.0.0.0 or host's IP address check the firewall setting (iptables in linux)

therefore, Please change the configuration of the service to listen for any interface or to that particular interface of the host. check your config , there may be a config for localhost only.

I think this URL will help you for more information:-

http://jupyter-notebook.readthedocs.io/en/stable/public_server.html

Prabath Dolawatta
  • 519
  • 1
  • 5
  • 13
  • Thank you and sweetfa for the diagnosis, I do not have root nor sudo, I will have to engage a system admin to do the check, can you please give a detailed command here so I can pass it to sa? our sa only run whatever commands we give them, so I better prepare that. Big thanks – PasLeChoix Dec 06 '17 at 12:49
  • actually it my bad , you can run that command without having sudo(netstat -upant | grep ).if you can see the 0.0.0.0 or host's IP address check the firewall setting. in that case you have to ask them to check the firewall settings to open that particular port. – Prabath Dolawatta Dec 06 '17 at 13:21
  • if your using Iptables you can ask them to run --> iptables -A INPUT -p tcp -m tcp --dport -j ACCEPT. – Prabath Dolawatta Dec 06 '17 at 13:25
  • This is what I got: netstat -upant | grep 8880 tcp 0 0 127.0.0.1:8880 0.0.0.0:* LISTEN 1424/python – PasLeChoix Dec 06 '17 at 14:35
  • this is the reason , this service is only listening via your localhost (127.0.0.1) . please change the configuration for any IP or your server IP. then it should work. if it's not working you can go for the Iptables or firewall settings. – Prabath Dolawatta Dec 06 '17 at 14:42
  • please use , given URL in the answer , you can see there is way to configure "Running a public notebook server" under that you can see c.NotebookApp.ip = '*' – Prabath Dolawatta Dec 06 '17 at 14:49
  • Thanks. Can you elaborate how do I request the change? I would need to present the commands for our system admin to execute – PasLeChoix Dec 06 '17 at 14:52
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/69802/discussion-between-prabath-dolawatta-and-paslechoix). – Prabath Dolawatta Dec 06 '17 at 14:53