[linux]ubuntu14.04搭建dhcp server

Installation

To install DHCP server on Ubuntu 14.04 server, enter the following command:

sudo apt-get install isc-dhcp-server -y

Configuration
1.
sudo vim /etc/default/isc-dhcp-server
[...]
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth1"
[...]

2.
sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf_bk
sudo vim /etc/dhcp/dhcpd.conf
[...]
# A slightly different configuration for an internal subnet.
 subnet 192.168.1.0 netmask 255.255.255.0 {
 range 192.168.1.20 192.168.1.30;//自动分配的IP地址范围
# option domain-name-servers server.unixmen.local;//
# option domain-name "unixmen.local";
# option routers 192.168.1.1;
 option broadcast-address 192.168.1.255;
 default-lease-time 600;
 max-lease-time 7200;
 }
[...]
host passacaglia {
  hardware ethernet 00:50:C2:BD:23:97;//指定MAC地址
  filename "per_image_signed.bin";//为该MAC地址的主机定义一个boot filename.
#  server-name "toccata.fugue.com";
}
[...]
host fantasia {
  hardware ethernet 40:16:9f:f0:12:f9;//指定MAC地址
  fixed-address 10.188.6.10;//为该MAC地址分配固定IP
}
[...]

Start
service isc-dhcp-server start/restart/stop/status

你可能感兴趣的:(Linux)