标签:linux dhcp
DHCP:Dynamic HOST configuration Protol
DHCP工作模式:
申请IP地址:
client --> DHCPDISCOVER
DHCPOFFER <--server
client --> DHCPREQUEST
DHCPACK <--server
以上四个步骤是广播方式进行
续租IP地址:
client --> DHCPREQUEST
DHCPACK <--server
以上二个步骤为单播方式
DHCP relay: DHCP 中断功能
DHCP 端口:
服务端:udp/67
客户端:udp/68
配置文件:
/etc/dhcpd.conf
租约记录文件:
/var/lib/dhcpd/dhcpd.leases
dhcpd.conf
option domain-name "example.org"; option domain-name-servers ns1.example.org, ns2.example.org; default-lease-time 600; max-lease-time 7200; log-facility local7; subnet 10.152.187.0 netmask 255.255.255.0 { } subnet 10.254.239.0 netmask 255.255.255.224 { range 10.254.239.10 10.254.239.20; option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org; } subnet 10.254.239.32 netmask 255.255.255.224 { range dynamic-bootp 10.254.239.40 10.254.239.60; option broadcast-address 10.254.239.31; option routers rtr-239-32-1.example.org; } subnet 10.5.5.0 netmask 255.255.255.224 { range 10.5.5.26 10.5.5.30; option domain-name-servers ns1.internal.example.org; option domain-name "internal.example.org"; option routers 10.5.5.1; option broadcast-address 10.5.5.31; default-lease-time 600; max-lease-time 7200; } host passacaglia { hardware ethernet 0:0:c0:5d:bd:95; filename "vmunix.passacaglia"; server-name "toccata.fugue.com"; } host fantasia { hardware ethernet 08:00:07:26:c0:a5; fixed-address fantasia.fugue.com; } class "foo" { match if substring (option vendor-class-identifier, 0, 4) = "SUNW"; } shared-network 224-29 { subnet 10.17.224.0 netmask 255.255.255.0 { option routers rtr-224.example.org; } subnet 10.0.29.0 netmask 255.255.255.0 { option routers rtr-29.example.org; } pool { allow members of "foo"; range 10.17.224.10 10.17.224.250; } pool { deny members of "foo"; range 10.0.29.10 10.0.29.230; } }
dhclient 命令
-d 重新获得IP地址
DHCP (Dynamic Host Configuration Protocol)
标签:linux dhcp
原文地址:http://leozhenping.blog.51cto.com/10043183/1660946