Sample Header Ad - 728x90

Help to configure SSH tunnel to access to a remote server

0 votes
0 answers
375 views
Here my scenario: 192.168.2.222 --- VPN ---> 192.168.2.200 / 192.168.0.10 --- LAN ---> 192.168.0.50 My local machine My remote machine Target server Due to the netmask of the VPN interface (/24) from my local machine I cannot reach the target server directly. But if I SSH into my remote machine, then I can reach it because the remote (local) interface is on the same subnet of the target server. In order to use some tools on my local machine I want to enable SSH tunnel on my remote machine. For example, let's say I want to access a SQLServer server (port 3306) on the target server. I set up DBeaver to use SSH tunnel on my remote machine but it cannot connect to the database. On my remote machine the sshd.config file is the following: Include /etc/ssh/sshd_config.d/*.conf ChallengeResponseAuthentication no UsePAM yes GatewayPorts yes X11Forwarding yes PrintMotd no PermitTunnel yes AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server To manually test it out I did: $local ssh -L 13306:192.168.0.50:3306 user@192.168.2.200 $local sqsh -S 192.168.0.50:13306 -U user -D database -P password I got: sqsh-2.5.16.1 Copyright (C) 1995-2001 Scott C. Gray Portions Copyright (C) 2004-2014 Michael Peppler and Martin Wesdorp This is free software with ABSOLUTELY NO WARRANTY For more information type '\warranty' Open Client Message Layer 0, Origin 0, Severity 78, Number 41 Unable to connect: Adaptive Server is unavailable or does not exist Open Client Message Layer 0, Origin 0, Severity 78, Number 41 Unable to connect: Adaptive Server is unavailable or does not exist Issuing the very same command on my remote machine (of course using 3306 instead of 13306) leads to a successfully connection. I also checked the port 13306 from my local machine but it's still closed: $local nmap 192.168.2.200 -p 13306 Starting Nmap 7.80 ( https://nmap.org ) at 2022-04-15 13:10 CEST Nmap scan report for 192.168.2.200 Host is up (0.014s latency). PORT STATE SERVICE 13306/tcp closed unknown What should I set up further?
Asked by Mark (815 rep)
Apr 15, 2022, 11:11 AM
Last activity: Apr 15, 2022, 11:54 AM