1.\" $OpenBSD: dhcp.8,v 1.24 2008/06/08 03:03:37 jdixon Exp $ 2.\" 3.\" 4.\" Copyright (c) 1999 Aaron Campbell 5.\" All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27.\" 28.Dd October 15, 2008 29.Dt DHCP 8 30.Os 31.Sh NAME 32.Nm dhcp 33.Nd configuring DragonFly for DHCP 34.Sh DESCRIPTION 35The Dynamic Host Configuration Protocol (DHCP) allows hosts on a TCP/IP network 36to configure one or more network interfaces based on information collected from 37a DHCP server in response to a DHCP request. 38This mechanism is often used, for example, by cable modem and DSL network 39providers to simplify network configurations for their clients/customers. 40.Pp 41Information typically contained within a DHCP response includes an IP 42address for the interface, subnet mask, broadcast address, router (gateway) 43listing, domain name server listing, and the interface's MTU. 44.Pp 45To set up 46.Dx 47as a DHCP client: 48.Bl -enum -offset indent 49.It 50For each interface that is to be configured via DHCP, add 51.Dq Li DHCP 52to the 53.Va ifconfig_ Ns Aq Ar interface 54variable in 55.Pa /etc/rc.conf . 56See 57.Xr rc.conf 5 58for more information on the format of this file. 59.Pp 60The 61.Pa /etc/network.subr 62script reads each of these variables at boot-time and runs the 63.Xr dhclient 8 64program for each interface that is to be configured via DHCP. 65.It 66[Optional] To tweak settings, edit 67.Pa /etc/dhclient.conf . 68This file is shipped with the system. 69See 70.Xr dhclient.conf 5 71and 72.Xr dhclient 8 73for details. 74.El 75.Pp 76To set up 77.Dx 78as a DHCP server: 79.Bl -enum -offset indent 80.It 81Install 82.Xr dhcpd 8 83(available in 84.Xr dports 7 ) . 85.It 86Edit 87.Pa /usr/local/etc/dhcp/dhcpd.conf . 88See 89.Xr dhcpd.conf 5 90and 91.Xr dhcpd 8 92for details. 93.It 94Edit 95.Pa /etc/rc.conf 96and set 97.Cm dhcpd_flags="" . 98This will cause 99.Dx 100to start the 101.Xr dhcpd 8 102daemon at boot-time and listen for DHCP requests on the local network. 103To start it manually, execute the following command: 104.Pp 105.Dl # /usr/local/sbin/dhcpd [netif1 netif2 ...] 106.El 107.Pp 108The DHCP client and server use the Berkeley Packet Filter (BPF). 109Ensure the kernel has been compiled with BPF support 110and at least one 111.Pa /dev/bpf* 112file exists per broadcast network interface that is attached to the system. 113This is almost always the case and should only be considered if all other 114troubleshooting options have failed. 115.Pp 116See 117.Xr dhcpd 8 118for information on other available options. 119Note, however, that most of the flags are useful only for debugging purposes. 120.Sh FILES 121.Bl -tag -width /usr/local/etc/dhcpd.conf 122.It Pa /usr/local/etc/dhcp/dhcpd.conf 123DHCP server configuration file 124.It Pa /etc/rc.conf 125configuration file where 126DHCP client configuration is set for individual interfaces and 127.Cm dhcpd_flags 128must be set 129.It Pa /etc/dhclient.conf 130DHCP client configuration file 131.El 132.Sh SEE ALSO 133.Xr dhclient.conf 5 , 134.Xr dhcpd.conf 5 Pq Pa net/isc-dhcp42-server , 135.Xr dhclient 8 , 136.Xr dhcpd 8 Pq Pa net/isc-dhcp42-server , 137.Xr dhcrelay 8 Pq Pa net/isc-dhcp42-relay 138