On Sun, 21 Sep 2008 15:08:18 +0200
Momesso Andrea <momesso.andrea@gmail.com> wrote:
> My home server is 192.168.1.5 in my home wan, the hostname of the
> machine is "fandango", and the the /etc/hosts in my laptop looks like
> this:
>
> [...]
> 192.168.1.5 fandango
>
> Sometimes I need to connect to the server while I'm far from home, so
> the server has also a dyndns address, let's say "fandango.dyndns.org".
>
> When I connect from outside my wan I use "fandango.dyndns.org", when
> I'm at home just "fandango".
>
> Is there a way to tell my laptop to always use "fandango" and,
> if "192.168.1.5" is available, to resolve it this way, otherwise to
> resolve it as "fandango.dyndns.org".
>
> This way I will avoid double configurations, double password stored
> in firefox, ecc...
>
> Any ideas?
Well, when I used to switch my laptop between college (college didn't
use DHCP!) and home networks, I was reduced to a script to switch
configs for eth0...
It sounds like all you need to do is swap out the hosts file depending
on which network you are on, this shouldn't be difficult...
Rob.
09-21-2008, 05:17 PM
Momesso Andrea
Automatic host switching
On Sunday 21 September 2008 18:28:48 Alan McKinnon wrote:
> On Sunday 21 September 2008 15:08:18 Momesso Andrea wrote:
> > My home server is 192.168.1.5 in my home wan, the hostname of the machine
> > is "fandango", and the the /etc/hosts in my laptop looks like this:
> >
> > [...]
> > 192.168.1.5 fandango
> >
> > Sometimes I need to connect to the server while I'm far from home, so the
> > server has also a dyndns address, let's say "fandango.dyndns.org".
> >
> > When I connect from outside my wan I use "fandango.dyndns.org", when I'm
> > at home just "fandango".
> >
> > Is there a way to tell my laptop to always use "fandango" and,
> > if "192.168.1.5" is available, to resolve it this way, otherwise to
> > resolve it as "fandango.dyndns.org".
> >
> > This way I will avoid double configurations, double password stored in
> > firefox, ecc...
>
> I'm sure you can get very complex solutions to this, but have you tried
> something as simple as "search dyndns.org" in resolv.conf?
Sorry but I can't understand what you mean...
--
========================================
MOMESSO ANDREA
jabber: topper_harley@jabber.org
========================================
09-21-2008, 05:19 PM
Momesso Andrea
Automatic host switching
On Sunday 21 September 2008 18:47:24 Robert Bridge wrote:
> On Sun, 21 Sep 2008 15:08:18 +0200
>
> Momesso Andrea <momesso.andrea@gmail.com> wrote:
> > My home server is 192.168.1.5 in my home wan, the hostname of the
> > machine is "fandango", and the the /etc/hosts in my laptop looks like
> > this:
> >
> > [...]
> > 192.168.1.5 fandango
> >
> > Sometimes I need to connect to the server while I'm far from home, so
> > the server has also a dyndns address, let's say "fandango.dyndns.org".
> >
> > When I connect from outside my wan I use "fandango.dyndns.org", when
> > I'm at home just "fandango".
> >
> > Is there a way to tell my laptop to always use "fandango" and,
> > if "192.168.1.5" is available, to resolve it this way, otherwise to
> > resolve it as "fandango.dyndns.org".
> >
> > This way I will avoid double configurations, double password stored
> > in firefox, ecc...
> >
> > Any ideas?
>
> Well, when I used to switch my laptop between college (college didn't
> use DHCP!) and home networks, I was reduced to a script to switch
> configs for eth0...
>
> It sounds like all you need to do is swap out the hosts file depending
> on which network you are on, this shouldn't be difficult...
>
> Rob.
Like having a /etc/hosts.home and a /etc/hosts.world and a script that
sysmlinks them to /etc/hosts depending on the fact that i can ping or not
192.168.1.5?
--
========================================
MOMESSO ANDREA
339 4192788
========================================
09-21-2008, 05:34 PM
Robert Bridge
Automatic host switching
On Sun, 21 Sep 2008 19:19:46 +0200
Momesso Andrea <momesso.andrea@gmail.com> wrote:
> On Sunday 21 September 2008 18:47:24 Robert Bridge wrote:
> > On Sun, 21 Sep 2008 15:08:18 +0200
> >
> > Momesso Andrea <momesso.andrea@gmail.com> wrote:
> > > My home server is 192.168.1.5 in my home wan, the hostname of the
> > > machine is "fandango", and the the /etc/hosts in my laptop looks
> > > like this:
> > >
> > > [...]
> > > 192.168.1.5 fandango
> > >
> > > Sometimes I need to connect to the server while I'm far from
> > > home, so the server has also a dyndns address, let's say
> > > "fandango.dyndns.org".
> > >
> > > When I connect from outside my wan I use "fandango.dyndns.org",
> > > when I'm at home just "fandango".
> > >
> > > Is there a way to tell my laptop to always use "fandango" and,
> > > if "192.168.1.5" is available, to resolve it this way, otherwise
> > > to resolve it as "fandango.dyndns.org".
> > >
> > > This way I will avoid double configurations, double password
> > > stored in firefox, ecc...
> > >
> > > Any ideas?
> >
> > Well, when I used to switch my laptop between college (college
> > didn't use DHCP!) and home networks, I was reduced to a script to
> > switch configs for eth0...
> >
> > It sounds like all you need to do is swap out the hosts file
> > depending on which network you are on, this shouldn't be
> > difficult...
>
> Like having a /etc/hosts.home and a /etc/hosts.world and a script
> that sysmlinks them to /etc/hosts depending on the fact that i can
> ping or not 192.168.1.5?
Basically, I would probably look at methods of hooking it onto the IP
assigned to the device (ifplugd should be able to do this), but that is
the basic idea.
09-21-2008, 06:53 PM
Neil Bothwick
Automatic host switching
On Sun, 21 Sep 2008 18:34:15 +0100, Robert Bridge wrote:
> > Like having a /etc/hosts.home and a /etc/hosts.world and a script
> > that sysmlinks them to /etc/hosts depending on the fact that i can
> > ping or not 192.168.1.5?
>
> Basically, I would probably look at methods of hooking it onto the IP
> assigned to the device (ifplugd should be able to do this), but that is
> the basic idea.
You could do it in the postup function of /etc/conf.d/net.
--
Neil Bothwick
Your mama's like a railroad track: She gets laid all over the country.
09-21-2008, 07:51 PM
Alan McKinnon
Automatic host switching
On Sunday 21 September 2008 19:17:29 Momesso Andrea wrote:
> On Sunday 21 September 2008 18:28:48 Alan McKinnon wrote:
> > On Sunday 21 September 2008 15:08:18 Momesso Andrea wrote:
> > > My home server is 192.168.1.5 in my home wan, the hostname of the
> > > machine is "fandango", and the the /etc/hosts in my laptop looks like
> > > this:
> > >
> > > [...]
> > > 192.168.1.5 fandango
> > >
> > > Sometimes I need to connect to the server while I'm far from home, so
> > > the server has also a dyndns address, let's say "fandango.dyndns.org".
> > >
> > > When I connect from outside my wan I use "fandango.dyndns.org", when
> > > I'm at home just "fandango".
> > >
> > > Is there a way to tell my laptop to always use "fandango" and,
> > > if "192.168.1.5" is available, to resolve it this way, otherwise to
> > > resolve it as "fandango.dyndns.org".
> > >
> > > This way I will avoid double configurations, double password stored in
> > > firefox, ecc...
> >
> > I'm sure you can get very complex solutions to this, but have you tried
> > something as simple as "search dyndns.org" in resolv.conf?
>
> Sorry but I can't understand what you mean...
Add that line to /etc/resolv.conf. If the resolver can't resolve
hostname "fandango" it will then also try "fandango.dyndns.org"
You would have to remove "fandango" from /etc/hosts (otherwise it will always
resolve).
This is of course extremely simplistic, and chances are you need something a
little more involved. But it's always worthwhile investigating extremely
simplistic solutions.
Also, keep in mind that if you use a DHCP server that you control, there are
all manner of files and configs you can push down to the workstation.
Capabilities do vary between servers so be sure to check them all out.