For your hosts where you want to connect conditionally over jumphost your can use a proxy command that points to a shell script like: ProxyCommand my-proxy-script %h %p Then the proxy script would contain something like: if grep -q ad.work.com /etc/resolve; then #direct cionnection exec nc $1 $2 fi exec ssh -T -a jumphost nc $1 $2 Clearly you may need to adjust the check for direct connection. Also you may add a check that the host is not jumphost to prevent recurssion... On 9 February 2011 04:43, Asif Iqbal <vadud3@xxxxxxxxx> wrote: > On Tue, Feb 8, 2011 at 7:15 PM, Igor Bukanov <igor@xxxxxxxx> wrote: >> On 8 February 2011 21:18, Asif Iqbal <vadud3@xxxxxxxxx> wrote: >>> host from="!.*.ad.work.com" won't work. >> >> That should be simply >> >> host !.*.ad.work.com > > That won't work. I need a way to negate the origin domain, not the > destination domain. > > when I connect my laptop to work network it get a dhcp ip and my > server joins the ad.work.com domain. > > But when I connect my laptop into home network, I am not into the > ad.work.com domain > > So I want the proxy command to enable, only when my laptop connects > from home and not when connects from work > > Not sure if I could draw the scenario without confusion. > > Thanks for the help! > >> > > > > -- > Asif Iqbal > PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu > A: Because it messes up the order in which people normally read text. > Q: Why is top-posting such a bad thing? >