2016年3月18日 星期五

Raspberry Pi - 啟用DHCP伺服器 isc-dhcp-server

1. 安裝 isc-dhcp-server
$ sudo apt-get install isc-dhcp-server
[FAIL] Starting ISC DHCP server: dhcpd[....] check syslog for diagnostics. ... failed!
 failed!
invoke-rc.d: initscript isc-dhcp-server, action "start" failed.
2. 修改/etc/network/interfaces,設定網路組態
$ vi /etc/network/interfaces
#iface eth0 inet dhcp
allow-hotplug eth0
iface eth0 inet static
  address 192.168.0.1
  netmask 255.255.255.0
  gateway 192.168.0.1
3. 修改DHCP configuration file,加入DHCP Server的相關設定
$ vi /etc/dhcp/dhcpd.conf
subnet 192.168.0.0 netmask 255.255.255.0 {
  range 192.168.0.200 192.168.0.253;
  option routers 192.168.0.1;
  option broadcast-address 192.168.0.255;
  default-lease-time 600;
  max-lease-time 7200;
  option domain-name-servers 168.95.1.1;
}
4. 指定isc-dhcp-server所工作的網路介面
$ vi /etc/default/isc-dhcp-server
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#       Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth0"
5. 啟動isc-dhcp-server
$ sudo service isc-dhcp-server restart
[ ok ] Stopping ISC DHCP server: dhcpd.
[ ok ] Starting ISC DHCP server: dhcpd.

沒有留言:

張貼留言