3

i got a small issue/question by using SOCAT on my vServer. My Problem is that i just got CG-NAT DS-Lite ISP wich provides me a private IPv4 Internal ISP IP and an native public IPv6 Adress. That means i do not have a native/functional/public IPv4 Adress.

To get my internal TCP and UDP bound Services offered to the Internet i have to work with IPv4>IPv6 Portforwarding.

So i did set up an VServer wich contains a public IPv4 and a IPv6 aswell.

My plan is to Forward Ports over the VServers IPv4 to my IPv6 Router. After some research i gave socat a try and it worked well. I did used a command like this: socat TCP4-LISTEN:25,fork,su=nobody TCP6:[2a01:198:79d:1::8]:25

And i could offer my Routers Login Page via the IPv4 of my VServer. Everything is well.

But my Problem is, that i want to forward multiply ports/port ranges in once. I want to use my VServer only as a IPv4->IPv6 Relay and i dont really want to map every new Port manually.

The Port Mapping should be 1:1, for example: The IPv4 Port 25, will also be the IPv6 Port in every situation. The best solution would be, if every Port (excluding 22) would be forwarded to my IPv6 Adress.

The final configuration should also work as a startup Service.

Perhaps there is a other way to get this done. Feel free for any ideas.

Best regards, Daniel

0

1 Answer 1

2

After the disappointment of no comments i found a way by myself. Following command allows to open and forward multiply Ports at once:

For TCP: echo -n 80 443 25 3389| xargs -d ' ' -I% bash -c 'socat TCP4-LISTEN:%,fork TCP6:[IP6HERE]:% &' For UDP: echo -n 9987 8443| xargs -d ' ' -I% bash -c 'socat UDP4-LISTEN:%,fork UDP6:[IP6HERE]:% &'

Input the ports wich you want to be opened and replace the IP6HERE with your actual device IPv6. Dont forget to forward the opened port for IPv6 to your destination device.

Worked well for me. Maybe this helps someone.

Someone knows how to apply these commands by starting up my Linux VServer?

Best regards, Daniel

2
  • Server configuration questions don't belong on SuperUser which may be part of the reason you didn't get any responses. You should go post this at Server Fault. Nov 23, 2019 at 0:40
  • what's the syntax for port ranges though? And what about if you want to forward from, say, ipv4:x to ipv6:y where x != y? Dec 15, 2022 at 14:16

You must log in to answer this question.

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