Solved

MySql client tunnel through intermediate host

Posted on 2014-02-24
5
106 Views
Last Modified: 2016-06-03
Situation:

Hosts A,B,C

Host A is where my MySql client resides. Host C is the MySql server. Host B is a host to which i have ssh access, which has the benefit of a fixed IP, which is not the case with host A. I'd like only one host to be permitted remote MySql access to C, namely A. I was rather hoping this could be made possible by tunneling through B. Is it? I want to be able to query C from A.

Host B does not have a MySql client and i really need it to stay that way.
0
Comment
Question by:CEHJ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 29

Accepted Solution

by:
serialband earned 350 total points
ID: 39884272
You should be able to use ssh on Host B to map the remote port of host C to the local port on Host B.

ssh -T -N -L 3306:localhost:3306 Host_C

You could also remap the port on Host B to another port.
ssh -T -N -L 3307:localhost:3306 Host_C


You might even want to run another tunnel from your system, Host A, to Host B to keep the traffic encrypted.

ssh -T -N -L 3308:localhost:3307 Host_B

Then you just connect you MySQL cilent to port 3308 on your local system.   I used different ports to show you how to set it up.
0
 
LVL 86

Author Comment

by:CEHJ
ID: 39884311
Thanks - that's interesting. Normally B's firewall is very tight. Is it the case that since we're tunneling through ssh, B:3306 is not going to have a firewall problem for me connecting from A?
0
 
LVL 29

Expert Comment

by:serialband
ID: 39884756
What ports are open on B?  You can remap that port to anything.
0
 
LVL 86

Author Comment

by:CEHJ
ID: 39885139
From memory, 53, 139 & 22
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question