Skip to main content
The 2024 Developer Survey results are live! See the results
Tweeted twitter.com/super_user/status/1244278195005861888
Became Hot Network Question
added 434 characters in body
Source Link
Giacomo1968
  • 56.2k
  • 23
  • 167
  • 214

(Redirected from networkengineering.stackexchange)

I have two Raspberry Pis on my network - let's call them Pi and Rho.

I'm trying to set up port forwarding via ssh tunnel between them, such that an application can connect to a port on Rho and get results from a server listening on a port on Pi (my eventual goal is actually to set up port forwarding such that a host on a different network could get access to a Samba share on Pi via an ssh connection to Rho, without my having to entirely open a firewall port to Pi).

Pi's IP in my LAN is 192.168.42.69, and Rho's is 192.168.42.112 - these are the IPs that I ssh to from my local network to connect to them.

In order to test this, I have started a minimal Python server (with SimpleHTTPServer) on Pi's port 8000, and run sudo ssh -L 140:localhost:8000 [email protected] -N on Rho. When I curl localhost:140 or curl 127.0.0.1:140 on Rho, I get the response I expect. However, when I curl 192.168.42.112:140 on Rho, I get a connection refused - verbose output.refused; verbose output below:

$ curl -vvv 192.168.42.112:140
* Expire in 0 ms for 6 (transfer 0x2cd880)
*   Trying 192.168.42.112...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x2cd880)
* connect to 192.168.42.112 port 140 failed: Connection refused
* Failed to connect to 192.168.42.112 port 140: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 192.168.42.112 port 140: Connection refused

What is the reason for this discrepancy?

Having checked thischecked this other question, I confirmed that the environment variable HTTP_PROXY is not set on Rho, nor is NO_PROXY.

(Redirected from networkengineering.stackexchange)

I have two Raspberry Pis on my network - let's call them Pi and Rho.

I'm trying to set up port forwarding via ssh tunnel between them, such that an application can connect to a port on Rho and get results from a server listening on a port on Pi (my eventual goal is actually to set up port forwarding such that a host on a different network could get access to a Samba share on Pi via an ssh connection to Rho, without my having to entirely open a firewall port to Pi).

Pi's IP in my LAN is 192.168.42.69, and Rho's is 192.168.42.112 - these are the IPs that I ssh to from my local network to connect to them.

In order to test this, I have started a minimal Python server (with SimpleHTTPServer) on Pi's port 8000, and run sudo ssh -L 140:localhost:8000 [email protected] -N on Rho. When I curl localhost:140 or curl 127.0.0.1:140 on Rho, I get the response I expect. However, when I curl 192.168.42.112:140 on Rho, I get a connection refused - verbose output.

What is the reason for this discrepancy?

Having checked this question, I confirmed that the environment variable HTTP_PROXY is not set on Rho, nor is NO_PROXY.

(Redirected from networkengineering.stackexchange)

I have two Raspberry Pis on my network - let's call them Pi and Rho.

I'm trying to set up port forwarding via ssh tunnel between them, such that an application can connect to a port on Rho and get results from a server listening on a port on Pi (my eventual goal is actually to set up port forwarding such that a host on a different network could get access to a Samba share on Pi via an ssh connection to Rho, without my having to entirely open a firewall port to Pi).

Pi's IP in my LAN is 192.168.42.69, and Rho's is 192.168.42.112 - these are the IPs that I ssh to from my local network to connect to them.

In order to test this, I have started a minimal Python server (with SimpleHTTPServer) on Pi's port 8000, and run sudo ssh -L 140:localhost:8000 [email protected] -N on Rho. When I curl localhost:140 or curl 127.0.0.1:140 on Rho, I get the response I expect. However, when I curl 192.168.42.112:140 on Rho, I get a connection refused; verbose output below:

$ curl -vvv 192.168.42.112:140
* Expire in 0 ms for 6 (transfer 0x2cd880)
*   Trying 192.168.42.112...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x2cd880)
* connect to 192.168.42.112 port 140 failed: Connection refused
* Failed to connect to 192.168.42.112 port 140: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 192.168.42.112 port 140: Connection refused

What is the reason for this discrepancy?

Having checked this other question, I confirmed that the environment variable HTTP_PROXY is not set on Rho, nor is NO_PROXY.

Source Link
scubbo
  • 199
  • 1
  • 4
  • 10

Why does `curl <this machine's IP>` behave differently than `curl localhost`?

(Redirected from networkengineering.stackexchange)

I have two Raspberry Pis on my network - let's call them Pi and Rho.

I'm trying to set up port forwarding via ssh tunnel between them, such that an application can connect to a port on Rho and get results from a server listening on a port on Pi (my eventual goal is actually to set up port forwarding such that a host on a different network could get access to a Samba share on Pi via an ssh connection to Rho, without my having to entirely open a firewall port to Pi).

Pi's IP in my LAN is 192.168.42.69, and Rho's is 192.168.42.112 - these are the IPs that I ssh to from my local network to connect to them.

In order to test this, I have started a minimal Python server (with SimpleHTTPServer) on Pi's port 8000, and run sudo ssh -L 140:localhost:8000 [email protected] -N on Rho. When I curl localhost:140 or curl 127.0.0.1:140 on Rho, I get the response I expect. However, when I curl 192.168.42.112:140 on Rho, I get a connection refused - verbose output.

What is the reason for this discrepancy?

Having checked this question, I confirmed that the environment variable HTTP_PROXY is not set on Rho, nor is NO_PROXY.