neo4 WebSocket connection to 'ws://localhost:7687/' failed: Establishing a tunnel via proxy server failed - networking

I have neo4j community server edition 3.4.5 and which will be giving me "WebSocket connection to 'ws://localhost:7687/' failed".
I found some solution to work in firefox, chrome, IE but those are temporary solutions which work. but I don't think that just by passing proxy would be a permanent solution.
It is not working if connected to VPN(office network), otherwise working. What could be a reason for this error within an office network? How to resolve this issue.
Any idea or suggestions, Please

There can be several reasons for this issue and I probably need to know more about your setup before I can pin point the problem.
1 check:
Disconnect from the VPN, and open a command prompt (Windows+R then write cmd and press enter)
Use either telnet or putty ( https://www.putty.org/ ) and connect to 127.0.0.1 port 7687:
telnet 127.0.0.1 7687
See if you a response like this:
GET / HTTP/1.0
2 check:
Go to you proxy settings and see if you have a proxy enabled:
Firefox: Preferences/Options > Advanced > Network > Settings
IE: Tools > Options > Connections > Lan Settings
Suggest to turn off your proxy and do the check in check 1 again.
3 check:
Connect to your VPN and do the check 1 part once again
Check for error messages (that you probably would get) and then write in the command prompt:
route print
It should show a line like this:
127.0.0.0 255.0.0.0 On-link 127.0.0.1 xxx
127.0.0.1 255.255.255.255 On-link 127.0.0.1 xxx
127.255.255.255 255.255.255.255 On-link 127.0.0.1 xxx
This ensure that you still have your loop back up and running (probably is ok).
4 check:
Turn off your local firewall with VPN connected (if allowed) and try the check 1 again.
Some firewall rules change connections to "localhost" while connected to a VPN, since the new connection is "corporate" or "public".
If that worked, you need to create a rule in your firewall to allow connection to port 7687 for all addresses, this will fix your problem.
5 check:
Check your neo4j community server to listen to "127.0.0.1" and not "0.0.0.0"
Check your ports open by using netstat
netstat -a -o
It should state something like this
Proto Local Address Foreign Address State PID
TCP 0.0.0.0:7687 machinename:0 LISTENING xxxx
or
TCP 127.0.0.1:7687 machinename:0 LISTENING xxxx
If the server is like the first line, it might be handled by a corporate firewall, but by using the 127.0.0.1 as address it should always be local.
Hopefully that will get you on the way :)

i had same problem, so Let me tell you what i came out with...
the company has a proxy server for all connections, so i change my request from IP to DNS by typing nslookup IP on command prompt terminal.
from: ws://180......:80/socket/test to: ws://mxjuppro22......:80/socket/test
then error gone and now is working like a charm!!!
hope it helps

Related

Can an OpenVPN Route over TEST-NET-1 (RFC 5735)

Background
I have a strange use-case where my VPN cannot be on any of the private subnets, but, also cannot use a TAP interface. The machine will be moving through different subnets, and requires access to the entire private address space by design. A single blocked IP would be considered a failure of design.
So, these are all off limits:
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
169.254.0.0/16
In searching for a solution, I came across RFC 5735, which defines:
192.0.2.0/24 TEST-NET-1
198.51.100.0/24 TEST-NET-2
203.0.113.0/24 TEST-NET-3
As:
For use in documentation and example code. It is often used in conjunction with domain names
example.com or example.net in vendor and protocol documentation. As described in [RFC5737], addresses within this block do not legitimately appear on the public Internet and can be used without any coordination with IANA or an Internet registry.
Which, was a "Jackpot" moment for me and my use case.
Config
I configured an OpenVPN server as such:
local 0.0.0.0
port 443
proto tcp
dev tun
topology subnet
server 203.0.113.0 255.255.255.0 # TEST-NET-3 RFC 5735
push "route 203.0.113.0 255.255.255.0"
...[Snip]...
With Client:
client
nobind
dev tun
proto tcp
...[Snip]...
And ufw rules:
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -s 203.0.113.0/24 -o ens160 -j MASQUERADE
COMMIT
However, upon running I get /sbin/ip route add 203.0.113.0/24 via 203.0.113.1 RTNETLINK answers: File exists in the error logs. While the VPN completes the rest of its connection successfully.
No connection
Running the following commands:
Server: sudo python3 -m http.server 80
Client: curl -X GET / 203.0.113.1
Results in:
curl: (28) Failed to connect to 203.0.113.1 port 80: Connection timed out
I have tried:
/sbin/ip route replace 203.0.113.0/24 dev tun 0 on client and server.
/sbin/ip route change 203.0.113.0/24 dev tun 0 on client and server.
Adding route 203.0.113.0 255.255.255.0 to the server.
Adding push "route 203.0.113.0 255.255.255.0 127.0.0.1" to server
And none of it seems to work.
Does anyone have any idea how I can force the client to push this traffic over the VPN to my server, instead of to the public IP?
This does actually work!
Just dont forget to allow connections within your firewall. I fixed my config with:
sudo ufw allow in on tun0
However, 198.18.0.0/15 and 100.64.0.0/10 defined as Benchmarking and Shared address space respectively, may be more appropriate choices, since being able to forward TEST-NET addresses may be considered a bug.

