标签:服务 name ons 自动分配 start host pre dns domain
1. yum install dhcp
2.网络接口的配置
vi /etc/sysconfig/dhcpd
#指定网络接口名称,在eth0 网络接口上启用dhcp 服务。
DHCPDARGS=eth0
3、创建DHCP服务器租约文件
# touch /var/db/dhcpd.leases
注意:如果没有创建此文件,启动服务时候会提示以下错误信息:
WARNING: host declarations are global. They are not limited to the scope you declared them in.
Can‘t open lease database /var/db/dhcpd.leases: No such file or directory --
4、手动创建DHCP主配文件dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see ‘man 5 dhcpd.conf‘
#
#地址池配置
subnet 192.168.0.0 netmask 255.255.0.0 { #这个是设置ip网段和子网掩码
range 192.168.0.10 192.168.0.50; #自动分配的ip地址段
option domain-name-servers 219.149.194.56,219.149.194.55; #dns服务器地址 多个逗号隔开
option domain-name "nat.home.m.m"; #dns服务器名字
option routers 192.168.0.254; #网关
option broadcast-address 192.168.0.255; #广播地址
default-lease-time 3600;
max-lease-time 72000;
ddns-update-style none;
log-facility local7;
}
#指定主机给其分配ip
#host boss { #boss为主机名,随便取;
# hardware ethernet 00:0C:29:6C:A6:F8; #主机网卡的mac地址;
# fixed-address 192.168.1.10; # 给其分配的ip;
#}
dhcpd.conf配置文件的详细说明:
全局设置
使用subnet声明设置子网属性
使用host声明设置主机属性,通常用于为服务器分配好固定使用的IP地址
5、启动DHCP服务器
service dhcpd start
DHCP客户端(Linux客户端)的配置
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
# ifdown eth0 ; ifup eth0
/etc/init.d/network restart
DHCP路径/etc/dhcp/dhcpd.conf
1
1
标签:服务 name ons 自动分配 start host pre dns domain
原文地址:http://www.cnblogs.com/linux234/p/6663822.html