Socks SSH forward internet and DNS
https://datawookie.dev/blog/2023/12/ssh-tunnel-dynamic-port-forwarding/
# local ssh -R 1080 user@remote # remote export http_proxy=socks5h://localhost:1080 export https_proxy=socks5h://localhost:1080 # export HTTPS_PROXY=socks5://localhost:1080/ #echo "nameserver 127.0.0.1" > /etc/resolv.conf cat <<EOF> /etc/apt/apt.conf.d/12proxy Acquire::http::Proxy "socks5h://localhost:1080"; Acquire::https::Proxy "socks5h://localhost:1080"; EOF cat <<EOF>> /etc/environment #export http_proxy=socks5h://localhost:1080 #export https_proxy=socks5h://localhost:1080 export all_proxy=socks5h://localhost:1080 EOF # Configurte scks5h proxy in Docker mkdir /etc/systemd/system/docker.service.d cat <<EOF> /etc/systemd/system/docker.service.d/proxy.conf [Service] Environment="HTTP_PROXY=socks5h://127.0.0.1:1080" Environment="HTTPS_PROXY=socks5h://127.0.0.1:1080" EOF sudo systemctl daemon-reload sudo systemctl restart docker docker.service # python sudo apt install -y python3-socks # git git config --global http.proxy 'socks5h://127.0.0.1:1080' # SSH config Host my-remote HostName my_server.com RemoteForward 1080 ServerAliveInterval 60 ServerAliveCountMax 3 or optional # dns2socks # http(s) / socks export # https://lib.rs/install/dns2socks https://gist.github.com/yougg/5d2b3353fc5e197a0917aae0b3287d64 # dns2socks wget https://github.com/tun2proxy/dns2socks/releases/download/v0.2.0/dns2socks-x86_64-unknown-linux-gnu.zip dns2socks --socks5-settings socks5://localhost:1080 --force-tcp