/etc/resolv.conf 文件


主配置文件:/etc/dhcp/dhcpd.conf

执行程序:/usr/sbin/dhcpd、/usr/sbin/dhcrelay

服务脚本:/etc/init.d/dhcpd、/etc/init.d/dhcrelay

执行参数配置:/etc/sysconfig/dhcpd

DHCP中继配置:/etc/sysconfig/dhcrelay


DHCP

/etc/dhcp/dhcpd.conf

全局设置,作用于整个DHCP服务器

ddns -update-style  none;

default-lease-time 21600;

max-lease-time  43200;

option domain-name "domain.org";

option domain-name-servers 202.106.0.20;


Subnet网络声明,作用于整个子网段

  range参数:设置用于分配的ip地址

  option subnet-mask 参数:  设置客户机的子网掩码

  option routers 参数:设置客户机的默认网关地址

subnet 192.168.4.0 netmask 255.255.255.0{

    range 192.168.4.128  192.168.4.254;

    option subnet-mask     255.255.255.0;

    option routers  192.168.4.1

}


host主机声明,作用于单个主机

    hardware ethernet 参数:指定对应主机的MAC地址

    fixed-address 参数:指定为该主机

host prtsvr{

  hardware ethernet 00:v0:77:44;

  fixed-address 192.168.4.100

}


启动DHCP服务

netstat -anpu | grep :67



查看租约文件  

 /var/lib/dhcpd/dhcpd.leases 



使用方式

1、修改网卡配置文件

2、使用dhclient命令

    dhclient -d eth0 


ddns-update-style none;

default-lease-time 21600;

max-lease-time 43200;

option domain-name "domain.org";

option domain-name-servers 202.106.0.20;


subnet 192.168.111.0 netmask 255.255.255.0 {

range 192.168.111.10 192.168.111.253;

option subnet-mask 255.255.255.0;

option routers 192.168.111.1;

# host prtsvr {

# hardware ethernet 00:0C:29:E7:64:E8;

#: fixed-address 192.168.111.100;

# }

}


--------------baby神