Gentoo Archives: gentoo-user

From: Robert Bridge <robert@××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Automatic host switching
Date: Sun, 21 Sep 2008 17:37:22
Message-Id: 20080921183415.7aa1c051@robbieab.com
In Reply to: Re: [gentoo-user] Automatic host switching by Momesso Andrea
1 On Sun, 21 Sep 2008 19:19:46 +0200
2 Momesso Andrea <momesso.andrea@×××××.com> wrote:
3
4 > On Sunday 21 September 2008 18:47:24 Robert Bridge wrote:
5 > > On Sun, 21 Sep 2008 15:08:18 +0200
6 > >
7 > > Momesso Andrea <momesso.andrea@×××××.com> wrote:
8 > > > My home server is 192.168.1.5 in my home wan, the hostname of the
9 > > > machine is "fandango", and the the /etc/hosts in my laptop looks
10 > > > like this:
11 > > >
12 > > > [...]
13 > > > 192.168.1.5 fandango
14 > > >
15 > > > Sometimes I need to connect to the server while I'm far from
16 > > > home, so the server has also a dyndns address, let's say
17 > > > "fandango.dyndns.org".
18 > > >
19 > > > When I connect from outside my wan I use "fandango.dyndns.org",
20 > > > when I'm at home just "fandango".
21 > > >
22 > > > Is there a way to tell my laptop to always use "fandango" and,
23 > > > if "192.168.1.5" is available, to resolve it this way, otherwise
24 > > > to resolve it as "fandango.dyndns.org".
25 > > >
26 > > > This way I will avoid double configurations, double password
27 > > > stored in firefox, ecc...
28 > > >
29 > > > Any ideas?
30 > >
31 > > Well, when I used to switch my laptop between college (college
32 > > didn't use DHCP!) and home networks, I was reduced to a script to
33 > > switch configs for eth0...
34 > >
35 > > It sounds like all you need to do is swap out the hosts file
36 > > depending on which network you are on, this shouldn't be
37 > > difficult...
38 >
39 > Like having a /etc/hosts.home and a /etc/hosts.world and a script
40 > that sysmlinks them to /etc/hosts depending on the fact that i can
41 > ping or not 192.168.1.5?
42
43 Basically, I would probably look at methods of hooking it onto the IP
44 assigned to the device (ifplugd should be able to do this), but that is
45 the basic idea.

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] Automatic host switching Neil Bothwick <neil@××××××××××.uk>