Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SSH: Route conn. to different machine based on hostname?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Tatsh
Apprentice
Apprentice


Joined: 22 Jul 2007
Posts: 178

PostPosted: Tue Feb 17, 2015 9:35 am    Post subject: SSH: Route conn. to different machine based on hostname? Reply with quote

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
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1717

PostPosted: Tue Feb 17, 2015 9:03 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
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