DHCP services in a detailed

Source: Internet
Author: User

  1. DHCP Concepts and principles
    1. DHCP service role
      1. Automatically assign addresses to a large number of clients, providing centralized management
      2. Reduce management and maintenance costs and improve network configuration efficiency
    2. The address information that can be assigned mainly includes:
      1. IP address, subnet mask of the network card
      2. The corresponding network address
      3. Default gateway Address
      4. DNS server address
      5. Boot file, TFTP server address

    3. the principle of DHCP
      1. Clients looking for servers

        Client–dhcpdiscovery

        If not, 9 seconds, 13 seconds, 16 seconds after 1 seconds of re-sending.

      2. Server provides address

        Server–dhcpoffer

        Provide available IP, lease information, server address, etc.

      3. Accept and broadcast

        Client–dhcprequest

        Declare the DHCP server of your choice

        ARP broadcast, testing the DHCP server of your choice

      4. Server Acknowledgement

        Client–dhcprequest

        Server–dhcpack

        All network parameters are included.

===========================================================

    1. Log back in with the client

      Client–dhcprequest

      Application, continue source use assigned IP address

    2. Update lease

      8 Hours – 4 hours – 2 hours

      Client–dhcpdiscovery

  1. DHCP-related files
      1. rhel6 DHCP package

        dhcp-4.1.1-3.4.p1.el6.x86_64.rpm

      2. DHCP Related configuration

        port number: IPv4 udp67, udp68

        IPv6 udp546, udp547

        service Name: DHCPD (main program) or Dhcrelay (relay)

        Master profile:/etc/dhcp/dhcpd.conf

        P style= "text-align:justify" > template file:/USR/SHARE/DOC/DHCP-4.1.1/ Dhcpd.conf.sample

        trunk configuration file :/etc/sysconfig/dhcrelay

  2. DHCP configuration file resolution.

Option Domain-name "example.org";

Option Domain-name-servers ns1.example.org, ns2.example.org;

Default-lease-time 600;

Max-lease-time 7200;

#ddns-update-style None;

Subnet 10.5.5.0 netmask 255.255.255.224 {

Range 10.5.5.26 10.5.5.30;

Option Domain-name-servers ns1.internal.example.org;

Option Domain-name "internal.example.org";

Option routers 10.5.5.1;

Option Broadcast-address 10.5.5.31;

Default-lease-time 600;

Max-lease-time 7200;

}

Host Passacaglia {

Hardware Ethernet 0:0:c0:5d:bd:95;

FileName "Vmunix.passacaglia";

Server-name "toccata.fugue.com";

}

Host Fantasia {

Hardware Ethernet 08:00:07:26:C0:A5;

Fixed-address fantasia.fugue.com;

}

Class "Foo" {

Match if substring (option vendor-class-identifier, 0, 4) = "SUNW";

}

Shared-network 224-29 {

Subnet 10.17.224.0 netmask 255.255.255.0 {

option routers rtr-224.example.org;

}

Subnet 10.0.29.0 netmask 255.255.255.0 {

option routers rtr-29.example.org;

}

Pool {

Allow members of "Foo";

Range 10.17.224.10 10.17.224.250;

}

Pool {

Deny members of "Foo";

Range 10.0.29.10 10.0.29.230;

}

}

Option Domain-name setting the DNS domain

Option Domain-name-server Setting the DNS server address

Default-lease-time Set default lease time in seconds

Max-lease-time Setting the maximum lease time in seconds

Log-facility Specifying a log device

Ddns-update-style To configure how DNS is updated

Subnet network Segment declaration, acting on the entire subnet segment:

Range sets the pool of IP addresses for allocation

Option Subnet-mask to set the subnet mask for the client

The option routers parameter sets the client's default gateway address

Option Broadcast-address Setting the client broadcast address

The host hosts a declaration that acts on a host computer:

Hardware Ethernet Set the destination host's MAC address

Fixed-address set to its assigned reserved IP

Restart the service for the modified configuration to take effect

#server dhcpd Restart

Modify the NIC configuration to set up automatic DHCP assignment

#vim/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth0

Onboot=yes

Bootproto=dhcp

#ifdown eth0

#ifup eth0

Note: After the configuration is complete, remember to close the SELinux and firewall

  1. DHCP server-side configuration
  2. DHCP Client Configuration
  3. case: DHCP relay functionality

    Host A has an IP address of 192.168.1.1, and the gateway is 192.168.1.2

    Host B's IP address is eth0:192.168.1.2,eth1:200.200.200.2

    Host C network adapter set to DHCP

    1, host a operation steps are as follows:

    #yum –y Install DHCP

    #cp???? /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf

    #vim/etc/dhcp/dhcpd.conf

    #service DHCPD Start

    #vim/etc/sysctl.conf

    #打开网络转发功能

      1. Host B steps as follows:

        #yum –y Install DHCP

        #vim/etc/sysconfig/dhcrelay

        #service Dhcrelay Start

      2. Host C operates as follows:

        #vim/etc/sysconfig/network-scripts/ifcfg-eth0

#设置为DHCP

    1. DHCP host address reserved

      Host A's IP address is 192.168.1.1

      Host B NIC is set to DHCP

      Host A and Host B are in the same network segment

      1, the operating procedure of host A is as follows:

      #yum –y Install DHCP

#cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample

#vim/etc/dhcp/dhcpd.conf

Bind MAC Address

#service dhcpd Restart

2, the operation of Host B is as follows:

#vim/etc/sysconfig/network-scripts/ifcfg-eth0

    1. DHCP Hyper-scope

      Description: A superscope is a management feature in a DHCP service that uses a superscope to combine multiple scopes into a single administrative entity.

Test Preparation: Host a network card eth0 and Host B network card eth0 in the same network segment, Host C network card eth1 and Host B network card eth1 in the same network segment , hosts A, B, and C Turn off firewalls and selinux.

    1. The operation of Host B is as follows:

      #vim/etc/sysconfig/network-scripts/ifcfg-eth0

#vim/etc/sysconfig/network-scripts/ifcfg-eth1

#yum –y Install DHCP

#cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf

#vim/etc/dhcp/dhcpd.conf

#service DHCPD Start

  1. Host A's network card settings

    #vim/etc/sysconfig/network-scripts/ Ifcfg-eth0

    #ifdown eth0

    #ifup eth0

    results such as

  2. Network card settings for Host C

    #ifdown eth0

    #ifup eth0

    Results

    Summary: using the method above, in two network segments assigned IP address, do not need to do DHCP relay, the only problem is to connect two network segments of the host to have enough network card, that is, a network card corresponding to a segment

DHCP services in a detailed

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.