taternator5000
taternator5000

Reputation: 125

Can't connect to locally-hosted Neo4j server from another device on the same Wi-Fi network

Background

I'm using Neo4j Community Edition 3.2.0 for hosting a server for the purposes of a mobile app. For testing, I'm running the server on my laptop running Windows 10 on its localhost, so that I can access the server at localhost:81 (I was originally using 7474 as the port, but I'll get to why I changed in a second). I can also access this server at 127.0.0.1:81 (which is the same thing) and using the IPv4 address I get from running ipconfig in cmd (let's say, 192.168.1.5).

Problem

My problem is, I can't access this server from another device that is connected to the same network that my laptop is on (namely, my phone). When I try connecting to it at the URL 192.168.1.5:81, it just times out.

Attempted Solutions

As I said earlier, I was using 7474 as the port number earlier to no avail. I checked my firewall and the port wasn't blocked, and just to make sure I added an inbound rule to allow connections to that port. When that didn't work, I tried switching the port number to random numbers like 5050 and 80, but still nothing worked. 81 is just the last number I tried out. My firewall isn't blocking any of those ports for Neo4j.

I also tried using my computer's global IP address as found by Googling "ip address", but that doesn't work, either.

My neo4j.conf file is as below:

#***************************************************************
# Server configuration
#
# For more details and a complete list of settings, please see
# #{settings-reference.url}
#***************************************************************

# This setting constrains all `LOAD CSV` import files to be under the `import` directory. Remove or uncomment it to
# allow files to be loaded from anywhere in filesystem; this introduces possible security problems. See the `LOAD CSV`
# section of the manual for details.
dbms.directories.import=import

# Require (or disable the requirement of) auth to access Neo4j
dbms.security.auth_enabled=true

# With default configuration Neo4j only accepts local connections.
# To accept non-local connections, uncomment this line:
dbms.connectors.default_listen_address=0.0.0.0

# You can also choose a specific network interface, and configure a non-default
# port for each connector, by setting their individual listen_address.

# The address at which this server can be reached by its clients. This may be the server's IP address or DNS name, or
# it may be the address of a reverse proxy which sits in front of the server. This setting may be overridden for
# individual connectors below.
#dbms.connectors.default_advertised_address=localhost

# You can also choose a specific advertised hostname or IP address, and
# configure an advertised port for each connector, by setting their
# individual advertised_address.

# Bolt connector
dbms.connector.bolt.enabled=true
#dbms.connector.bolt.tls_level=OPTIONAL
#dbms.connector.bolt.listen_address=:7687

# HTTP Connector
dbms.connector.http.enabled=true
dbms.connector.http.listen_address=:81

# HTTPS Connector
dbms.connector.https.enabled=true
dbms.connector.https.listen_address=:82

# Certificates directory
# dbms.directories.certificates=certificates

#*****************************************************************
# Administration client configuration
#*****************************************************************


# Comma separated list of JAX-RS packages containing JAX-RS resources, one
# package name for each mountpoint. The listed package names will be loaded
# under the mountpoints specified. Uncomment this line to mount the
# org.neo4j.examples.server.unmanaged.HelloWorldResource.java from
# neo4j-examples under /examples/unmanaged, resulting in a final URL of
# http://localhost:${default.http.port}/examples/unmanaged/helloworld/{nodeId}
#dbms.unmanaged_extension_classes=org.neo4j.examples.server.unmanaged=/examples/unmanaged

#*****************************************************************
# HTTP logging configuration
#*****************************************************************

# HTTP logging is disabled. HTTP logging can be enabled by setting this
# property to 'true'.
dbms.logs.http.enabled=false

# Enable this to be able to upgrade a store from an older version.
dbms.allow_format_migration=true

# The amount of memory to use for mapping the store files, in bytes (or
# kilobytes with the 'k' suffix, megabytes with 'm' and gigabytes with 'g').
# If Neo4j is running on a dedicated server, then it is generally recommended
# to leave about 2-4 gigabytes for the operating system, give the JVM enough
# heap to hold all your transaction state and query context, and then leave the
# rest for the page cache.
# The default page cache memory assumes the machine is dedicated to running
# Neo4j, and is heuristically set to 50% of RAM minus the max Java heap size.
#dbms.memory.pagecache.size=10g

# Enable this to specify a parser other than the default one.
#cypher.default_language_version=2.0

# Keep logical logs, helps debugging but uses more disk space, enabled for
# legacy reasons To limit space needed to store historical logs use values such
# as: "7 days" or "100M size" instead of "true".
#dbms.tx_log.rotation.retention_policy=7 days

# Enable shell server so that remote clients can connect via Neo4j shell.
#dbms.shell.enabled=true
# The network interface IP the shell will listen on (use 0.0.0.0 for all interfaces).
#dbms.shell.host=127.0.0.1
# The port the shell will listen on, default is 1337.
#dbms.shell.port=1337

As you can see, the lines dbms.connectors.default_listen_address=0.0.0.0, dbms.connector.http.listen_address=:81, and dbms.connector.https.listen_address=:82 are uncommented and set to their corresponding values.


I'm completely at a loss as to what to do here, I can't do anything if I can't even connect to the server from a different machine. I have a strange feeling that I'm missing something laughably obvious, but I still need help. Thanks!


EDITS

Upvotes: 0

Views: 2268

Answers (2)

taternator5000
taternator5000

Reputation: 125

I solved my problem, and it was indeed stupid. In my firewall, I had allowed connections on a private network and blocked them on a public network; for some reason, I didn't think of allowing the public connections too. Doing so ended up working, because my home network somehow counts as public.

Upvotes: 0

Jerome_B
Jerome_B

Reputation: 1097

Get back to the default version and just uncomment

dbms.connectors.default_listen_address=0.0.0.0

and

 dbms.logs.http.enabled=true

Restart You'll get an http.log file in the logs folder. Try to connect from your phone to http://192.168.1.5:7474

If the log file stays empty, the request does not reach the server. If not, check content. If nothing displayed on phone then issue is with networking out of your server OR with the phone (who knows, browser enforcing https when you dont use usual port number ?). -> turn off the firewall and retry

Upvotes: 3

Related Questions