NAT – How to Port Forward IPv6 to IPv4

nat;port-forwarding

I have two servers, one is ROUTER – equiped with IPv6 IP and private IPv4 IP and the other one – WORKER has private IPv4 only. And I would like to configure NAT/port forward to access the second server through IPv6 of the first one.

So this will be possible and will connect me to WORKER server:

ssh user@2a02:xxxxxxx::1 -p 30123

I have also included diagram to better explain what I need to achieve.

network-diagram

Note: Both servers are Ubuntu 18.04

I have tried to configure iptables and socat, but no sucess so far.

My tries:

# Using socat
socat TCP6-LISTEN:30001,fork TCP4:192.168.1.1:22
# Using 6tunnel
6tunnel -6 30001 192.168.1.1 22

Does anyone have any experience with this kind of forward using IPv6? If yes, how to do it so?

Best Answer

During debug I have discovered typo in command and after fixing it both commands work fine.

# Using socat
socat TCP6-LISTEN:30001,fork TCP4:192.168.1.1:22

# Using 6tunnel
6tunnel -6 30001 192.168.1.1 22

Creds