Previously, the server was called a huge computer, installed in an enclosed room called "server". Today, every second computer in the network to some extent performs server functions. About how to configure one of these services - namely DHCP - and will be discussed.

The word DHCP stands for Dynamic Host Configuration Protocol - that is, the dynamic client configuration protocol. This is one of the most important and useful protocols of the TCP / IP family, helping to automatically configure dozens and hundreds of machines at the same time. What's more important - many technologies directly depend on this protocol: for example, the remote boot protocol PXE explicitly looks for a DHCP server for further instructions on obtaining a boot image. DHCP itself is the second, newer and more common method of network configuration. The previously used BOOTP has been virtually out of use lately, although it is supported for hypothetical "legacy devices".

In principle, DHCP refers to the number of "problem-free" protocols, that is, all operating systems equally correctly and consistently support its functions (unlike, for example, DNS directory systems and especially DDNS, around which misunderstandings and even real wars arise) . The implementation of the server part in 90% of cases is a well-known daemon dhcpd, configurable through the configuration file. Another, common "demo" Smile happy - dhcp-service, built-in Windwos Server. By the way, it is quite correct. But, as is known, both Linux and Windwos Server are very whimsical systems, not only demanding to the user's skills, but also limiting his gamer activity. But there is good news: in fact, you do not need a "server" platform for installing a DHCP server, just the usual Windwos XP. This operating system is quite stable and productive - in some respects even more than the same Windwos Server or Linux (including drivers).

Turbo DHCP

Let's talk about DHCP on the example of implementation of DHCP Turbo from Weird Solutions (the company 's website is located at ). The product is completely free (in the version personal edition), is open for downloading from the manufacturer's site (and also is on our disk). Actually, the DHCP server itself runs on Windwos NT, Linux and Solaris platforms. In addition to the server, there is a nice Turbo DHCP Manager in use that can connect to any local or remote Turbo DHCP server using its own protocol, protected by the Blowfish encoding.

So, as always, everything starts with the installation - for installation you will need only 10 MB of memory, 8 MB of RAM and 2.5 MB for every 1000 addresses provided by this server. In short - the most unimportant requirements. Everything else relates to the most interesting - the configuration.

For certainty, suppose that you are not alone in your network - there are several administrators and, accordingly, servers, including DHCP. It should be noted that the simultaneous operation of several DHCP servers is quite a regular mode. Actually negotiation (trade for) IP-addresses occurs in two passes - first the host sends out a reservation request, to which the servers respond for some time. At this stage, the server can check for a free IP address, ping it for no conflicts, or check the MAC address for the "serviceability" of this host. The server can always refuse the client for one reason or another, but that's what it can not - it's how to get the host to get the installation from it. The only way to somehow influence events is simply to give your answer faster than other servers. Of course, if you negotiate with other DHCP administrators, and they refuse to service "your" hosts, then in the end you will get the desired result. But still the most correct thing is to comply with the geometric and logical topology: just plug your DHCP into one hub or router with the hosts that it will serve. How to refuse from serving other people's hosts will be shown below.

Options

First, let's define: all parameters passed from the server to the client are called options. The options are divided into categories. There are mandatory options, such as IP address and subnet mask. Some options are used only for business purposes, for example, determine the beginning and the end of the options list - you can not adjust their values, although you will see them in the list. The rest of the options are necessary in special situations, for example, with network boot.

The main thing is to define a subnet

The first thing to do when configuring DHCP is to determine the range of addresses being distributed and the subnet mask. From an administrative point of view, the mask is even more important. Ask your supervisor or look at the settings in which subnet you are working. Often subnets of category "D" (which actually does not exist) are used - that is, the subnet mask is not aligned on the byte boundary, but has an arbitrary number of bits. The first address on the subnet always indicates the subnet itself, the last one is the multicast address, broadcasting. The number of computers on the subnet is determined by the number of zeros at the end of the mask. Draw a two in this degree, subtract two - and get the potential number of addresses available to you.

Example of calculating a subnet

For example, take my own subnet: the address of my server is 10.0.0.97, the mask is 255.255.255.224, in binary form is 11111111.1111111.1111111.11100000.

