Linux DHCP server settings (replicable code)

Source: Internet
Author: User

DHCP server settings


1. Set the DHCP server network address to static assignment first:

Vim/etc/sysconfig/network-*/*-eth0


Device=eth0

Onboot=yes

Bootproto=statics

hwaddr=00:0c:29:56:ea:8a

ipaddr=192.168.1.109

gateway=192.168.1.1

netmask=255.255.255.0


Service Network restart

2. Installing the configuration DHCP server

Yum Install DHCP


Vim/etc/dhcp/dhcpd.conf (later version of linux6)

Vim/etc/dhcpd.conf (version of LINUX5)



Subnet 192.168.1.0 netmask 255.255.255.0 {

Range 192.168.1.1 192.168.1.111; #从192.168.1.1 to 192.168.1.111 (set the address pool yourself)

Option Domain-name-servers 192.168.1.1,8.8.8.8,192.168.1.109; #DNS地址

Option Domain-name "walls.com"; #域名

Option routers 192.168.1.1; #路由器地址

Option Subnet-mask 255.255.255.0; #子网掩码

Option broadcast-address 192.168.1.109; #广播地址 (required within the address pool)

Default-lease-time 21600; #默认租约时间

Max-lease-time 43200; #最大租约时间

}


Host ABC {

Hardware Ethernet 00:0c:29:0a:7b:86; #指定机器MAC地址

Fixed-address 192.168.1.220; #给该机器指定IP地址 (this address is outside the address pool above)

}


When the configuration is complete,

Service DHCPD Restart



PS: If the DHCP server fails to start, check that the configuration file is formatted correctly, or view tail-50/var/log/messages |less

Lazy people can directly copy my configuration file for modification, which I have tested.

This article is from the "11736340" blog, please be sure to keep this source http://11746340.blog.51cto.com/11736340/1793083

Linux DHCP server settings (replicable code)

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