简单的DHCP配置
1、安装dhcp
rpm -ivh dhcp-3.0.5-7.el5
2、vim /etc/dhacd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 { (DHCP范围)
# --- default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name "mail.hat.com";
option domain-name-servers 192.168.0.8;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.0.128 192.168.0.254; (IP地址分配范围)
default-lease-time 21600;
max-lease-time 43200;
host ns { (固定DHCP分配)
hardware ethernet 00:22:15:53:56:07; (客户机MAC地址)
fixed-address 192.168.0.50; (固定的IP)
option domain-name-servers 192.168.0.9; (DNS地址)
}
}
3、客户机配置
把客户机的DHCP打开就好
*********************************************************************
多作用域配置
1、需要两块网卡,第二块网卡的IP地址是192.168.1段的,还需要打开网卡的转发功能/etc/sysct1.conf 把IPV4那里把0改成1。
2、编辑/etc/dhcpd.conf
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name "mail.hat.com";
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.0.128 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;
}
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option domain-name "mail.hat.com";
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.0.128 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;
}
3、配置完客户机就OK了
*********************************************************************
中继配置
1、编辑/etc/dhcpd.conf文件
ddns-update-style interim;
ignore client-updates;
shared-network test {
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name "mail.hat.com";
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.0.128 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;
}
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option domain-name "mail.hat.com";
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.0.128 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;
}
其它的没动,只是加了一条语句。要把网卡的转发功能关闭。这里还可以添加多个网段,格式一样。
2、需要一台服务器做中继服务器,这台服务器需要两张网卡,而且还要打开网卡转发功能。然后配置/etc/sysconfig/dhcrelay
INTERFACES="eth0 eth1" (如果不写就是搜索所有)
DHCPSERVERS="192.168.0.X" (中继的地址)
3、现在客户端之间就可以通信了。
阅读(547) | 评论(0) | 转发(0) |