The number of zeros at the end of the mask is five, that is, two in the fifth gives 32. Therefore, the "granularity" of our subnets of category D is 32 addresses. It is possible to imagine that the first subnet begins with the address 10.0.0.0, the second one - 10.0.0.32, the third one - 10.0.0.64, the fourth one - 10.0.0.96. In fact, this is not at all obvious - maybe the first subnet, starting with 10.0.0.0, has a mask of 255.255.255.192 == 1111111.11111111.11111111.11000000, that is, it includes 64 addresses. We are not interested in this at all - it's important that we work in the address space from 10.0.0.96 to 10.0.0.127 and, if we want our hosts after the launch to be in the same subnet with the server, then allocate addresses only from this range . As already mentioned, the first address is the subnet address as a whole, the last one is brodcasting, so they are excluded. In fact, I have only (heh) three of my hosts, which I was going to configure through this server, so I only needed three addresses. After negotiations with our administrator, the pool of distributed "pies" was reduced from 10.0.0.124 to 10.0.0.126. The range of addresses and sub-mask of the network is called scope and is one of the basic concepts of DHCP, which is associated with all other settings. That is, any setting applies to a particular area.

Basic settings for Windows clients

Options are typed key-value pairs available on the Policies tab The next thing that interests us after creating the domain (in addition, you can specify several more parameters), these are the parameters that we give out to the host, in addition to its IP and masks. Typically, three of these are important: the default router, the DNS server, and the WINS server. These parameters, as already mentioned, are specified by options. Options are well documented variables that have a number and a name, so if there is any doubt about the terminology, you can always refer to the option by number. Numbers can be either positive or negative, and you can define your own options with numbers greater than 128 - it's another matter which system can use them. Options, among other things, are typed values, that is, they can be either numbers or strings, or special types, such as IP or MAC addresses.

So, the main options are 3 (Gateways), 6 (Domain Name Servers), 44 (NBT Name Servers), 46 (NBT Node Type). A few explanations - firstly, as you can see, all the parameters are group, that is, they mean several meanings that you can use. WINS is configured via NBT parameters - option 44 points to the server, and option 46 should be equal to 8 (hybrid). All these options you add on the tab Policies.

You can check the settings immediately after saving them in the Turbo DHCP Manager. To do this, you do not even need to restart the client machine - just reset the interface parameters and retrieve them from the server again:

  Ipconfig / release
 Ipconfig / renew
 Ipconfog / all 

Although this is not required at all, you can get any additional parameters from the DHCP server for the loaded machine, for example, the domain name suffix (option 15), the name of the DHCP server (option 20), the network host name (option 12), and so on .

I'd like to note that Linux (as well as many others) use DHCP clients much more intensively, additionally receiving X-server addresses, font servers, NIS / NIS + servers and domains, POP servers, SMTP, NNTP and many other options.

Serviceability restriction

The private server is marked in Properties. In this case, the server icon will be circled in red, and the menu will display Registrations

An important question is how to abandon other people's MAC network addresses and serve only a few hosted hosts? After all, as a rule, you do not want to install a bridge and cut off the wards from the rest of the network - this will require an additional server with two interfaces, as well as routing settings, etc. You do not need to do this - just define your server as private. You can do this on the Server Properties tab, accessible by right-clicking on the server name.

After determining your server as private, it will deny service to all hosts except those whose network MAC addresses are listed in the appearing Registrations folder. This, of course, will add work to find these addresses - but now you can very accurately control each parameter.

Remote Download

Finally, I'll list a few options necessary to configure remote (network) loading of hosts. So, in addition to the required parameters, you will need only two parameters: -1 the name of the image to load and the -14 address of the TFTP server. At least, for PXE firmware, which stands on modern cards, this is quite enough.

By the way, I have had a small nightmare story with this download, the circumstances of which I will share with you. Situevina: the computer is loaded on a diskless scheme, with PXE everything goes fine, the OS is loaded, but when it is loaded, IP and settings are not taken from my server, but from another, where everything is "as unnecessary". I was in shock for three seconds! It turns out that somehow, at a time when I did not have a server, I registered in the driver of the network interface (card) soft-MAC - almost all modern cards allow it. This was necessary for the reason that our addresses are distributed over a fixed leasing plan: for each MAC - a specific IP, and all the others - in FIG. The cards changed, and every time I woke up the admin to be reluctant ... Well, with this "golimym poppy" my computer and broke to my own private server, which is configured only for the maintenance of certain network addresses. Nakladochka came out, however. And I have already started to think that the definition of "favorite" DHCP is not deterministic, and it can differ for PXE BIOS and OSes - although, as you know, probably, this can happen in a complex network, if some site "crouches" or botlnek somewhere, Then zafakapitsya for a while. But you must avoid such misunderstanding by all the bits of your binary soul.

In short: raise your DHCP, set it up properly - and you will not need to run after the system administrator at least on this issue. Successful DHCP'inga.