{"id":123,"date":"2011-02-09T15:33:17","date_gmt":"2011-02-09T15:33:17","guid":{"rendered":"http:\/\/gigihfordanama.wordpress.com\/?p=123"},"modified":"2012-08-08T00:14:47","modified_gmt":"2012-08-08T00:14:47","slug":"installing-dhcp-server-on-freebsd","status":"publish","type":"post","link":"https:\/\/dosen.unila.ac.id\/gigih\/2011\/02\/09\/installing-dhcp-server-on-freebsd\/","title":{"rendered":"Installing DHCP server on FreeBSD"},"content":{"rendered":"<p>I would like to automatically assign IP address to computers attached to my network rather than setting them manually everytime they are attached to my network. This time, I\u2019m going to write how I install and configure the <a href=\"http:\/\/www.isc.org\/products\/DHCP\">ISC DHCP<\/a> on my FreeBSD Router.<\/p>\n<h3>What is DHCP<\/h3>\n<p>Dynamic Host Configuration Protocol (DHCP) is a protocol for automate the assignment of IP addresses in a network. Each computer connected to a network must have a unique IP, and without DHCP TCP\/IP information must be assigned manually on each computer.<!--more--><\/p>\n<h3>Installing ISC DHCP<\/h3>\n<p>The ISC DHCP server is a free implementation for the DHCP protocol. The software is available at <a href=\"http:\/\/www.isc.org\/products\/DHCP\">DHCP Site<\/a><\/p>\n<p>Before you install DHCP, you need to make sure the bpf device is compiled into your kernel. If you are using the default kernel (GENERIC) then it is built into your kernel by default.<\/p>\n<p>To install ISC DHCP Server using ports on FreeBSD type (as root):<\/p>\n<pre><strong># cd \/usr\/ports\/net\/isc-dhcp3-server<\/strong>\n<strong><strong># make install clean<\/strong><\/strong>\n<\/pre>\n<p>Once you have finished installing, we can move on to configuring the server. A sample configuration file is located in \/usr\/local\/etc\/dhcpd.conf.sample and you can copy it or rename it to dhcpd.conf.<\/p>\n<h3>Configuration<\/h3>\n<p>You can use your favorite text editor to edit the dhcpd configuration file. This is an example of my dhcpd.conf, you can read more about dhcpd.conf to read more options so you could set yours according to your need.<\/p>\n<pre>option domain-name \"<strong>unila.ac.id<\/strong>\";\n# the domain-name option specifies the domain provided \nto clients as the default search domain.\n\n<em>option domain-name-servers<\/em> <strong>dns.unila.ac.id<\/strong>, <strong>ns1.unila.ac.id<\/strong>;\n\n# the domain-name-servers provide clients with the DNS server.\nReplace this with your DNS server.\n\n<em>default-lease-time 86400;\nmax-lease-time 86400;<\/em>\n\n# The default lease expiry time in seconds\n# This is the maximum length of time that the server will lease for.\n\n<em>authoritative;<\/em>\n\n# If this DHCP server is the official DHCP server for the local\n# network, the authoritative directive should be uncommented.\n\n<em>ddns-update-style none;<\/em>\n\n# Use this to send dhcp log messages to a different log file (you also\n# have to hack syslog.conf to complete the redirection).\n<em>log-facility local7;\n\nsubnet 192.168.0.0 netmask 255.255.255.0 {\n        range 192.168.0.5 192.168.0.25;\n        option routers 192.168.0.1;\n}<\/em>\n<\/pre>\n<p>Now, I have some computers that I\u2019d like to assign IP address manually. This is what I added to my configuration:<\/p>\n<pre><em>host pingpong {\n        hardware ethernet 00:00:00:00:00:00; [1]\n        fixed-address pingpong; [2]\n        default-lease-time 604800;\n        max-lease-time 604800;\n}<\/em>\n\n<strong># [1] You should change this to the hardware MAC address of the client\n# [2] You should provide this with a valid hostname, and dhcp server <\/strong>\nwill resolve the hostname before returning the lease to the client. \nI edited \/etc\/hosts and specify pingpong with \nmy IP address.\n<\/pre>\n<h3>Running dhcpd at startup<\/h3>\n<p>To configure FreeBSD to run dhcpd at start-up you need to edit \/etc\/rc.conf and add the following:<\/p>\n<pre><em>dhcpd_enable=\"YES\"\ndhcpd_flags=\"-q\"\ndhcpd_conf=\"\/usr\/local\/etc\/dhcpd.conf\"\ndhcpd_withumask=\"022\"\ndhcpd_chuser_enable=\"YES\"\ndhcpd_withuser=\"dhcpd\"\ndhcpd_withgroup=\"dhcpd\"<\/em>\n<\/pre>\n<p>and since I only need dhcpd on my local area network, I also added the following to my rc.conf dhcpd_ifaces=\u201drl1\u201d.<\/p>\n<p>You can now start dhcpd by typing:<\/p>\n<pre><strong># \/usr\/local\/etc\/rc.d\/isc-dhcpd.sh start<\/strong>\n<\/pre>\n<h3>Client configuration<\/h3>\n<p>Now, it\u2019s time for us to configure the client computers to use DHCP.<\/p>\n<p>To configure <em>Microsoft Windows 2000\/XP<\/em> operating system to automatically get ip address from the DHCP server:<\/p>\n<ol>\n<li><em>Right click on \u2018My Network Places\u2019 and select Properties<\/em><\/li>\n<li><em>Right click on \u2018Local Area Connection\u2019 and select Properties<\/em><\/li>\n<li><em>Select \u2018Internet Protocol (TCP\/IP)\u2019 and click Properties<\/em><\/li>\n<li><em>Select \u2018Obtain an IP address automatically\u201d (and repeat for DNS) and click OK<\/em><\/li>\n<\/ol>\n<p>To configure <em>Mac OS X<\/em> operating system to use DHCP:<\/p>\n<ol>\n<li><em>Click on the blue apple logo on the top left corner and go to System Preferences<\/em><\/li>\n<li><em>Choose Network<\/em><\/li>\n<li><em>Choose the network port you are using (Airport, Built-in Ethernet)<\/em><\/li>\n<li><em>Go to the TCP\/IP tab<\/em><\/li>\n<li><em>Configure IPv4: Using DHCP<\/em><\/li>\n<\/ol>\n<p><em>FreeBSD<\/em> has a built-in dhcp client and to receive a dynamic IP address from my FreeBSD router this is what I type:<\/p>\n<pre><strong># dhclient rl0<\/strong>\n<\/pre>\n<p>Replace rl0 with your own interface (Type ifconfig -a) to see.<\/p>\n<p>You can also configure your system to automatically use dhcp at startup by editing \/etc\/rc.conf. Add the following to your \/etc\/rc.conf:<\/p>\n<p><strong>ifconfig_rl0=\u201dDHCP\u201d<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I would like to automatically assign IP address to computers attached to my network rather than setting them manually everytime they are attached to my network. This time, I\u2019m going to write how I install and configure the ISC DHCP on my FreeBSD Router. What is DHCP Dynamic Host Configuration Protocol (DHCP) is a protocol &hellip; <a href=\"https:\/\/dosen.unila.ac.id\/gigih\/2011\/02\/09\/installing-dhcp-server-on-freebsd\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Installing DHCP server on FreeBSD&#8221;<\/span><\/a><\/p>\n","protected":false},"author":25,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1348,5],"tags":[],"class_list":["post-123","post","type-post","status-publish","format-standard","hentry","category-kiat-sukses-menjadi-seorang-network-engineer-2","category-old-post-dari-unilanet"],"_links":{"self":[{"href":"https:\/\/dosen.unila.ac.id\/gigih\/wp-json\/wp\/v2\/posts\/123"}],"collection":[{"href":"https:\/\/dosen.unila.ac.id\/gigih\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dosen.unila.ac.id\/gigih\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dosen.unila.ac.id\/gigih\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/dosen.unila.ac.id\/gigih\/wp-json\/wp\/v2\/comments?post=123"}],"version-history":[{"count":0,"href":"https:\/\/dosen.unila.ac.id\/gigih\/wp-json\/wp\/v2\/posts\/123\/revisions"}],"wp:attachment":[{"href":"https:\/\/dosen.unila.ac.id\/gigih\/wp-json\/wp\/v2\/media?parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dosen.unila.ac.id\/gigih\/wp-json\/wp\/v2\/categories?post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dosen.unila.ac.id\/gigih\/wp-json\/wp\/v2\/tags?post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}