Setting up Raspberry Pi as a DHCP, NTP, and DNS server
Address List
The home network now has a central time server and a name server. However, I have to make sure the computers on the network match the IP addresses assigned to them in the zone file. I first need to configure the DHCP server. Only one DHCP server can be active in any subnet, so I need to shut down the DHCP service on the DSL router. To do this, I must consult the user manual for my DSL router.
First, I need to install the DHCP service on the Rasp Pi using apt-get. The fact that automatic startup doesn't initially work is okay. I only need to change the /etc/dhcp/dhpd.conf
file (Listing 9). After starting the DHCP service with sudo /etc/init.d/isc-dhcp-server
, the DHCP server should work. Now, when I start up a network device, I can see from the /var/log/syslog
file how an IP address is assigned to the device (Listing 10).
Listing 9
Map Hardware Addr to IP Addr
001 option domain-name "homenet.de"; 002 option domain-name-servers pi.homenet.de; 003 option routers fhserver.homenet.de; 004 option ntp-servers pi.homenet.de; 005 option lpr-servers printserver.homenet.de; 006 ddns-update-style none; 007 max-lease-time 345600; 008 default-lease-time 172800; 009 subnet 192.168.100.0 netmask 255.255.255.0 { 010 authoritative ; 011 get-lease-hostnames on; 012 use-host-decl-names on; 013 range dynamic-bootp 192.168.100.100 192.168.100.254; 014 default-lease-time 14400; 015 max-lease-time 172800; 016 } 017 host vectra { 018 fixed-address vectra.homenet.de; 019 hardware ethernet 00:04:76:97:5B:1C; 020 } 021 host fhserver { 022 fixed-address fhserver.homenet.de; 023 hardware ethernet BC:5F:F4:66:ED:DE; 024 } 025 host fritz-pc { 026 fixed-address fritz-pc.homenet.de; 027 hardware ethernet 90:E6:BA:3D:1D:95; 028 } 029 host fpc-wlan { 030 fixed-address fpc-wlan.homenet.de; 031 hardware ethernet 70:1A:04:2D:54:9F; 032 } 033 host andrey-laptop { 034 fixed-address andrey-laptop.homenet.de; 035 hardware ethernet 00:17:42:21:60:7D; 036 } 037 # Andrey's Laptop wire-addy come here 038 # 039 040 host lena-laptop { 041 fixed-address lena-laptop.homenet.de; 042 hardware ethernet 00:C0:A8:D6:F4:1C; 043 } 044 host lena-laptop-lan { 045 fixed-address lena-laptop-lan.homenet.de; 046 hardware ethernet 00:17:42:21:60:82; 047 } 048 host frlap-wlan { 049 fixed-address frlap-wlan.homenet.de; 050 hardware ethernet B4:74:9F:EC:93:F3; 051 } 052 host frlap-lan { 053 fixed-address frlap-lan.homenet.de; 054 hardware ethernet 5C:9A:D8:E1:1B:37; 055 } 056 host andrey-pc { 057 fixed-address andrey-pc.homenet.de; 058 hardware ethernet 00:30:05:9A:87:70; 059 } 060 host fritz-ipad { 061 fixed-address fritz-ipad.homenet.de; 062 hardware ethernet 04:54:53:27:BF:C1; 063 } 064 host andrey-gpad { 065 fixed-address andrey-gpad.homenet.de; 066 hardware ethernet B0:D0:9C:3B:81:73; 067 } 068 host fritz-phone { 069 fixed-address fritz-phone.homenet.de; 070 hardware ethernet 20:64:32:2A:CC:6B; 071 } 072 host sony-tv { 073 fixed-address sony-tv.homenet.de; 074 hardware ethernet F0:BF:97:87:62:38; 075 } 076 host screenplay { 077 fixed-address screenplay.homenet.de; 078 hardware ethernet 00:10:D7:81:5A:01; 079 } 080 host pioneer-av { 081 fixed-address pioneer-av.homenet.de; 082 hardware ethernet 00:E0:36:EF:E0:B6; 083 } 084 host printserver { 085 fixed-address printserver.homenet.de; 086 hardware ethernet 00:40:01:27:5A:81; 087 } 088 host wlan-router { 089 fixed-address wlan-router.homenet.de; 090 hardware ethernet 00:14:6C:5A:90:6A; 091 } 092 host pioneer-bd { 093 fixed-address pioneer-bd.homenet.de; 094 hardware ethernet 74:5E:1C:02:6A:06; 095 } 096 host fritz-vmlinux { 097 fixed-address fritz-vmlinux.homenet.de; 098 hardware ethernet 00:0C:29:01:1F:FB; 099 } 100 host fritz-vm98 { 101 fixed-address fritz-vm98.homenet.de; 102 hardware ethernet 00:0C:29:C5:96:10; 103 } 104 host fritz-vmdos { 105 fixed-address fritz-vmdos.homenet.de; 106 hardware ethernet 00:0C:29:41:85:BF; 107 } 108 host noxon { 109 fixed-address noxon.homenet.de; 110 hardware ethernet 00:16:e3:5e:78:06; 111 } 112 host pi { 113 fixed-address pi.homenet.de; 114 hardware ethernet B8:27:EB:80:7D:B8; 115 }
Listing 10
/var/log/syslog
01 Aug 9 15:41:40 raspberrypi dhcpd: DHCPREQUEST for 192.168.100.57 from 5c:9a:d8:e1:1b:37 via eth0 02 Aug 9 15:41:40 raspberrypi dhcpd: DHCPACK on 192.168.100.57 to 5c:9a:d8:e1:1b:37 via eth0 03 Aug 9 3:42:33 PM raspberrypi dhcpd: DHCPINFORM from 192.168.100.50 via eth0 04 Aug 9 3:42:33 PM raspberrypi dhcpd: DHCPACK to 192.168.100.50 (90:e6:ba:3d:1d:95) via eth0 05 Aug 9 15:43:29 raspberrypi named[3769]: client 127.0.0.1#36205: RFC 1918 response from Internet for 57.100.168.192.in-addr.arpa 06 Aug 9 3:43:58 PM raspberrypi dhcpd: DHCPINFORM from 192.168.100.57 via eth0 07 Aug 9 3:43:58 PM raspberrypi dhcpd: DHCPACK to 192.168.100.57 (5c:9a:d8:e1:1b:37) via eth0
Other Options
You can also configure your Rasp Pi as a file, print, or download server. You'll spend a lot less money (and power) than with a big server system, and if anything goes wrong, you can just start over. That's the beauty of Raspberry Pi.
Infos
- Raspberry Pi: http://www.raspberrypi.org/
- NTP Pool Project: http://www.pool.ntp.org/
- Liu, Cricket. DNS & Bind Cookbook. O'Reilly Media, 2006.
- Liu, Cricket and Paul Albitz. DNS & BIND. O'Reilly Media, 2002.
« Previous 1 2 3 Next »
Buy this article as PDF
Pages: 6
(incl. VAT)