کد:
http://articles.techrepublic.com.com/5100-10878_11-6180759.html?tag=rbxccnbtr1
Takeaway: DHCP is a vital service in today's network environment. Windows adminstrators may be too intimidated by Linux's command line tools to create a DHCP server. Here's how you can do so from a GUI.

This article is also available as a TechRepublic download.


The DHCP server is a tool every company, small or large, must employ. It's also one of those servers that needs to be a "set it and forget it" server. What better environment to serve it up with than Linux? Before YaST, setting up DHCP servers was a matter of hand-editing configuration files in Linux. YaST makes this task simple. Gone are the days of learning details of various .conf or .cf files. Now you can point-and-click your way to getting a DHCP server up and running, because the good people at Novell and SuSE have worked hard to bring the Linux administrator the YaST (Yet another Setup Tool) to help. This tool makes setting up a plethora of system settings as simple as it gets.
Author's note

Our environment for this article will be OpenSuSE 10.2 and the GNOME 2.16 environment. Both are stable, robust, and very user-friendly. The installation of SuSE 10.2 was a complete installation, so everything needed to set up a complete server is there. I highly recommend this method, so you do not have to fight with dependencies should you have to install a piece of software for your server. The five-disc installation will leave you with everything you need to set up a DHCP server.
What's DHCP?

Before we move on, let's make sure we all know what DHCP is. Dynamic Host Configuration Protocol is a system that allows machines to request an IP address from a server configured to hand out available addresses. This server knows what addresses are in use (so two machines don't have the same address), knows how long a machine can keep an address, and eases the job of the network administrator.
DHCP is the successor to the outdated BOOTP protocol. Since BOOTP didn't support lease time or offer any options, it quickly became incompatible with networks evolving faster than expected. So DHCP became a standard protocol in 1993 and in 1997 RFC 2131 detailed the specifics of the protocol.
A quick look around YaST

Although it is contrary to what many Linux admins would advise, I'm going to log into my SuSE 10.2 machine as root for this setup. I don't do this often, but it saves me from having to enter the root password each time I perform an administration task. Once you are done setting up these services, log out.
The first thing you'll want to do is to select the Computer menu, as seen in Figure A.
Figure A

The new GNOME 2.16 menu is quite a change from the usual cascading menu. From the menu, select Control Center, as shown in Figure B.
Figure B

The Control Center is grouped in both Groups and Common Tasks. From the Common Tasks section, select Administrator Settings to open the YaST Admin Tool. You'll see a screen similar to Figure C.
Figure C

It should be obvious that Network Services is your next destination. Select Network Services to reveal a listing of the various Network Services that can be configured from within YaST, as shown in Figure D.
Figure D

A nice collection of GUI tools help you configure your Linux server. You are ready to begin the task at hand.
Configuring DHCP

Press the DHCP button; the DHCP wizard will open, as seen in Figure E.
Figure E

Press Select, and a small X will appear under the Selected column to indicate that is the card being used. There are two configurations here. The first thing you will want to do is select the network interface to be used for DHCP. In the above photo you will see that only one card is available for DHCP. This machine actually has two cards, but one is a wireless card. Both cards are available and supported, but only the wired card is available for DHCP. To select the right card, highlight said card and press the Select button. The rest of the DHCP wizard will apply only to that card.
The second option in this screen relates to the firewall. You need to select the box to open the firewall for the selected device. If you do not open up the firewall, DHCP traffic/requests will not be allowed in to the server; that will do you no good.
Once you are happy with your selections, press Next to move on to the next segment of the configuration.
Figure F illustrates the global configurations needed. Many of these settings will be self explanatory. You will need:

  • Domain Name: The domain name that will be leased to the client machines.
  • Primary Name Server: Must be an IP address.
  • Secondary Name Server: Must be an IP address.
  • Default Gateway: Default gateway that will be leased out to DHCP clients.
  • NTP Server: Time server.
  • Print Server: This will be leased as the default print server on your network.
  • WINS Server: Windows Internet Naming Service to be leased out (if used).

Figure F

Don't forget: nameservers must be dotted quad IP addresses. You will also have to configure the lease time on the IP addresses handed out. You can configure lease time in Seconds, Minutes, Hours, or Days by using the drop-down and entering a value. Once you are satisfied with your settings, press Next to move on to the next configuration.
Figure G shows the heart and soul of your DHCP configuration. This is where you configure the range of IP addresses, as well as configuring the Default lease time. This lease time is a bit different than the lease time from the previous screen because it gives you the option of configuring a maximum lease time (the period during which the server reserves a particular IP address for a particular client).
Figure G

Make sure your Last IP Address configuration doesn't go beyond the Maximum IP address configuration. One thing you will want to remember. If you use a specific IP address for your gateway (which you will), say 192.168.1.1, you will want to make sure you leave that address out of the range handed out by the server. To do this, you would configure your first IP address as 192.168.1.2. You will also notice that the IP address range in my configuration is blanked out. This is because of the nature of my machine. I have only one network card available, which is already on a 192.168.1.x network scheme. If I had two cards available, I would be able to specify a card not connected to the private network already up and configured.
Once you have everything configured properly, press Next and you're on the final screen.
Figure H shows the last screen of the setup. This screen asks you how you want DHCP to be started. You have two choices: start at bootup, or start manually. I would recommend starting the service at boot; otherwise, you'll have to manually start DHCP services (along with all other necessary services) when your machine is rebooted.
Figure H

Use caution switching to Expert mode. The only module that allows you to switch back and forth between Expert and Simple mode is the Runlevel Editor module. You'll also notice a button to switch you to Expert mode. This is similar to other YaST wizards. If you switch to expert mode, you no longer have a wizard-like setup. Instead, you will open up the configuration, and on the left side of the configuration window you'll have a tree-view of each needed configuration. On the right side of the window will be the actual configurations. You can also toggle between the tree-view and a help-view by pressing either the Tree or Help button. (If you are in Tree mode, you'll have a Help button. If you are in Help mode, you'll have a Tree button.)
Once you have decided on your startup mode, press Finish. YaST will write your changes to the various configuration files, save those changes, and start up the DHCP services.
That's all there is to it.
Final thoughts

YaST has enabled many a Linux newbie to quickly deploy Linux servers to cover a wide range. Now setting up a DHCP server is as simple as point, click, done




موضوعات مشابه: