Basically I want to use iptables to redirect all traffic on a specific ipv4 port on a vps to a different vps on a ipv6 port. I have managed to do this with socat: socat TCP4-LISTEN:1080,fork,su=nobody TCP6:[example ipv6]:3389
I want to do this via iptables. Is it possible?
@szymonp said:
I want to do this via iptables. Is it possible?
If this is just because one VPS is IPv6 only, you might find it easier to just set up wireguard between the two machines and then just use iptables to route across that, and listen on the wireguard IPv4 address on the other end.
Comments
I think you cant do that natively with iptables. But alternatively you can use 6tunnel, a vpn or ssh forwarding.
is it possible to make the socat run at startup in the background? I tried looking online but all answers are outdated
This seems up to date to me.
https://getridbug.com/unix-linux/how-to-run-socat-as-a-systemd-service-to-bridge-two-remote-unix-sockets/
Or you could enable /etc/rc.local if it's supported.
If this is just because one VPS is IPv6 only, you might find it easier to just set up wireguard between the two machines and then just use iptables to route across that, and listen on the wireguard IPv4 address on the other end.