[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

/etc/hosts and using make for system admin tasks (was Re: Reverse DNS lookup at telnet)



On Sun, 12 Apr 1998, Scott D. Killen wrote:

> I run a server with Debian 1.3.1 installed.  This machine is set up
> as an internet gateway to a 3 bit subnet.  Diald is installed for
> automatic dialup internet connections.  My machine runs a caching
> name server that the machines on the subnet use as a nameserver.
> The problem is that when I telnet from a machine on the subnet, the
> server does a reverse lookup of the connecting machine's IP address,
> but it can't answer it's own request so the Internet link goes up.
> This makes telnet connections very slow... especially if the dialup
> connection doesn't work.
>
> How can I solve this problem?  I want to either stop doing reverse
> lookups when answering telnet requests, or, ideally, I want to set up
> bind so it can answer reverse lookups for addresses on my subnet....

the simplest way is to just list the machines in your 3 bit subnet in
/etc/hosts, and make sure that /etc/host.conf has "order hosts,bind".

reverse-lookups for any connections from ip addresses listed in
/etc/hosts are resolved immediately. resolving other names/IPs is
unaffected.

remember to keep /etc/hosts up to date if any of the machines on your
subnet change.


note that this only helps for connections to your gateway machine. if
there are other unix boxes on your lan which do reverse lookups for each
connection then you will need to copy this hosts file to them too. use
scp or rdist or rsync or something to do this. it could also be handy to
have a Makefile in /etc so that you only have to type 'make' to do the
copy.

e.g. here's a simple /etc/Makefile which does this and a few other
useful things. make is a very useful system administration tool. you can
use it to automate the production of any file(s) from any other file(s),
or even as the stamp-hosts example below shows execute certain commands
only if certain file(s) have changed since the last time it was run.

---cut here---/etc/Makefile---cut here---
#! /usr/bin/make -f

# default action
all: 
	cd /etc && $(MAKE) targets

targets: stamp-hosts aliases.db virtusertable.db mailertable.db

stamp-hosts: hosts
	scp hosts machine1:/etc/hosts
	scp hosts machine2:/etc/hosts
	scp hosts machine3:/etc/hosts
	touch /etc/stamp-hosts

aliases.db: aliases
	newaliases

virtusertable.db: virtusertable
	makemap hash virtusertable <virtusertable

mailertable.db: mailertable
	makemap hash mailertable <mailertable

---cut here---/etc/Makefile---cut here---

(btw, remember that the indented lines in the Makefile are indented with
a TAB character, not spaces!)

craig

--
craig sanders


--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: