Skip to content

Instantly share code, notes, and snippets.

@TTTPOB
Created January 24, 2021 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TTTPOB/5a89254b3ceb71f22fe9cce1cde1dd2d to your computer and use it in GitHub Desktop.
Save TTTPOB/5a89254b3ceb71f22fe9cce1cde1dd2d to your computer and use it in GitHub Desktop.
socat systemd unit file for wsl2 to forward a port to windows host
[Unit]
Description=Socat Greeting Service
Documentation=man:socat(1)
[Service]
User=root
Group=root
#ExecStart=/bin/bash -c "/usr/bin/env WSL_HOST=`tail -1 /etc/resolv.conf |cut -d' ' -f2` socat tcp-l:%i,fork,reuseaddr tcp:$WSL_HOST:%i "
ExecStart=/bin/bash -c "socat tcp-l:%i,fork,reuseaddr tcp:`tail -1 /etc/resolv.conf |cut -d' ' -f2`:%i"
Restart=on-success
[Install]
WantedBy=multi-user.target
@TTTPOB
Copy link
Author

TTTPOB commented Jan 24, 2021

I cannot figure out why the first one wont work, it basically did the same thing with the second one but with a environment variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment