Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Port Forward IP VPS
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Port Forward IP VPS

youandriyouandri Member

Hello,

Anyone can help?

I have ddos protected IP Public in vps A, let say ip: a.a.a.a

And vps B with IP Public b.b.b.b

In vps B, i’m running mysql service with port 3306.

How i can port forward 3306 from vps A, a.a.a.a:3306 to b.b.b.b:3306?

I have try socat, it’s forward but give error mysql server has gone.

Thank you in advance.

:)

Comments

  • I am not a server expert, but still, I never recommend using MySQL on remote via public IP due to latency and the issue that can bring to the application.

    Thanked by 1youandri
  • Wireguard/Gre Tunnel

    Thanked by 1youandri
  • tetechtetech Member

    @Hotmarer said:
    Wireguard/Gre Tunnel

    Wireguard or HAProxy if you enable mysql encryption

    Thanked by 2chihcherng youandri
  • yoursunnyyoursunny Member, IPv6 Advocate

    If you run nc b.b.b.b 3306 on VPS A, can it reach the port or is there an error?

    • If error: check firewall on VPS B.
    • If reachable: continue to next step.

    If you stop socat and run nc -l 3306 on VPS A, and run nc a.a.a.a 3306 from the application server, can it reach the port or is there an error?

    • If error: check firewall on VPS A.
    • If reachable: continue to next step.

    If you start socat on VPS A, and run nc a.a.a.a 3306 from the application server, can it reach the port or is there an error?

    • If error: check socat command line.
    • If succeed for the first time and error on subsequent connections: check socat command line.
    • If reachable: consult a DBA.

    What socat command did you use?

    Thanked by 1youandri
  • @Hotmarer said:
    Wireguard/Gre Tunnel

    @tetech said:

    @Hotmarer said:
    Wireguard/Gre Tunnel

    Wireguard or HAProxy if you enable mysql encryption

    Thank you, any reference to do that?

  • @yoursunny said:
    If you run nc b.b.b.b 3306 on VPS A, can it reach the port or is there an error?

    • If error: check firewall on VPS B.
    • If reachable: continue to next step.

    If you stop socat and run nc -l 3306 on VPS A, and run nc a.a.a.a 3306 from the application server, can it reach the port or is there an error?

    • If error: check firewall on VPS A.
    • If reachable: continue to next step.

    If you start socat on VPS A, and run nc a.a.a.a 3306 from the application server, can it reach the port or is there an error?

    • If error: check socat command line.
    • If succeed for the first time and error on subsequent connections: check socat command line.
    • If reachable: consult a DBA.

    What socat command did you use?

    Thank you,

    In first step, it reach and i get IP is blocked because of many connection errors.
    Now it's working.

    Next question, is socat can make many connection?

  • tetechtetech Member

    @youandri said:

    @Hotmarer said:
    Wireguard/Gre Tunnel

    @tetech said:

    @Hotmarer said:
    Wireguard/Gre Tunnel

    Wireguard or HAProxy if you enable mysql encryption

    Thank you, any reference to do that?

    Which? Wireguard?

    Thanked by 1youandri
  • ShamliShamli Member

    Ssh port forward...?

    Thanked by 1youandri
  • Daniel15Daniel15 Veteran
    edited June 2021

    Like others have mentioned, I'd use WireGuard plus an nftables (or iptables if you want to go old-school) rule to forward the port.

    Having said that, please don't expose MySQL publicly unless you really need it. If you do really need it, ensure the user can only connect from the IP address you expect them to connect from (don't just use * as the host), and enforce SSL for them (there's some way to enforce SSL for particular users. I'm not sure what the command is to enable that, but it's in phpMyAdmin)

    Thanked by 1youandri
Sign In or Register to comment.