Test and establish a Linux DHCP server

Source: Internet
Author: User

Most of the time, Linux is a configuration platform we need. We implement it in a virtual machine environment. Generally, when a virtual machine is opened, it will slow down. We only use one 2003 Server for customer service machine verification, during verification, you only need to set the 2003 Nic channel. In this experiment, the Red Hat Enterprise Edition 4 is used. The following describes how to implement the dhcp test in linux.

Dhcp test lab platform in Linux:

Two LINUX servers, one DHCP server, one dhcprelay proxy server, and one PC2003.

In Linux, the dhcp test is implemented with three network segments:

 
 
  1. 192.168.1.0 /24  
  2. 192.168.2.0 /24  
  3. 192.168.3.0 /24 

The three NICs of the DHCP relay Proxy Server are:

 
 
  1. eth0;eth1;eth2  
  2. eth0:192.168.1.1  
  3. eth1:192.168.2.1  
  4. eth2:192.168.3.1 

The NIC of the DHCP server is:

 
 
  1. eth0  
  2. eth0:192.168.1.2 

The eth0 of the dhcp server and the eth0 of dhcprelay are both set to vmnet2dhcprelay and eth1 to vmnet3. When Customer Service 2003 is set to vnnet3, The eth2 of the hcprelay IP Address 192.168.2.0/24 should be set vmnet4 when Customer Service 2003 is set to vnnet4, the IP address of 192.168.3.0/24 should be obtained, configure the IP address of each network adapter. Be sure not to configure the IP address correctly. After the environment is set up, you can start.

In Linux, the first step in dhcp testing is to configure DHCP.

Open the dhcpd. conf file and write it to the file.
 

 
 
  1. ddns-update-style interim;  
  2. ignore client-updates;  
  3. option time-offset -18000; # Eastern Standard Time  
  4. default-lease-time 259200;   
  5. max-lease-time 777600;  

# Configure three scopes below

 
 
  1. subnet 192.168.1.0 netmask 255.255.255.0 {  
  2. option routers 192.168.1.1;  
  3. range dynamic-bootp 192.168.1.5 192.168.1.254;  
  4. }  
  5. subnet 192.168.2.0 netmask 255.255.255.0 {  
  6. option routers 192.168.2.1;  
  7. range dynamic-bootp 192.168.2.5 192.168.2.254;  
  8. }  
  9. subnet 192.168.3.0 netmask 255.255.255.0 {  
  10. option routers 192.168.3.1;  
  11. range dynamic-bootp 192.168.3.5 192.168.7.254;  
  12. }  


Save and exit.

Start the DHCP service dhcpd start. Refresh the firewall iptables-F and note that it is in upper case. F. DHCP is configured here. You can configure OPTION as needed. Next, configure DHCPRELAYL.

 
 
  1. Echo 1>/proc/sys/net/ipv4/ip_forward # start routing.
  2. Dhcprelay 192.168.1.2 # dhcp relay for 192.168.1.2.
  3. Iptables-F
  4. Service dhcpd restart

You can. Then, put 2003 in different Wmnet to get the IP address.

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.