2

I am on mac ElCapitan 10.11.6 (15G31) and running simple rack application rackup -p 5004. I can connect to it with http://localhost:5004/ and http://[::1]:5004/

But can't connect with http://127.0.0.1:5004/ and http://192.168.0.111:5004/.

This looks like mis-configuration on my machine. I get different errors when try to connect with IPv4 and IPv6.

$ nc -v -4 192.168.0.111 5004 # and nc -v -4 127.0.0.1 5004 and nc -v -4 localhost 5004
nc: connectx to 192.168.0.111 port 5004 (tcp) failed: Connection refused

$ nc -v -6 192.168.0.111 5004 # and nc -v -6 127.0.0.1 5004
nc: getaddrinfo: nodename nor servname provided, or not known

But I can connect with nc -v -6 localhost 5004

My hosts file is pretty simple:

$ cat /etc/hosts                                                                                                                                                       
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost

I need to make it work with my host machine IP address 192.168.0.111 so I can connect within Docker container. How to fix this?


Additional information I found on different topics

  • scutil

    $ scutil -r 192.168.0.111
    Reachable, Local Address, Directly Reachable Address
    
    $ scutil -r 127.0.0.1
    Reachable, Local Address, Directly Reachable Address
    
    $ scutil -r localhost
    Reachable
    
    $ scutil -r ::1
    Reachable, Local Address, Directly Reachable Address
    
    # but note, ???
    $ scutil -r qwerty
    Reachable
    
  • lsof port usage

lsof shows port is by ruby executable and the interesting part is localhost:avt-profile-1. Checking what avt-profile-1 is gives results for "Real-time Transport Protocol media data". More info here. Also interesting is when I stop the rackup application there is no port usage, so this is not service/daemon running on my machine.

lsof -i :5004
COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
ruby    12167 kode   16u  IPv6 0xf3c39e30b59c5321      0t0  TCP localhost:avt-profile-1 (LISTEN)

Here I have different application running on port 5000. It's reachable via the host IP at 192.168.0.111:5000. Note the NAME *:commplex-main. Addittionaly I would like to know what this is used for.

lsof -i :5000
COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
ruby    12889 kode   14u  IPv4 0xf3c39e30b22fcbe9      0t0  TCP *:commplex-main (LISTEN)
  • host address name

    host 192.168.0.111
    111.0.168.192.in-addr.arpa has no PTR record
    
  • arp

    $ arp 192.168.0.111
    ? (192.168.0.111) at a0:99:9b:17:16:1d on en0 ifscope permanent [ethernet]
    
  • nslookup

    $ nslookup localhost
    Server:     192.168.0.1
    Address:    192.168.0.1#53
    
    Name:   localhost
    Address: 127.0.0.1
    
    $ nslookup 127.0.0.1
    Server:     192.168.0.1
    Address:    192.168.0.1#53
    
    1.0.0.127.in-addr.arpa  name = localhost.
    
    $ nslookup 192.168.0.111
    Server:     192.168.0.1
    Address:    192.168.0.1#53
    
    ** server can't find 111.0.168.192.in-addr.arpa.: NXDOMAIN
    

2 Answers 2

1

The issue was rackup runs on localhost by default. To use host one must specify it with -o like rackup -o 192.168.0.111 -p 5004. Only one host can be specified.

-3

Ah, I had that same issue a while back. It turned out to be a bad script Chrome was executing. I solved the problem by using Safari instead.

5
  • This seems to be not my case. It's the same in Safari and Opera. @chromaticsyllabus did you isolate which script was running?
    – kode
    Aug 3, 2016 at 18:48
  • For some reason nsIQTScriptablePlugin.xpt (ordinarily a Safari plugin you should keep running, see support.apple.com/en-us/HT203353) was being hijacked by Chrome. If you check Chrome's task manager you may be able to see this. Not sure if Opera has something similar. Aug 3, 2016 at 18:52
  • I have the plugin too $ locate nsIQTScriptablePlugin.xpt/Library/Internet Plug-Ins/Disabled Plug-Ins/nsIQTScriptablePlugin.xpt $ file /Library/Internet\ Plug-Ins/Disabled\ Plug-Ins/nsIQTScriptablePlugin.xpt /Library/Internet Plug-Ins/Disabled Plug-Ins/nsIQTScriptablePlugin.xpt: XPConnect Typelib version 1.1
    – kode
    Aug 3, 2016 at 18:56
  • I don't see this plugin in chrome://plugins/ running about:plugins in Chrome address bar. Had 4 other plugins. Disabling them doesn't solve the issue.
    – kode
    Aug 3, 2016 at 19:03
  • Welcome to Ask Different. We like answers to be more than just a single line. Ideally, you want to explain why your answer is *right." It also helps to provide links, citations, and/or screen shots. Please review our help section How to Answer on writing good answers to questions
    – Allan
    Aug 4, 2016 at 11:51

You must log in to answer this question.

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