View previous topic :: View next topic |
Author |
Message |
Tatsh Apprentice
Joined: 22 Jul 2007 Posts: 187
|
Posted: Tue Feb 17, 2015 9:35 am Post subject: SSH: Route conn. to different machine based on hostname? |
|
|
I have one IP and several machines behind it. One router and a few switches.
So basically it would be cool if from outside the network, I could do the following with no ~/.ssh/config for the Port option:
ssh a.somedomain.com -> a.internal:22
ssh somedomain.com -> main.internal:22
a.somedomain.com and somedomain.com point to the same IP.
Is it possible for iptables to recognise the hostname before any SSH negotiation sequence and reroute before that? Is there any tool similar to HTTP proxying (squid, nginx) but works for SSH or almost any connection?
From what I've seen on it seems most say that there is no concept of hostname (other than for resolving IP via DNS) compared to HTTP/S protocol, which means you can definitely do something based on IP but not hostname ? I am wondering if anyone here has any information contrary to that. |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3136
|
Posted: Tue Feb 17, 2015 9:03 pm Post subject: |
|
|
iptables uses IPs, not names. However, you can redirect connection by protocol and by port as well.
So, it is possible to match incoming packet against router's external IP and some arbitrarly chosen port and route it to some host (And port) in your local network. Check out iptables DNAT target for details |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|