DA1SY

偏有宸机

愿勇猛精进,志愿无倦。


CentOS6.5 DHCP服务器搭建

1.安装dhcp软件包


yum install -y dhcp*

2.查看dhcpd.conf配置文件

vim /etc/dhcpd.conf

[root@localhost ~]# cat /etc/dhcp/dhcpd.conf

#

# DHCP Server Configuration file.

#   see /usr/share/doc/dhcp*/dhcpd.conf.sample

#   see 'man 5 dhcpd.conf'

#};

可以看到是要我们借鉴这个模板文件

3.更改dhcpd.conf文件

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

vim /etc/dhcpd.conf

文件很长 这里我们只需要留下这些 并稍作修改

subnet 192.168.150.0 netmask 255.255.255.0 {        #指定网络及子网掩码
  range 192.168.150.100 192.168.150.200;        #设置分配的ip地址范围
  option domain-name-servers 192.168.150.11;        #指定dns服务器的地址
  option domain-name "da1sy.com";       #域名,同上,可参考/etc/resolv.conf
  option routers 192.168.150.11;        #网关地址
  option broadcast-address 192.168.150.255;       #广播地址
  default-lease-time 600;       #默认租约
  max-lease-time 7200;        #最大租约
}

host fantasia {

  hardware ethernet 08:00:07:26:c0:a5;    #指定对应主机的MAC地址
  fixed-address 192.168.150.11;                #指定为该主机保留的IP地址
}

4.设置IP地址 ——–

vim /etc/sysconfig/network-scripts/ifcfg-eth0 添加IP地址

IPADDR=192.168.150.11
NETMASK=255.255.255.0

5.启动服务 ——–

service dhcpd start

多作用域 —————

ddns-update-style interim;        #动态 DNS 的更新方式
ignore client-updates;            #不允许客户机更新 DNS 记录


subnet 192.168.150.0 netmask 255.255.255.0 {        
  range 192.168.150.100 192.168.150.200;       
  option domain-name-servers 192.168.150.11;        
  option domain-name "da1sy.com";      
  option routers 192.168.150.11;        
  option broadcast-address 192.168.150.255;       
  default-lease-time 600;       
  max-lease-time 7200;       
}
subnet 192.168.200.0 netmask 255.255.255.0 {        
  range 192.168.200.100 192.168.200.200;       
  option domain-name-servers 192.168.150.11;        
  option domain-name "da1sy.com";      
  option routers 192.168.200.11;        
  option broadcast-address 192.168.150.255;       
  default-lease-time 600;       
  max-lease-time 7200;       
}


超级作用域

ddns-update-style interim;
ignore client-updates;

shared-network da1sy{         #超级作用于名称
subnet 192.168.150.0 netmask 255.255.255.0 {        
  range 192.168.150.100 192.168.150.200;       
  option domain-name-servers 192.168.150.11;        
  option domain-name "da1sy.com";      
  option routers 192.168.150.11;        
  option broadcast-address 192.168.150.255;       
  default-lease-time 600;       
  max-lease-time 7200;       
}
subnet 192.168.200.0 netmask 255.255.255.0 {        
  range 192.168.200.100 192.168.200.200;       
  option domain-name-servers 192.168.150.11;        
  option domain-name "da1sy.com";      
  option routers 192.168.200.11;        
  option broadcast-address 192.168.150.255;       
  default-lease-time 600;       
  max-lease-time 7200;       
}


返回顶部
最近的文章

CentOS6.5 TFTP搭建

1.安装TFTP服务yum install tftp-serveryum install xinetd //TFTP是通过xintd运行的,所以需要安装Xinetd2.配置tftp文件——- vim /etc/xinetd.d/tftp# default: off# description: The tftp server serves files using the trivial file transfer \# protocol. The tftp protoc...…

Centos6.5服务器搭建继续阅读
更早的文章

CentOS6.5 ISO镜像挂载,创建本地yum源

1.虚拟机挂载光盘选择相应的镜像2.@#¥%……&*——-mkdir /mnt/cdrommount /dev/cdrom/ /mnt/cdrom/3.修改源文件——- vim /etc/yum.repos.d/Centos-Media.reposMedia.repos是本地安装的文件修改为[c6-media]name=CentOS-$releasever - Mediabaseurl=file:///mnt/cdrom/ #对应第二步创建的路径gpgcheck=0...…

Linux继续阅读