LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-02-2007, 12:02 PM   #1
gshocky
LQ Newbie
 
Registered: Nov 2007
Posts: 2

Rep: Reputation: 0
Port Forward for MYSQL


My situation is as follows:

I have server that currently runs MYSQL. It also runs apache and other stuff. MYSQL is being moved to a dedicated DB server. I've changed a ton of web apps and other stuff but there are some old legacy apps that sill exist that have the servername harded and I can't change them easily.

What I want to do is 'proxy' or forward the port 3306 on my server to 3306 on another server. I saw some examples using iptables but they all showed to be using two sets of IP addresses.. In my setup I have on address, I don't care about the outside world, only the internal world.

Can anyone point me in the right direction? (not asking for someone to spend there time to give me a walkthrough, just asking for a nudge to point me in the right path.)

Thank you for any help you can provide. I appreciate it.
 
Old 11-02-2007, 02:17 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Moved to Networking for better exposure.
 
Old 11-02-2007, 03:36 PM   #3
complich8
Member
 
Registered: Oct 2007
Distribution: rhel, fedora, gentoo, ubuntu, freebsd
Posts: 104

Rep: Reputation: 17
I think you could accomplish this with ssh, actually ...

eg: once mysqld is off on your local machine, set up a script that just maintains a command like:

Code:
#!/bin/bash
while /bin/true
do
    ssh -g -L 3306:databaseserver:3306 someuser@localhost
    sleep 1
done
and set up an rsa or dsa key for someuser on localhost for passwordless logins.

This is sort of the quick-and-dirty hack way to do it, but it'd work. I'm fairly sure you can accomplish something similar with iptables nat rules, but I'm having trouble crafting the exact rules you'd need, offhand.

(this is eerily similar to my post here on a similar subject ... when you have a good enough hammer, everything really is a nail )

Last edited by complich8; 11-02-2007 at 03:38 PM.
 
Old 11-03-2007, 11:20 PM   #4
gshocky
LQ Newbie
 
Registered: Nov 2007
Posts: 2

Original Poster
Rep: Reputation: 0
My solution was as follows:

In RHEL4 I edited the xinetd includes to have a section for 3306.

It was setup to redirect to another server, stream, TCP.

It seems to be working well in our development environment.

Moving into production environment Monday.. Will let you know how it works.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to port forward talusog Linux - Newbie 5 03-28-2007 01:57 AM
Port Forward prbspfc Linux - Networking 9 03-24-2004 06:00 AM
A way to forward an IP/Port to another system's IP/Port astroboy5714 Linux - Networking 6 01-26-2004 05:45 PM
port forward help please indy317 Linux - Networking 2 07-18-2003 02:21 PM
Forward port port 80 to lan web server dulaus Linux - Networking 9 10-04-2002 03:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration