Skip to content

Instantly share code, notes, and snippets.

@coolpalani
Forked from dmazzer/port_forward_ipv4_ipv6.sh
Created October 7, 2019 22:45
Show Gist options
  • Save coolpalani/9018a0f33954fcefc74269c28f1ab097 to your computer and use it in GitHub Desktop.
Save coolpalani/9018a0f33954fcefc74269c28f1ab097 to your computer and use it in GitHub Desktop.
Forwarding IPv4 Ports to IPv6 Hosts
#!/bin/bash
# UDP:
socat UDP4-LISTEN:5683,fork,su=nobody UDP6:[aaaa::212:4b00:615:a1f7]:5683
# TCP:
socat TCP4-LISTEN:22,fork,su=nobody TCP6:[2a01:198:79d:1::8]:22
# UDP, IPv6
socat UDP6-LISTEN:5683,fork,su=nobody UDP6:[aaaa::212:4b00:615:a1f7]:5683
# Using in a script:
nohup socat TCP4-LISTEN:22,fork,su=nobody TCP6:[2a01:198:79d:1::8]:22 &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment