Search code examples
sshopensshssh-tunnel

SSH tunnel: Get client ip in remote server


I'm tunneling 2 servers:

ServerA & ServerB

with the following command on ServerA

ssh -NTC -L 0.0.0.0:30238:<ServerB>:30238 user@ServerB

The connection establishes successfully.

However, when a client/user is connected to ServerA, I don't get the "client/user" IP on ServerB. I get ServerB ip.

Is there any way I can fix it and get the real client IP?


Solution

  • After investigating a lot, I learned that preserving the client IP after SSH tunnel is impossible.

    To have client IP, you need to use other approaches for tunneling.