日记 [2007年04月29日]多网段DHCP

需求:局域网有3个网段,用一台linux做代理上网,并且自动分配IP,设置dns和gateway
 
linux上需要安装4个网卡,eth0接外网,eth1接LAN1。eth2接LAN2 eth3 接LAN3
LAN1接网段1中包括的所有计算机,一个交换机端口不够可以串连
 
 
安装DHCP服务
编辑/etc/dhcph.conf
 
 ddns-update-style interim;
 ignore client-updates;
 shared-network mynet
{
 option subnet-mask 255.255.255.0;
 option domain-name "xinsicheng.com";
 default-lease-time 86400;
 max-lease-time 172800;
 
 subnet 192.168.0.0 netmask 255.255.255.0
 {
 range 192.168.0.2 192.168.0.254;
 option routers 192.168.0.1;
 option domain-name-servers 192.168.0.1;
 option broadcast-address 192.168.0.255;
 host pc1 {
           hardware ethernet 00:00:00:00:00:00;
           fixed-address 192.168.0.1;
           }
 }
subnet 192.168.1.0 netmask 255.255.255.0
 {
 range 192.168.1.2 192.168.1.254;
 option routers 192.168.1.1;
 option domain-name-servers 192.168.1.1;
 option broadcast-address 192.168.1.255;
 }
subnet 192.168.2.0 netmask 255.255.255.0
 {
 range 192.168.2.2 192.168.2.254;
 option routers 192.168.2.1;
 option domain-name-servers 192.168.2.1;
 option broadcast-address 192.168.0.255;
 }
}
启动DHCP服务
service dhcpd start
测试服务是否启动
ps -aux |grep dhcpd
netstat -anup |grep :67
 
查看DHCP分配的日志
cat /var/lib/dhcp/dhcpd.leases

你可能感兴趣的:(职场,休闲,多网段DHCP)