D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Hosts or DNS to handle home and away machine



Adrian Midgley wrote:
Is there a way to set up routing from here to a PC that has a fixed IP address 
when it is at its owner's university, and when it comes back here gets a 
different address?

Let's get clear - the routing is fine, you can route correctly to both
IP addresses, you just have no way of knowing which is the right one.

So what you have is a "name" problem not a routing problem. Layer 7 not
layer 4.

Theoretically you could try the simplistic two entries in the DNS.

18:05:38 srw srw $ dig test.eighth-layer.internal +short
192.168.0.2
192.168.0.1

In theory all well written applications will do something like this.....

$ telnet test.eighth-layer.internal 25
Trying 192.168.0.2...
telnet: connect to address 192.168.0.2: No route to host
Trying 192.168.0.1...
Connected to test.eighth-layer.internal.
Escape character is '^]'.
220 wretched.demon.co.uk ESMTP


For some definition of well written <urm RFC compliant surely - ed>, and
of course half the time you have to wait for the wrong one to fail.

Alternatively 'just' write a script that updates the DNS servers using
nsupdate with the IP address DHCP returns.

All it has to do is pass the IP address to something like this. A lot of
magic happens in the background makin BIND 9 do dynamic DNS etc.

18:05:46 srw srw $ nsupdate -k ./dnskey/Ktest.+157+00995.private
update delete test.eighth-layer.internal.

18:09:07 srw srw $ nsupdate -k ./dnskey/Ktest.+157+00995.private
update add test.eighth-layer.internal. 10 A 192.168.0.2


In theory you should test return codes - etc etc - and you can probably
find someone at comp.protocols.dns.bind who has done a few already.

ifup calls scripts with variables set for IP address on most distros.

It is a lot of work to avoid commenting and uncommenting one line - how
many siblings do you have at University - or is this someone else?
Much simpler would be to define names "laptophome" and "laptopuni" and
change the name you use ;) Laptop home can be got from integrating DHCP
and Dynamic DNS of course, if DHCP isn't handing out static IP addresses.

Attachment: pgp00110.pgp
Description: PGP signature


Lynx friendly