Installation and configuration of linuxDHCP

Source: Internet
Author: User
Installation and configuration of linuxDHCP-Linux Enterprise Application-Linux server application information. See the following for details. In most cases, Linux serves as a DHCP server and windows 95/98 serves as a DHCP client.
Linux can also be used as a DHCP client, that is, you need to install the dhcpcd rpm package, Linux as a DHCP server,
You only need to install the dhcpd rpm package

I. Prerequisites for DHCP server operation:
To enable the DHCP server to serve windows machines, you may need to create an IP address named 255.255.255.255.
Add this route command to/etc/rc. d/rc. local to run automatically after each startup.
# Route add-host route 255.255.255 dev eth0
If an error message is reported:
255.255.255.255: Unkown host
Add the following entry to the/etc/hosts file.
255.255.255.255 dhcp, then try:
# Route add-host dhcp dev eth0


2. The DHCPd background program always reads the configuration file/etc/dhcpd. conf. The following is an example of the DHCP configuration file:
# Sample/etc/dhcpd. conf
Default-lease-time 1200;
Max-lease-time 9200;
Option subnet-mask limit 255.0;
Option broadcast-address 192.168.1.255;
Option routers 192.168.1.254;
Option domain-name-servers 192.168.1.1, 192.168.1.2;
Option domain-name "mydomain.org ";

Subnet 192.168.1.0 netmask 255.255.255.0 {
Range 192.168.1.10 192.168.1.100;
Range 192.168.1.150 192.168.1.200;
}
This will allow the DHCP server to allocate two IP address ranges to the customer 192.168.1.10-100 or 192.168.1.150-200.
If the customer does not continue to request the DHCP address, the IP address is released after 1200 seconds. Otherwise, the maximum lease time is 9200 seconds.
The server sends the following parameters to the DHCP client:
Use 255.255.255.0 as the subnet mask, 192.168.1.255 as the broadcast address, and 192.168.1.254 as
The default gateway uses 192.168.1.1 and 192.168.1.2 as the DNS server.
If you want to specify a WINS server for a windows client, you need to include the following options in the dhcpd. conf file:
Option netbios-name-servers 192.168.1.1;

3. You can also specify a fixed IP address for a network card. At any time, this network card will always be obtained from the DHCP server.
Fixed IP Address: Add the following statement to/etc/dhcpd. conf:

Host haagen {
Hardware ethernet 08: 00: 2b: 4c: 59: 23;
Fixed-address 192.168.1.222;
}

You can also write a row:
Host Jephe {hardware ethernet 00: a0: c9: a6: 96: 33; fixed-address 192.168.1.12 ;}

You can also specify different Gateway Addresses and server names for a machine:
Host Jephe {hardware ethernet 00: a0: c9: a6: 96: 33; fixed-address 192.168.1.12; option
Routers 192.168.11.5 ;}

4. In most cases, a dhcpd. leases file is not created for DHCP installation. Before you start the DHCP server,
You must create an empty file dhcpd. leases

# Touch/var/state/dhcp/dhcpd. leases
To start the DHCP server, simply enter/usr/sbin/dhcpd or use # ntsysv to automatically start the DHCP service.

This will start dhcpd on the eth0 device. If you want to start dhcpd on the eth1 device
#/Usr/sbin/dhcpd eth1

To debug DHCP, use #/usr/sbin/dhcpd-d-f

5. Two NICs:
Sometimes you need to install the DHCP service on a machine with two NICs (as a firewall or gateway). The following example
It indicates a DHCP setting on a firewall machine, because the external network adapter (internet) does not need to provide the DHCP service:
Therefore, the settings are as follows:
Subnet 192.168.1.0 netmask 255.255.255.0 {
Range 192.168.1.2 192.168.1.4;
Default-lease-time 86400;
Max-lease-time 259200;
Option subnet-mask limit 255.0;
Option broadcast-address 192.168.1.255;
Option routers 192.168.1.254;
Option domain-name-servers 192.168.1.254;
}
Subnet 202.102.34.102 netmask 255.255.255.255 {
}
6. FAQs
A. What is the fixed IP address of the MAC machine?
If you do not know the IP address obtained by setting the DHCP function for the MAC server, you can send an email on the MAC server,
The recipient can check the sender's IP address through the mail header, and then ping the IP address and use the arp command to check the arp
The physical address of the IP address in the cache.
B. If a windows machine is installed with DHCP software, such as sygate and wingate
Other windows customers will first find windows DHCP servers, rather than Linux DHCP servers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.