1

I am having issues connecting remotely (i.e using my static IP address) to my Raspberry Pi's SSH and HTTP (nginx) servers. Al though it seems to be having trouble with any outbound traffic.

My PC and Raspberry Pi are both behind the same router, and I can connect to my RasPi from the PC using its local IP (192.168.1.81) through both SSH and HTTP. The problem starts when I try to connect to the RasPi using my remote IP. Neither HTTP nor SSH works.

If I try to connect using SSH, it connects forever (I don't even get a time-out). Running the ssh -vvv [email protected] command generates the following output: (obviously not my real IP)

atomen@Ubuntu-PC:~$ ssh -vvv [email protected]
OpenSSH_6.2p2 Ubuntu-6ubuntu0.1, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 255.255.255.255 port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/atomen/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/atomen/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/atomen/.ssh/id_rsa-cert type -1
debug1: identity file /home/atomen/.ssh/id_dsa type -1
debug1: identity file /home/atomen/.ssh/id_dsa-cert type -1
debug1: identity file /home/atomen/.ssh/id_ecdsa type -1
debug1: identity file /home/atomen/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2p2 Ubuntu-6ubuntu0.1

... and the following entry is added to the auth.log (on the RasPi) when I cancel the connection attempt from my PC (otherwise SSH just runs forever, no more output/response except the one pasted above).

Feb  7 12:22:00 raspberrypi sshd[2449]: Connection closed by 192.168.1.254 [preauth]

Where 192.168.1.254 is the IP-address of my default route and primary DNS.

If I browse to 255.255.255.255, chrome tries to connect for ~10m until it aborts saying The server took too long to respond (again: not my real IP). The following is the output in access.log:

192.168.1.254 - - [07/Feb/2014:12:36:04 +0000] "GET / HTTP/1.1" 200 126 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
192.168.1.92 - - [07/Feb/2014:12:38:15 +0000] "GET / HTTP/1.1" 200 126 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"

The first line is when I connect using the remote IP (browser loads forever), and the second one using the local IP (192.168.1.81) - which gives a response in milliseconds.

When I check port 80 and 22 online both are open. But not only that; when I start my Apache server on my PC, and configure the NAT settings on the router to forward the PCs IP instead (192.168.1.92) I can successfully connect through both SSH and HTTP using my remote IP.

TL;DR I can successfully connect to my Ubuntu-PCs Apache and SSH server using my remote/static IP, but neither works when using the Raspberry PI.

NOTE: The PC is connected through WiFi, whilst the RasPi uses an Ethernet-cable.

1 Answer 1

1

Okay, it seems as if my router is behaving a bit uncustomary.

Due to my nescience and blatant disregard of networking devices, I was not aware of the issue regarding routers and their common security feature of disabling NAT loopback. Because of this I could not connect to my server from a local PC (e.g. a computer behind the same router as the RasPi). If I had tried the 3G connection on my iPad from the beginning, I would have known that the issue exists only locally. The abnormal behavior (from what I can tell) is the fact that the computer exposing itself through NAT, can connect using the remote IP.

If I setup port forwarding for my PC's server, the PC can connect using the remote IP, but not the RasPi. If I however configure NAT for the RasPi's server, it can connect to itself, whilst the PC cannot.

Strange, yet another wonderful example of the myriad of behaviors that can transpire in the world of computers!

1
  • Glad this was resolved! If you could, would you please mark this answer as such? It would raise our Q:A ratio and move us that much closer to graduating to a full site. It also shows that this community is useful and active. Thanks! Commented Mar 16, 2014 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.