双网卡实现dhcp多作用域
网络中如果计算机设备增加,IP地址需要进行扩容,小型网络可以进行重新分配IP,
但是如果是大网络,重新分配整个网络的IP很不明智,大量的机器重新获取IP设置导致网络中断
可以通过设置多作用域,即DHCP服务器发布多个作用域,实现IP地址扩容
下边是实例
公司IP地址是192.168.1.0/24网段,可以容纳254台机器,使用DHCP服务器建立一个192.168.1.0网段的作用域,动态管理IP地址;但网络规模扩大到500台机器,一个C类网络就无法满足要求,这时可以再为DHCP服务器添加一个新的作用域,管理分配192.168.0.0网段的IP,为网络增加254个新地址,这样就需要DHCP服务器有双网卡
每个网卡连接一个子网,发布对应的作用域
1,配置双网卡IP
[root@mylab ~]# ifconfig eth0 192.168.0.1 netmask 255.255.255.0
[root@mylab ~]# ifconfig eth0 192.168.1.1 netmask 255.255.255.0
2,编辑配置文件/etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.1 netmask 255.255.255.0; {
option routers 192.168.0.1;
default-lease-time 43200;
max-lease-time 86400;
range dynamic-bootp 192.168.0.10 192.168.0.250;
}
subnet 192.168.1.1 netmask 255.255.255.0; {
option routers 192.168.1.1;
default-lease-time 43200;
max-lease-time 86400;
range dynamic-bootp 192.168.1.10 192.168.1.250;
}
3,加载配置文件
[root@mylab ~]# service dhcpd reload
[root@mylab ~]# service dhcpd status
dhcpd (pid 2688) is running...
查看日志/var/log/message,正常工作
[root@mylab ~]# tail -n10 /var/log/messages
May 13 06:53:38 mylab dhcpd: Internet Systems Consortium DHCP Server V3.0.5-RedHat
May 13 06:53:38 mylab dhcpd: Copyright 2004-2006 Internet Systems Consortium.
May 13 06:53:38 mylab dhcpd: All rights reserved.
May 13 06:53:38 mylab dhcpd: For info, please visit
May 13 06:53:38 mylab dhcpd: Wrote 1 leases to leases file.
May 13 06:53:38 mylab dhcpd: Listening on LPF/eth1/00:0c:29:96:09:de/192.168.1/24
May 13 06:53:38 mylab dhcpd: Sending on
May 13 06:53:38 mylab dhcpd: Listening on LPF/eth0/00:0c:29:96:09:d4/192.168.0/24
May 13 06:53:38 mylab dhcpd: Sending on
May 13 06:53:38 mylab dhcpd: Sending on