by osivertsson · 4y ago · 0 comments
Using only IPv6 works fine most of the time but in 2022 there are still some services that are available only through IPv4, like GitHub.
However, I have both IPv4 and IPv6 connectivity from the places I connect to my server. Could I use that to get IPv4 connectivity on the server when I need it?
The answer is yes of course, and here is one way to do just that.
Replace dedicated-server-hostname with your server hostname or IP.
laptop> cat ~/.ssh/config
Host dedicated-server-hostname
RemoteForward 1080
laptop> ssh username@dedicated-server-hostname
server> cat ~/.gitconfig
...
# Using git on an IPv6 only machine that needs to access git repos only
# available through IPv4, e.g. github.com. The workaround is to use the
# network on the machine we connect from.
#
# This can be done by setting up a SOCKS proxy when connecting to the IPv6 only
# machine over ssh, see RemoteForward in ssh_config(5).
[http "https://github.com"]
proxy = socks5h://localhost:1080check their help docs