[svlug] "Mini-DNS" - gethosts

Gyzmobro@aol.com Gyzmobro at aol.com
Mon Jan 21 12:09:04 PST 2002


hello. on my home network, i've setup a linux box to run DHCP to assingn 
fixed ip numbers based on a client's MAC address. i haven't been able to get 
DNS running, and i don't think i'd like to do that now anyway. 

what i'd like to do is write a bash shell script for all the linux DHCP 
clients that would connect to the DHCP server at boot and get a file in the 
format of /etc/hosts, created seperately by me on the server, with all the 
fixed hosts and ip numbers in it that DHCP assigns. the script then would 
then compare an area of /etc/hosts on the client with the file it pulled from 
the server, and append all the entries that are in the downloaded file to 
/etc/hosts, so the client would know the ip numbers of all the linux boxes on 
the network. if something changes and the script is executed, /etc/hosts 
should be updated. so that nothing is messed up, i wan't to script to 
designate an area in the file where it will make all it's changes, and leave 
anything that was previously there alone. so basically you would have 
something like this:

# do not remove the line below or some programs won't work...etc
127.0.0.1       localhost.localdomain   localhost
192.168.0.1     hosta.home.net          hosta

#^#^#^#^#^#^#^#^#^#
# Start of gethosts configuration.

192.168.0.2     hostb.home.net          hostb
192.168.0.3     hostc.home.net          hostc

# End of gethosts configuration.
#^#^#^#^#^#^#^#^#^#

in between the #^#^#^#^#^#^#^#^#^#^# and # star/end... is where i wan't all 
the changes to be made from the script.

my problem is, i don't know how i would tell the script to ftp, for example, 
to the server and put in a password, get the file, and logout. i'd also like 
to know some easy to use file comparison utilities.

thanks in advance,

serban giuroiu (the kid at the installfest)




More information about the svlug mailing list