How can I modify my IP address on my localhost in MAMP?

Developing a plugin for WordPress locally I'm wanting to implement Akismet in form validation but I'm required an IP address with the submission and when I run:
function check_ip_address() {
if (isset($_SERVER['REMOTE_ADDR'])) :
$ip_address = $_SERVER['REMOTE_ADDR'];
else :
$ip_address = "undefined";
endif;
return $ip_address;
}
echo check_ip_address();
I get back a ::1. When I researched to resolve this I didn't find a solid answer from:
Ask Different tag MAMP
How do I rename MAMP web server?
When researching how to resolve ::1 I found Should a MAMP return ::1 as IP on localhost? that suggests a sudo of:
sudo vi /etc/apache2/httpd.conf
So I go to MAMP/conf/apache/httpd.conf and try to modify line 48 from Listen 8888 to Listen 127.0.0.1 and I get an error and Apache will not restart. How can I modify my MAMP IP so I can get a proper IP from $_SERVER['HTTP_USER_AGENT']?
It's ::1 because that's the IPv6 loopback address, equivalent of 127.0.0.1, and the remote address is yourself as MAMP is running locally, the remote browser is on the same machine.
REMOTE_ADDR represents the IP the request came from. In most scenarios this is the same as the IP the browsers machine has on the open-internet, but here MAMP is running Apache natively so it's 127.0.0.1 or ::1. If you were using a docker container or a Virtual machine, it would be a private IP on a range specified when configuring your containers/VMs.
So to retrieve the IP you're expecting, you'll need to use an external service, or, for the sake of debugging, pass Akismet a hardcoded IP, but I suspect it's asking for the IP of whomever is commenting.

How do I connect a Docker container running in boot2docker to a network service running on another host?

I am using the latest version of boot2docker version 1.3.2, 495c19a on a windows 7 (SP1) 64 bit machine.
My docker container is running a celery process which attempts to connect to a rabbitMQ service running on the same machine that boot2docker is running on.
The Celery process running within the docker container cannot connect to RabbitMQ and reports the following :
[2014-12-02 10:28:41,141: ERROR/MainProcess] consumer: Cannot connect
to amqp:// guest:**#127.0.0.1:5672//: [Errno 111] Connection refused.
Trying again in 2.00 seconds...
I have reason to believe this is a network related issue, associated with routing from the container, to the VirtualBox host, and from the host to the RabbitMQ service running on the local machine; I do not know how to configure this and I was wondering if anyone can advise me how to proceed?
I tried setting up port 5672 in port forwarding but it didn't work (but I believe this is for incoming traffic to the VM, like boot2docker ssh).
I am running the container as docker run -i -t tagname
I am not specifying a host with -h when I run the container.
I'm sorry if this question appears rather clueless or if the answer appears obvious ... I appreciate any help!
Some additional information :
The routing table of the host VM is what boot2docker configured during installation as follows :
docker0 IP Address is 172.17.42.1
eth0 IP Address is 10.0.2.15
eth1 IP Address is 192.168.59.103
eth0 is attached to NAT (Adapter 1) in the VirtualBox VM network configuration.
Adapter 1 has port forwarding setup for ssh; default setting of host IP 127.0.0.1, host port 2022, guest port 22.
eth1 is attached to Host-only adapter (Adapter 2).
Both adapters are set to promiscuous mode (allow all).
The IP Address of the docker container is 172.17.0.33.
[2014-12-02 10:28:41,141: ERROR/MainProcess] consumer: Cannot connect to amqp:// guest:**#127.0.0.1:5672//: [Errno 111] Connection refused. Trying again in 2.00 seconds...
127.0.0.1 is a special IP address that means "me", and inside the container it means "me the container", so this is why it is not connecting to the outer host. So the first thing to do is change the IP address where you are trying to connect to Rabbit to that of the outer host where it is running.
Then you probably have to do something about routing, but let's take one step at a time.
as your RabbitMQ server is running on your Windows host, you need to tell your container that it should talk to that IP - which would probably be 192.168.59.3
most importantly, your container's 127.0.0.1 is only a loopback device to that container's services - not even the boot2docker vm's ports.
You could set up an ambassador container that has --expose=80 and uses something like socat to forward all traffic from that container to your host (see svendowideit/ambassador). Then you'd --link that ambassador container to your current image
but personally, I'd avoid that initially, and just configure your containerised app to talk to the real host's IP
You have to specifc explicitely ports for port redirection separately for boot2docker and docker.
Please try this:
c:\>boot2docker init
c:\>boot2docker up
c:\>boot2docker ssh -L 0.0.0.0:5672:localhost:5672
docker#boot2docker:~$ docker run -it -p 5672:5672 tagname

