1 dhcp服务
由服务器控制一段IP地址范围,客户机登录服务器时就可以自动获得服务器分配的IP地址和子网掩码。
/etc/dhcpd.conf 主配置文件
ddns-update-styleinterim; /*dhcp支持的dns动态更新方式*/
ignore client-updates; /*忽略客户端DNS动态更新*/
option domain-name "benet.com"; /*域名*/
option domain-name-servers 192.168.1.1,202.103.24.68; /*dns IP*/
option broadcast-address 192.168.1.255;/*广播地址*/
default-lease-time86400; /*租期1天,秒数*/
max-lease-time172800; /*最长租期2天*/
subnet 192.168.1.0 netmask 255.255.255.0 {/*作用域网段*/
range 192.168.1.11 192.168.1.100; /*ip地址段范围*/
option routers192.168.1.1; /*网关地址*/
option subnet-mask 255.255.255.0; /*子网掩码*/
/*绑定pc1主机ip地址配置*/
host pc1{
hardware ethernet 00:a0:cc:cf:9C:14; /*绑定机MAC地址*/
fixed-address192.168.1.20; /*最长租期2天*/
}
}
/var/lib/dhcpd/dhcp.leases 服务器租约文件
server dhcpd start
dhcp中继
/etc/sysconfig/dhcrelay 主配置文件
# Command line optionshere
INTERFACES="eth1 eth2"
DHCPSERVERS="192.168.1.1"
vim /etc/sysct1.conf
net.ipv4.ip_forward=1
sysct1 -p