Configuration dependent on local hostname?



Hello,

To get access to hosts behind a NAT-router, I have put the following
into my ssh-config:

Host ext-gw.my-do.main
ProxyCommand none

Host *.my-do.main
ProxyCommand ssh ext-gw.my-do.main nc -w1 %h 22

This works fine while being outside of the NATted network.

Now I would like to configure a laptop in such a way that it is able
to connect directly to the network as well as from the outside. For
that, I'd like to do something like that:


Host gw.my.do.main
ProxyCommand none

LocalHost ! *.my.do.main
Host *.my.do.main
ProxyCommand ssh gw.my.do.main nc -w1 %h 22
LocalHost *


Of course, such a "LocalHost" option does not exist. Maybe there exist
some other way to do this?

BTW: I am using openssh as it comes with opensuse11.1 and ubuntu-8.10

opensus-11.1 $ ssh -V
OpenSSH_5.1p1, OpenSSL 0.9.8h 28 May 2008

ubuntu-8.10 $ ssh -V
OpenSSH_5.1p1 Debian-3ubuntu1, OpenSSL 0.9.8g 19 Oct 2007



Relevant Pages

  • Re: Examples of ProxyCommand?
    ... have to connect to a host which is not directly reachable. ... So lets assume, you have a client computer C, with ssh installed. ... man 5 ssh_config (look for ProxyCommand) ... $ channel 2: open failed: connect failed: Operation not permitted ...
    (comp.security.ssh)
  • Re: ssh to a remote server via gateway server
    ... uses proxycommand, it uses "nc host 22" to do the ... final connection to the target ssh daemon (on labpc in your case). ... Host labpc ...
    (Fedora)
  • Re: Examples of ProxyCommand?
    ... have to connect to a host which is not directly reachable. ... So lets assume, you have a client computer C, with ssh installed. ... This gives you a connection from C to H, and you can setup a tunnel: ... man 5 ssh_config (look for ProxyCommand) ...
    (comp.security.ssh)
  • Examples of ProxyCommand?
    ... I have 3 computers with ssh servers on them and i'm trying to do some example ... ProxyCommand lines so I can see what they do. ... Connection closed by remote host ...
    (comp.security.ssh)
  • Re: Configuration dependent on local hostname?
    ... To get access to hosts behind a NAT-router, ... ProxyCommand none ... LocalHost * ... Good judgement comes with experience. ...
    (SSH)