Build DHCP and relay servers under RHEL5

Source: Internet
Author: User

650) this. width = 650; "src =" http://img1.51cto.com/attachment/201310/004928445.png "title =" 1.png" alt = "003478445.png"/>

Requirement Description:

Build DHCP and DHCP relay servers in the gateway host

1. Provide Dynamic Address Allocation service for the following three physical network segments:

192.168.1.0/24

192.168.2.0/24

192.168.3.0/24

2. Default lease time: 21600 seconds

3. Maximum lease time: 43200 seconds

4. the DNS server address used by the client is as follows:

202.106.0.20

8.8.8.8

5. The IP address ranges used for dynamic allocation are:

192.168.1.100 ~ 192.168.1.200

192.168.2.200 ~ 192.168.2.200

192.168.3.300 ~ 192.168.3.200


The IP address of each interface of the gateway host acts as the default gateway for the corresponding network segment


Implementation ideas:

1. confirm that the network address of the server host is correctly configured.

2. Configure the DHCP server first.

3. Configure the DHCP relay server.


Verify lab results

Note:

Set the VM memory to 256 MB, enter the character mode, and disable uncommon system service programs.

Direct the default gateway of the DHCP server to the DHCP relay server.


GO

DHCPThe configuration Nic of the server is vmnet2)

[Root @ dhcpserver ~] # Service iptables stop

[Root @ dhcpserver ~] # Setenforce 0

[Root @ dhcpserver ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE = eth0

BOOTPROTO = static

ONBOOT = yes

HWADDR = 00: 0c: 29: b3: f2: f5

IPADDR = 192.168.1.2

NETMASK = 255.255.255.0

GATEWAY = 192.168.1.1

[Root @ dhcpserver ~] # Service network restart

[Root @ dhcpserver ~] # Ifconfig eth0

[Root @ dhcpserver ~] # Yum-y install dhcp

[Root @ dhcpserver ~] # Cp/usr/share/doc/dhcp-3.0.5/dhcpd. conf. sample/etc/dhcpd. conf

[Root @ dhcpserver ~] # Vim/etc/dhcpd. conf

Ddns-update-style interim;

Ignore client-updates;

Default-lease-time 21600;

Max-lease-time 43200;

Optiondomain-name-servers 202.106.0.20, 8.8.8.8;

Optiondomain-name "Crushlinux.com ";


Subnet 192.168.1.0 netmask 255.255.255.0 {

Optionrouters 192.168.1.1;

Optionsubnet-mask limit 255.0;

Rangedynamic-bootp 192.168.1.100 192.168.1.200;

}


Subnet 192.168.2.0 netmask 255.255.255.0 {

Optionrouters 192.168.2.1;

Optionsubnet-mask limit 255.0;

Range dynamic-bootp 192.168.2.100192.168.2.200;

}


Subnet 192.168.3.0 netmask 255.255.255.0 {

Optionrouters 192.168.3.1;

Optionsubnet-mask limit 255.0;

Rangedynamic-bootp 192.168.3.100 192.168.3.200;

}


[Root @ dhcpserver ~] # Service dhcpd restart

[Root @ dhcpserver ~] # Chkconfig dhcpd on

[Root @ dhcpserver ~] # Ping 192.168.1.1


DHCPThe relay server is configured with three NICs: vmnet2, vmnet3, and vmnet4)

[Root @ DHCRELAY ~] # Service iptables stop

[Root @ DHCRELAY ~] # Setenforce 0

[Root @ DHCRELAY ~] # Vim/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE = eth0

BOOTPROTO = static

HWADDR = 00: 0c: 29: e0: f7: 26

ONBOOT = yes

IPADDR = 192.168.1.1

NETMASK = 255.255.255.0

GATEWAY = 192.168.1.2


[Root @ DHCRELAY ~] # Vim/etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE = eth1

BOOTPROTO = static

HWADDR = 00: 0c: 28: e0: f7: 33

ONBOOT = yes

IPADDR = 192.168.2.1

NETMASK = 255.255.255.0


[Root @ DHCRELAY ~] # Vim/etc/sysconfig/network-scripts/ifcfg-eth2

DEVICE = eth2

BOOTPROTO = static

HWADDR = 00: 0b: 17: e0: f7: 33

ONBOOT = yes

IPADDR = 192.168.3.1

NETMASK = 255.255.255.0

[Root @ DHCRELAY ~] # Service network restart

[Root @ DHCRELAY ~] # Ifconfig

[Root @ DHCRELAY ~] # Ping 192.168.1.2

[Root @ DHCRELAY ~] # Yum-y install dhcp

[Root @ DHCRELAY ~] # Vim/etc/sysconfig/dhcrelay

INTERFACES = "eth0 eth1 eth2"

DHCPSERVERS = "192.168.1.2"

[Root @ DHCRELAY ~] # Service dhcrelay start

[Root @ DHCRELAY ~] # Service dhcrelay restart

[Root @ DHCRELAY ~] # Chkconfig dhcrelay on

[Root @ DHCRELAY ~] # Netstat-tulnp | grep dhcrelay


Client Test

Set the client Nic to vmnet2, vmnet3, and vmnet4 respectively to obtain the IP address.

Test command:

Start --> Run --> cmd

C: \ Users \ Crushlinux> cd \

C: \> ipconfig/release

C: \> ipconfig/renew


This article is from the "Crushlinux Studio" blog. For more information, contact the author!

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.