“Dhcp3-server”的版本间的差异
来自Ubuntu中文
(→安装) |
(→配置) |
||
第5行: | 第5行: | ||
$ sudo apt-get install dhcp3-server | $ sudo apt-get install dhcp3-server | ||
− | ==配置== | + | == 配置 == |
− | DHCP服务器的配置为 ''/etc/dhcp3/dhcpd.conf'' | + | DHCP服务器的配置为 ''/etc/dhcp3/dhcpd.conf'' |
− | + | 一个示例配置文件: | |
− | + | <pre>ddns-update-style none; | |
+ | |||
+ | #deny unknown-clients; | ||
+ | |||
+ | # only listen on eth1 | ||
+ | local-address 192.168.168.30; | ||
+ | |||
+ | # option definitions common to all supported networks... | ||
+ | option domain-name "china.nsn-net.net"; | ||
+ | option domain-name-servers 10.159.195.10,10.159.208.5,10.159.192.10; | ||
+ | |||
+ | default-lease-time 6000; | ||
+ | max-lease-time 72000; | ||
+ | |||
+ | # Use this to send dhcp log messages to a different log file (you also | ||
+ | # have to hack syslog.conf to complete the redirection). | ||
+ | log-facility local7; | ||
+ | |||
+ | |||
+ | subnet 192.168.168.0 netmask 255.255.255.0 { | ||
+ | allow booting; | ||
+ | allow bootp; | ||
+ | interface br0; | ||
+ | default-lease-time 72000; | ||
+ | max-lease-time 144000; | ||
+ | option domain-name "china.nsn-net.net"; | ||
+ | option domain-name-servers 10.159.195.10,10.159.208.5,10.159.192.10; | ||
+ | option routers 192.168.168.30; | ||
+ | |||
+ | range dynamic-bootp 192.168.168.200 192.168.168.250; | ||
+ | #range 192.168.168.200 192.168.168.250; | ||
+ | |||
+ | # WINS server | ||
+ | option netbios-name-servers 10.160.244.90,10.160.244.89; | ||
+ | |||
+ | # bootp: used for network install | ||
+ | filename "linux-install/pxelinux.0"; | ||
+ | } | ||
+ | |||
+ | host 3CNL00274 { | ||
+ | hardware ethernet 0:15:58:30:28:f4; | ||
+ | fixed-address 192.168.168.66; | ||
+ | option host-name "3CNL00274.china.nsn-net.net"; | ||
+ | |||
+ | #filename "vmunix.passacaglia"; | ||
+ | #server-name "toccata.fugue.com"; | ||
+ | } | ||
+ | |||
+ | host bar { | ||
+ | hardware ethernet 0:1e:c9:6a:e3:b2; | ||
+ | fixed-address 192.168.168.210; | ||
+ | option host-name "secret.garden.com"; | ||
+ | } | ||
+ | |||
+ | host mockey { | ||
+ | hardware ethernet 0:10:18:19:92:39; | ||
+ | fixed-address 192.168.168.10; | ||
+ | option host-name "flower.garden.com"; | ||
+ | } | ||
+ | |||
+ | </pre> | ||
+ | <br> | ||
==启动和停止== | ==启动和停止== |
2009年10月21日 (三) 15:55的版本
DHCP服务器可以用于动态分配IP,还可以结合TFTP服务器用于网络安装服务器,用于安装支持PXE的客户端。
安装
$ sudo apt-get install dhcp3-server
配置
DHCP服务器的配置为 /etc/dhcp3/dhcpd.conf
一个示例配置文件:
ddns-update-style none; #deny unknown-clients; # only listen on eth1 local-address 192.168.168.30; # option definitions common to all supported networks... option domain-name "china.nsn-net.net"; option domain-name-servers 10.159.195.10,10.159.208.5,10.159.192.10; default-lease-time 6000; max-lease-time 72000; # Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). log-facility local7; subnet 192.168.168.0 netmask 255.255.255.0 { allow booting; allow bootp; interface br0; default-lease-time 72000; max-lease-time 144000; option domain-name "china.nsn-net.net"; option domain-name-servers 10.159.195.10,10.159.208.5,10.159.192.10; option routers 192.168.168.30; range dynamic-bootp 192.168.168.200 192.168.168.250; #range 192.168.168.200 192.168.168.250; # WINS server option netbios-name-servers 10.160.244.90,10.160.244.89; # bootp: used for network install filename "linux-install/pxelinux.0"; } host 3CNL00274 { hardware ethernet 0:15:58:30:28:f4; fixed-address 192.168.168.66; option host-name "3CNL00274.china.nsn-net.net"; #filename "vmunix.passacaglia"; #server-name "toccata.fugue.com"; } host bar { hardware ethernet 0:1e:c9:6a:e3:b2; fixed-address 192.168.168.210; option host-name "secret.garden.com"; } host mockey { hardware ethernet 0:10:18:19:92:39; fixed-address 192.168.168.10; option host-name "flower.garden.com"; }
启动和停止
启动
# /etc/init.d/dhcp3-server start
停止
# /etc/init.d/dhcp3-server stop