DHCP server configuration in Linux

Source: Internet
Author: User
DHCP server configuration in Linux-Linux Enterprise Application-Linux server application information. For details, refer to the following section. After more than three hours of work, I finally got it done. I went around and recorded the entire process:

Step 1: Execute Command rpm ql dhcp

Find/usr/share/doc/dhcp-3.0pl1/dhcpd. conf. sample

Run the command: cp/usr/share/doc/dhcp-3.0pl1/dhcpd. conf. sample/etc

Mv/etc/dhcpd. conf. sample dhcpd. conf

Step 2: Open the dhcp. conf configuration file

Vi/etc/dhcpd. conf

The following is the file content:

Ddns-update-style interim;
Ignore client-updates;

Subnet 192.168.0.0 netmask 255.255.255.0 {

# --- Default gateway
Option routers 192.168.0.1;
Option subnet-mask limit 255.0;

# Option nis-domain "domain.org ";
Option domain-name "domain.org ";
Option domain-name-servers 192.168.0.1;

Option time-offset-18000; # Eastern Standard Time
# Option ntp-servers 192.168.1.1;
# Option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- You understand Netbios very well
# Option netbios-node-type 2;

Range dynamic-bootp 192.168.0.100 192.168.0.150;
Default-lease-time 259200;
Max-lease-time 518400;

# We want the nameserver to appear at a fixed address
# Host ns {
# Next-server marvin.redhat.com;
# Hardware ethernet 12: 34: 56: 78: AB: CD;
# Fixed-address 207.175.42.254;
#}
}

After configuration is complete

Run the service dhcpd reload command.

Now, the server configuration is complete.

Step 3: test the client

In this step, a problem occurred, and the client could not get the IP address. Later, I checked the problem in red and found out where the problem was. The following is the full text of the post:

Like me, many of my friends may use VMW for linux network configuration experiments. When I was conducting a DHCP experiment, a problem occurred:

Client RH9, server RH AS4, server DHCP server, client cannot obtain DHCP information. SNIFFER cannot capture packets to obtain dhcp request and ACK information.

There are two solutions:

1. The client first runs ifconfig down eth0 and then ifconfig up eth0. At this time, eth0 is started, but there is no IP address. Run ifup eth0 again. Obtain the IP address. Sniffer listens to two DHCP packets, REQUEST and ACK.

2. edit/etc/sysconfig/network-scripte/ifcfg-eth0

Last join

Check_line_down (){

Return 1;

}

Save. At this point, the/etc/sysconfig/networking/ifcfg-eth0 will automatically add this sentence. If not, manually add it.

Ifup eth0, you will find everything is fine.

Ifconfig eth0 up

Service network start

This should be done.

The reason is very simple. It is a BUG in the ifup script. You have written the second one above.

In fact, there can also be a way to achieve it. Modify the/etc/rc. sysinit file and set up the NIC before loading the network (no IP address is available). dhcp can also be automatically obtained.

Solve the problem.

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.