Configuring DHCP basic operations in Linux

Source: Internet
Author: User

Rpm-q DHCP #查看dhcp是否安装

Yum Install dhcp*-y #安装DHCP (mount the text)
vim/etc/dhcp/dhcpd.conf Opening a configuration file
# DHCP Server Configuration file. #DHCP服务配置文件
# see/usr/share/doc/dhcp*/dhcpd.conf.sample# Reference/usr/share/doc/dhcp*/dhcpd.conf.sample file (
# See ' Mans 5 dhcpd.conf '

Ddns-update-style Interim; #配置DHCP和DNS为互动更新模式

Ignore client-updates; #忽略客户端更新 (protect against DHCP attacks)
Subnet netmask {
Range; #地址范围
Option Domain-name-servers; #DNS为202.106.0.20
option routers; #网关
Option broadcast-address; #广播地址
Default-lease-time; #默认租期为600s (in seconds)
Max-lease-time 7200; #最大租期为7200s
Hardware Ethernet 08:00:07:26:C0:A5; #硬件MAC地址
Fixed-address; #给它定义固定IP地址

#第二种方式: In the face of the big environment, each department needs an address pool. such as:
Shared-network School {
Subnet netmask {
Option routers;
Host pc1{
Hardware Ethernet 08:00:07:26:C0:A5;
Subnet netmask {
Option Routers}

service dhcpd start #启动服务

Ps-ef | grep dhcpd #ps命令检查dhcpd进程

Cat/var/lib/dhcpd/dhcpd.leases the address released by the query

Service Iptables Stop #关闭防火墙

The following is a large environment that requires multiple DHCP, go trunk


vim/etc/sysconfig/dhcrelay# Editing a DHCP Relay server configuration file
# Command Line Options here
Dhcrelayargs= ""
interfaces= "eth0" interface
dhcpservers="" DHCP server-side address

vim/etc/sysctl.conf# turn on the server's Routing and forwarding function
Net.ipv4.ip_forward = 1

Service dhcrelay restart# start DHCP Relay service

Configuring DHCP basic operations in Linux

Related Article

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: 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.