· 7 years ago · Nov 29, 2017, 08:34 PM
1Host gamma-local
2 HostName 192.168.1.100
3 Port 22
4 User andreas
5
6Host gamma-remote
7 HostName 55.22.33.99
8 Port 12345
9 User andreas
10
11Match originalhost gamma exec "[ x$(/sbin/iwgetid --scheme) != xMyHomeESSID ]"
12 HostName 192.168.1.100
13 Port 22
14
15Host gamma
16 User andreas
17 Port 12345
18 HostName 55.22.33.99
19
20[[ $(wget -qO - http://wtfismyip.com/text) =~ ^'55.22.33.' ]] &&
21 ssh 192.168.1.100 ||
22 ssh -p 12345 55.22.33.99
23
24[[ $(ip address show dev eth0 | grep -Po 'inet K[d.]+') = '192.168.1.12' ]] &&
25 ssh 192.168.1.100 ||
26 ssh -p 12345 55.22.33.99
27
28alias gamma="[[ $(wget -qO - http://wtfismyip.com/text) =~ ^'55.22.33.' ]] && ssh 192.168.1.100 || ssh -p 12345 55.22.33.99
29
30Host gamma
31 ProxyCommand ssh-multipath-proxy 192.168.1.100:22 55.22.33.99:12345
32 User andreas