Hi !

I made a litte shellscript that can generate a dhcp.conf 
from an "dhcp -d" output

I use "dhcpd -d" to generate a list of all client  MAC-adresses.

read the README and the source for more info.

tell me if you like it or if you find bugs.

Greetings,
Martin Herweg

Attachment: make_dhcpd.conf
Description: application/shellscript



make_dhcpd.conf   README

(c) 2001 mherweg*gmx.de


make_dhcpd.conf is a half automatic way of generating a
/etc/dhcpd.conf file for an LTSP Server


how to do it:
============

1.) make sure that all clients can
    start etherboot from Boot-EPROM or -floppy 

2.) connect all clients and the server to the network
    the server schould have a high IP-Adress, like 192.168.0.254
    and not  192.168.0.1, because that's the first client by default.
    you can change this in the script if you want by changing the
    FIRSTCLIENT variable

3.) turn all clients OFF

4.) at the server execute the following as root:

        dhcpd -d 2>&1 | tee /tmp/dhcpd.log 

warning ! 
on some systems (Debian) dhcpd is only a script, you have to start the real
server-binary, not the script , so it gets the -d option.

5.) turn ON your first client. 

6.) wait for a message like this to appear at the server:

DHCPDISCOVER from 00:a0:24:82:fd:4a via eth0: network WORKSTATIONS: no free leases

6.) turn OFF the first client.

7.) do the steps 5-6 for all clients.

8.) you can stop the dhcpd with ctrl-C

9.) edit ./make_dhcpd.conf to your needs

10.) run ./make_dhcpd.conf   - it will generate /tmp/maclist.lst and /tmp/dhcpd.conf

11.) if you are satisfied with  /tmp/dhcpd.conf then copy it to /etc



known bugs / todo
-----------------

hostnames t01..t09 looks ok, but t010..t099 is not so nice and schould be t10..t99
- I'm not a perfectionist.

maximum of 253 clients

only class-C networks ?

it wouls be cooler just to turn all clients on and leave them turned on,
but the i get duplicate entries in maclist.lst and dhcpd.conf
I can avoid duplicates with
 
grep DHCPDISCOVER /tmp/dhcpd.log | cut -f 3 -d " " | sort | uniq > /tmp/maclist.lst

instead of
 
grep DHCPDISCOVER /tmp/dhcpd.log | cut -f 3 -d " " | uniq > /tmp/maclist.lst

but then the IP-Adresses and hostnames are not in the turning-on
order any more.





Reply via email to