0

I have a quite small VPS abroad, and a BBS telnet server software that i wish to run locally.

What are my options, If i wish to only use the VPS as a relay for connections, effectively and transparently forwarding and relaying all port 23 and port 22 traffic, between any connecting telnet clients, via the VPS, and the actual computer serving/hosting the server software and storage?

  • neither relay nor local server have got static public ip, only dynamically updated dns hostnames.
  • All telnet (port 23) and ssh (port 22) communication, between the actual server and any clients, would have to transparently go via the VPS relay.

Shouldn't it be possible somehow?

enter image description here

1 Answer 1

1

There are lots of ways to do that. You can set up an SSH tunnel and connect your server via SOCKS proxy, or you can create a tunnel interface (OpenVPN, for instance) and bind the server to it.

A more elegant solution might be to use NAT on your remote system:

iptables -t nat -A PREROUTING -p tcp --dport 23 -j DNAT --to-destination <home_server_ip>:23
iptables -t nat -A POSTROUTING -j MASQUERADE

You would also need to allow IP forwarding by adding net.ipv4.ip_forward=1 to /etc/sysctl.conf.

3
  • Would this work well OK with UFW enabled and take presedence in IPTables ?
    – DhP
    Commented Aug 16, 2019 at 23:31
  • the '''--to-destination <home_server_ip>:23''' would have be a dynamic url unfortunately, since there's no static public ip on the home_server connection
    – DhP
    Commented Aug 16, 2019 at 23:32
  • Would the IPTables rules be transparent <client>-<vps relay>-<server> both ways?
    – DhP
    Commented Aug 16, 2019 at 23:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .