{"id":601,"date":"2011-07-14T09:00:45","date_gmt":"2011-07-14T09:00:45","guid":{"rendered":"http:\/\/blog.designed79.co.uk\/?p=601"},"modified":"2011-07-14T09:17:31","modified_gmt":"2011-07-14T09:17:31","slug":"ubuntu-11-04-sbs-small-business-server-setup-part-1-%e2%80%93-dhcp-and-dns","status":"publish","type":"post","link":"https:\/\/blog.designed79.co.uk\/?p=601","title":{"rendered":"Ubuntu 11.04 SBS (Small Business Server) Setup: Part 1 \u2013 DHCP and DNS"},"content":{"rendered":"<p>This is part of a guide to setting up Ubuntu Server Edition 11.04 for a small\/medium business. The server will provide DHCP, DNS, NTP, LDAP, Kerberos and NFS services such that users can login to any machine on the network and all their files and settings will be the same across the entire network.<\/p>\n<p><a title=\"Ubuntu 11.04 SBS (Small Business Server) Setup: Part 1 \u2013 DHCP and DNS\" href=\"https:\/\/blog.designed79.co.uk\/?p=601\">Part 1 &#8211;\u00a0DHCP and DNS<\/a><\/p>\n<p><a title=\"Ubuntu 11.04 SBS (Small Business Server) Setup: Part 2 \u2013 NTP\" href=\"https:\/\/blog.designed79.co.uk\/?p=605\">Part 2 &#8211; NTP<\/a><\/p>\n<p><a title=\"Ubuntu 11.04 SBS (Small Business Server) Setup: Part 3 \u2013 OpenLDAP\" href=\"https:\/\/blog.designed79.co.uk\/?p=607\">Part 3 &#8211; OpenLDAP<\/a><\/p>\n<p><a title=\"Ubuntu 11.04 SBS (Small Business Server) Setup: Part 4 \u2013 Kerberos\" href=\"https:\/\/blog.designed79.co.uk\/?p=609\">Part 4 &#8211; Kerberos<\/a><\/p>\n<p><a title=\"Ubuntu 11.04 SBS (Small Business Server) Setup: Part 5 \u2013 NFS\" href=\"https:\/\/blog.designed79.co.uk\/?p=611\">Part 5 &#8211; NFS<\/a><\/p>\n<p><a title=\"Ubuntu 11.04 SBS (Small Business Server) Setup: Part 6 \u2013 Account Management\" href=\"https:\/\/blog.designed79.co.uk\/?p=613\">Part 6 &#8211; Account Management<\/a><\/p>\n<p><a title=\"Ubuntu 11.04 SBS (Small Business Server) Setup: Part 7 \u2013 Setting Up Clients\" href=\"https:\/\/blog.designed79.co.uk\/?p=615\">Part 7 &#8211; Setting Up Clients<\/a><\/p>\n<p>The first thing to get your server to do is act as a DHCP and DNS server. This will allow you to map hostnames to IP addresses (and vice versa!) automatically. This means all network clients will know that neo.danbishop.org and 192.168.0.2 are one and the same. This is ESSENTIAL if you plan to use Kerberos later on.<\/p>\n<p>Make sure you have disabled DHCP on your router and set a static IP address for the server. This is done by editing \/etc\/network\/interfaces like so:<\/p>\n<div>\n<div>\n<pre># This file describes the network interfaces available on your system\r\n# and how to activate them. For more information, see interfaces(5).\r\n\r\n# The loopback network interface\r\nauto lo\r\niface lo inet loopback\r\n\r\n# The primary network interface\r\nauto eth0\r\niface eth0 inet static\r\n        address 192.168.0.2\r\n        netmask 255.255.255.0\r\n        network 192.168.0.0\r\n        broadcast 192.168.0.255\r\n        gateway 192.168.0.1<\/pre>\n<\/div>\n<\/div>\n<p>It\u2019s time to configure resolv.conf so that your server (and soon clients) can query name servers other than your own. This way, when a client looks up an address outside of danbishop.org (google.co.uk for example) dnsmasq (the software we\u2019ll be using for DHCP and DNS) will query the name servers in resolv.conf. Dnsmasq will then cache the IP for subsequent requests from any client speeding up DNS across your network\u00a0<img decoding=\"async\" src=\"http:\/\/www.danbishop.org\/wp-includes\/images\/smilies\/icon_smile.gif\" alt=\":)\" \/><\/p>\n<p>In this case we\u2019re going to use our own DNS server as the primary DNS, followed by Google\u2019s public DNS servers. You can of course substitute Google\u2019s servers for your own ISP\u2019s, or any other DNS server.<\/p>\n<p>So time to edit \/etc\/resolv.conf:<\/p>\n<div>\n<div>\n<pre>domain danbishop.org\r\nsearch danbishop.org\r\nnameserver 192.168.0.2\r\nnameserver 8.8.8.8\r\nnameserver 8.8.4.4<\/pre>\n<\/div>\n<\/div>\n<p>Now it\u2019s time to install Dnsmasq:<\/p>\n<div>\n<div>\n<pre>sudo apt-get install dnsmasq<\/pre>\n<\/div>\n<\/div>\n<p>Dnsmasq will take care of both DNS and DHCP for your network. We will configure it so that as it allocates IP addresses to clients on the network, it also adds them into its DNS server. This way both forward and reverse lookups will work on any machine, as required by Kerberos\u00a0<img decoding=\"async\" src=\"http:\/\/www.danbishop.org\/wp-includes\/images\/smilies\/icon_smile.gif\" alt=\":)\" \/><\/p>\n<p>The configuration file for Dnsmasq (\/etc\/dnsmasq.conf) is HUGE. However it is VERY well commented making it very easy to play around. The important things for this guide are:<\/p>\n<div>\n<div>\n<pre>domain=danbishop.org\t\t\t\t#sets the domain name you're going to use\r\ndhcp-range=192.168.0.50,192.168.0.150,12h\t#sets the range from which to allocate IP addresses to clients and the lease time\r\ndhcp-option=option:router,192.168.0.1\t\t#sets the IP address of the router (gateway address) to be given to clients\r\ndhcp-option=option:ntp-server,192.168.0.2 #sets the NTP server to 192.168.0.2\r\ndhcp-authoritative\t\t\t\t#makes this the authoritative (in this case ONLY) DHCP server on the network\r\n\r\n# Server DNS settings... this is required as the server itself will\r\n# not be obtaining it's IP address via DHCP and therefore would\r\n# not be automatically added to the DNS records for forward\/reverse\r\n# DNS queries as required by Kerberos\r\nptr-record=2.0.168.192.in-addr.arpa.,\"neo.danbishop.org\"\r\naddress=\/neo.danbishop.org\/192.168.0.2 \r\n\r\n# Kerberos and LDAP automatic stuff...\r\n# This maps kerberos.danbishop.org and\r\n# ldap.danbishop.org to the server and also makes all\r\n# dhcp clients aware of the kerberos realm... magic :D\r\naddress=\/kerberos.danbishop.org\/192.168.0.2\r\naddress=\/ldap.danbishop.org\/192.168.0.2 \r\n\r\ntxt-record=_kerberos.danbishop.org,\"DANBISHOP.ORG\"\r\nsrv-host=_kerberos._udp.danbishop.org,\"kerberos.danbishop.org\",88\r\nsrv-host=_kerberos._tcp.danbishop.org,\"kerberos.danbishop.org\",88\r\nsrv-host=_kerberos-master._udp.danbishop.org,kerberos.\"danbishop.org\",88\r\nsrv-host=_kerberos-adm._tcp.danbishop.org,\"kerberos.danbishop.org\",749\r\nsrv-host=_kpasswd._udp.danbishop.org,\"kerberos.danbishop.org\",464\r\n\r\nsrv-host=_ldap._tcp.danbishop.org,ldap.danbishop.org,389<\/pre>\n<\/div>\n<\/div>\n<p>It is well worth reading through the entire configuration file though as there is a lot to be learnt from the excellent comments!<\/p>\n<p>Dnsmasq is now configured to act as your network\u2019s DHCP server and clients are told to use your server for DNS queries. Now you\u2019re all set to get DNS and DHCP up and running. Simply restart the service to load the new configuration:<\/p>\n<div>\n<div>\n<pre>sudo service dnsmasq restart<\/pre>\n<\/div>\n<\/div>\n<h2>References<\/h2>\n<p><a href=\"https:\/\/help.ubuntu.com\/community\/Dnsmasq\">https:\/\/help.ubuntu.com\/community\/Dnsmasq<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is part of a guide to setting up Ubuntu Server Edition 11.04 for a small\/medium business. The server will provide DHCP, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-601","post","type-post","status-publish","format-standard","hentry","category-info-on-tech"],"_links":{"self":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/601","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=601"}],"version-history":[{"count":0,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/601\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}