Linux DHCP (1) Basic concepts

Source: Internet
Author: User

The basic concept of DHCP is DHCP, the Dynamic Host Setup Communication Protocol (PROTOCOL), which is defined by the Internet standard in RFC2131 and 2132 to dynamically set the client IP status.

Port number for DHCP

UDP Server service side

UDP Client Clients

DHCP-related configuration files

/etc/dhcpd.conf #主配置文件

/usr/share/doc/#文档资料

/var/lib/dhcp/dhcpd.leases #记录文件

/usr/share/doc/dhcp.../dhcpd.conf.sample/etc/dhcpd.conf #这个是DHCP的模板配置文件


How to get help man dhcpd.conf

How DHCP Works

1 requesting a new IP address from the DHCP server

1DHCPDISCOVERDHCP Discovery

2DHCPOFFERDHCP offers

3DHCPREQUESTDHCP Request

4DHCPACKDHCP Confirmation

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/2E/DF/wKiom1OdAVPTW7KTAACVDP1DfZg526.jpg "title=" Picture 1.jpg "alt=" Wkiom1odavptw7ktaacvdp1dfzg526.jpg "/>

2 Updating IP address leases

① when the IP address of the DHCP client reaches half the lease time, it sends a new message to the DHCP server

DHCPREQUEST. If the server does not have the reason to refuse the request after receiving the information, it will send a dhcpack

Information. When the DHCP client receives the reply, it restarts a lease cycle.

② additional processing is required when any of the following two special cases occur during the renewal of IP addresses.

When the DHCP client restarts

The lease of the IP address is more than half, but the renewal fails.

The contents of the DHCP configuration file are as follows

Note in the Linux 5.x version of the series. The path to DHCP is the same, but the path is a little different in the linux6.x version. The path to the Linux 6.x version is /etc/dhcp/dhcpd.conf

[Email protected] ~]# vim/etc/dhcpd.conf

Ddns-update-style Interim;

Ignore client-updates;

Subnet 192.168.0.0 netmask 255.255.255.0 { #子网声明

Option routers 192.168.0.1; #网关192.168.0.1

Option Subnet-mask 255.255.255.0; #子网掩码

Option Domain-name "domain.org"; Search items in the #自动搜索域在客户端是/etc/resolv.conf

Option Domain-name-servers 192.168.1.1; #DNS服务器IP

Option time-offset-18000; # Eastern Standard Time#时区东8区

# option Ntp-servers 192.168.1.1; #时间服务器

Range DYNAMIC-BOOTP 192.168.0.128 192.168.0.254; #地址池

Default-lease-time 21600; #默认租期秒

Max-lease-time 43200; #最大租期秒

Host FTP { #IP地址绑定

Hardware Ethernet 12:34:56:78:AB:CD; #客户端的MAC地址

Fixed-address 192.168.0.110; #绑定的IP地址

}

}

How DHCP is started and how to add boot entries

[[email protected] ~]# service dhcpd start

[Email protected] ~]# chkconfig dhcpd on


This article from "Dragon" blog, reproduced please 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.