I'm looking for a way to use specific CIDR blocks to match hosts in the SSH client configuration (usually ~/.ssh/config
). For example, I have an entry to forward all traffic through a bastion host if the IP falls into a certain range, let's say 10.1.0.0/16
:
host 10.1.*
proxycommand ssh -q bastion -W %h:%p
This works very well, but how about when I add some ranges that don't fit the dot notation exactly?
# doesn't work, unfortunately
host 10.2.0.0/18
proxycommand ssh -q bastion-foo -W %h:%p
host 10.2.64.0/18
proxycommand ssh -q bastion-bar -W %h:%p
Is there something in the manual that I've missed, or a clever scripting trick that would enable matching these host IP ranges?