Vagrant cannot forward the specified ports on this VM

I have Vagrant in use for one box profile. Now I want to use Vagrant for another box (b2), but it says that bioiq's instance is consuming the forwarded port 2222 (which it is).
Now, if I configure b2 with the below, Vagrant still tries to use 2222.
Vagrant.configure("2") do |config|
config.vm.box = 'precise32'
config.vm.box_url = 'http://files.vagrantup.com/precise32.box'
config.vm.network :forwarded_port, guest: 22, host: 2323
# Neither of these fix my problem
# config.vm.network :private_network, type: :dhcp
# config.vm.network :private_network, ip: "10.0.0.200"
end
I've tried various ways from other SO questions to set the :forwarded_port (see here and here). I also tried this Google Group post, to no avail. I keep getting this message.
Vagrant cannot forward the specified ports on this VM, since they
would collide with some other application that is already listening
on these ports. The forwarded port to 2222 is already in use
on the host machine.
To fix this, modify your current projects Vagrantfile to use another
port. Example, where '1234' would be replaced by a unique host port:
config.vm.network :forwarded_port, guest: 22, host: 1234
Sometimes, Vagrant will attempt to auto-correct this for you. In this
case, Vagrant was unable to. This is usually because the guest machine
is in a state which doesn't allow modifying port forwarding.
I don't know why Vagrant consistently ignores my directives. The posted configuration doesn't work. Has anyone overcome this?
In case of ssh port, Vagrant solves port collisions by itself:
==> ubuntu64: Fixed port collision for 22 => 2222. Now on port 2200.
However, you still can create unavoidable collision by:
Creating first vagrant env (it will get port 2222 for ssh)
Suspend that env (vagrant suspend)
Create second vagrant env (it will again get port 2222, since it is now unused)
Try bringing first environment up again by vagrant up
You will get the error message you are getting now.
The solution is to use vagrant reload, to let vagrant discard virtual machine state (which means it will shut it down the hard way - so be careful if you have any unsaved work there) and start the environment again, solving any ssh port collisions on the way by itself.
I've just run into a problem on current versions of Mac OSX (10.9.4) and VirtualBox (4.3.14) where the default ssh port 2222 is both unused and unbound by vagrant up. It was causing the sanity check ssh connection to timeout indefinitely.
This isn't the exact same problem, but an explicit forward resolved it:
config.vm.network :forwarded_port, guest: 22, host: 2201, id: "ssh", auto_correct: true
This suggestion comes from a comment on the Vagrant GitHub issue 1740.
It's not clear whether the port forwarded to 22 is being detected or if the ID is used, but it's working for me.
My computer is Windows 10, and I solved this problem by disabling the 8080 port. because it is said that "the forwarded port 8080 is already in use on the host machine."
So I edit the Vagrantfile and comment the port 8080.

ssh portforwarding unix

I am trying to use local port forwarding to access remote host over a firewall and am able to do so using the command below.
ssh -L 23456:remotehost:10000 localhost
>telnet localhost 23456
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
>telnet 170.19.120.207 23456
Trying 170.19.120.207...
telnet: connect to address 170.19.120.207: Connection refused
telnet: Unable to connect to remote host: Connection refused
Looks like portforwarding is happening on loopback and anything with the hostname is getting rejected. Can someone help me to get around this, as I am sure there is/should be a way
Seems it is working correctly 'telnet localhost 23456' works!
telnet 170.19.120.207 23456 shouldn't work, unless 170.19.120.207 points to your host. If you want that you need to enable gateway functionality:
ssh -g -L 23456:remotehost:10000 localhost

Resources