![]() |
James Thornton |
| Internet Business Consultant |
| Home | Blog | Bio | Projects | Contact | Latest Blog (new site): How to Get to Genius |
|---|
|
Building DHCP automatically![]() Abstract:
This article explains how to easily configure DHCP on a network. IntroductionThe articles aim is to present :
Building a blank DHCPOur first step is to create a blank configuration file which will
be able to accept all clients on the network.
Once your DHCP server is running (using dhcp start or a similar command according
to your Linux distribution), you can start client stations on the network. They should have been
configured to obtain automatically an IP address.
So, once all the clients have obtained an IP address from the server, the dhcpd.leases file will look like this:
Securing the DHCP configurationNext, it is necessary to convert our "open" DHCP to a static and more secure one. This is done using the now proper dhcp.lease we just created and converting it to what I call a static dhcp. What are the differences between a static and an open DHCP? As far as I am concerned, an open DHCP allows any computer connected to the network to obtain an IP address and usable network parameters. This is a big security hole, any unauthorized pirate could physically connect himself to the network and obtain good network parameters :( To counter such an attack, I use in the static DHCP. Each IP address is only given to clients with corresponding Mac of the associated Ethernet adapter. It is therefore easier to detect an intrusion.
WARNING: If you do not have a DNS server running, the file dhcp.conf must use IP addresses and not machine names.
I wrote a small Perl script which converts the file dhcpd.leases into a static dhcp configuration file. Automatic construction of the DNSWhy stop along the way when we could configure the DNS server at the same time? The same Perl script, with option -dns, will build files named.$domaine.ajouter and named.$domaine.rev.ajouter that you should check before adding them to your own dns reverse dns files. Moreover, it is necessary to fill the named.conf file with parameters from your own domain. For instance:
Congratulate yourself, you now have a working dhcp and dns configuration. Network NeighborhoodAvailable for the same price (even better when it is free :), the configuration of "Network Neighborhood" from window machines. Here is the story with a small drawing and explanations: At Slach 2 (A demo party), I installed two networks, one was a 10 Mbits and the other a 100 Mbits (for privileged users at that time...). The major problem was: both networks could not "see" each other though the "Network Neighborhood" of windows. The solution is WINS. WINS allow to declare, on the network, a server which holds a list of links between IPs and "name of several domains". It is a sort of master for networks R1 and R2. It is therefore necessary to configure a WINS server and clients so that they use it and create an IP gateway between these two networks. Wins is well supported by Samba :) Schematic:
dhcpd.conf is modified in order to auto-configure clients using our wins server :). Without dhcp, it would have been necessary to configure each client individually in order to activate their access to the wins server! WARNING: DO NOT FORGET TO ADD THE FOLLOWING LINES TO YOUR DHCPD.CONF IN ORDER FOR YOUR WINS SERVER TO BE USED BY CLIENTS
To have a working wins server, I have a working Samba, configured as follows:
It is necessary to restart the servers, dhcp, samba and dns if modifications
have been made. Restart also dhcp clients so that they take into account the new
configuration. Watch for groups on the "other" network in the "network neighborhood".
If you can "see" machines from the outside but cannot access them, you need to
configure the gateway so that it acts as a real gateway between the two networks.
Usually it is necessary to use something similar to:
Bugs and limitationsBe careful, if the dhcp server is used in two areas at the same time, there will only be one dns file on the output from the program... It will then be necessary to sort the file manually. I hope this document will be useful. Please feel free to contact me for comments or questions. ReferencesFor a deeper insight of the various parts, consult:
Where to find the last version of this document?Updates are frequent, check the following address for the latest French version on the site http://www.rycks.com/erics/linux/ Talkback form for this articleEvery article has its own talkback page. On this page you can submit a comment or look at comments from other readers:
2000-08-17, generated by lfparser version 1.7 |
|
James Thornton, jamesthornton.com>Services: Internet Consultant, Austin, TX |
Electric Speed: Interaction Architecture |