Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10723594
  • 博文数量: 2905
  • 博客积分: 20098
  • 博客等级: 上将
  • 技术积分: 36298
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-23 05:00
文章存档

2012年(1)

2011年(3)

2009年(2901)

分类: LINUX

2009-03-23 11:37:38


这个是在Redhat5上进行的DHCP服务器配置(我的主机IP是192.168.0.124)
以下可能用到的命令:
/etc/init.d/dhcpd restart  重新启动DHCP
/etc/dhcpd.conf            DHCP配置文件
/etc/sysconfig/network-scripts/ifcfg-eth0  配置网卡信息
more /var/lib/dhcpd/dhcpd.leases  可查看地址分配情况
ifdown eth0; ifup eth0     关闭和启动网卡
chkconfig --level 345 dhcpd on             使开机自动运行DHCP
 
1、配置网卡信息
2、复制dhcpd.conf.sample到/etc/dhcpd.conf
cp   /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample 
     /etc/dhcpd.conf

3、为单个子网配置DHCP,配置dhcpd.conf
vi /etc/dhcpd.conf      
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample 
#
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0{
       range 192.168.0.11 192.168.0.100;
       option routers 192.168.0.1;
       option subnet-mask 255.255.255.0;
       option domain-name "gdvcp.net";
       option domain-name-servers 192.168.0.124;
       option broadcast-address 192.168.0.255;
       default-lease-time 86400;
       max-lease-time 172800;
       host pc1{
         hardware ethernet 00:0C:29:E8:EC:44;
         fixed-address 192.168.0.12;
               }
}
重新启动DHCP,在另外一台机上检测
OK!
 
如果为多个子网配置DHCP
shared-network multi-net{
       option subnet-mask 255.255.255.0;
       option domain-name "gdvcp.net";
       option domain-name-servers 192.168.0.124;
       default-lease-time 86400;
       max-lease-time 172800;
 subnet 192.168.0.0 netmask 255.255.255.0{
       range 192.168.0.11 192.168.0.100;
       option routers 192.168.0.1;
       option broadcast-address 192.168.0.255;
       host pc1{
         hardware ethernet 00:0C:29:E8:EC:44;
         fixed-address 192.168.0.12;
               }
    }
   --------在这里可以再增加另外要分配的子网和参数
 
}
 

 
阅读(2384) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~