Route ssh traffic based on hostname using FreeBSD/pf?

kbanman asked:

I have a proxy/firewall machine running FreeBSD 9, using PF to route and filter traffic as needed.

Now I’m setting up a git server, which runs over ssh, but I’m already using port 22 for ssh. I would like to route traffic from any IP to port 22 to another machine, if the hostname they used to reach the server was a subdomain (git.mydomain.com). Kind of a virtual host, but for ssh…

Is this possible with pf?
Any suggestions?

My answer:


If it’s meant to be the same machine, then just point git.example.com at it and you’re done.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.