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 25, 2018 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 DHCP client, 63e.g., 64.Xr dhclient 8 65or 66.Xr dhcpcd 8 , 67for each interface that is to be configured via DHCP. 68.It 69[Optional] To tweak settings, edit 70.Pa /etc/dhclient.conf 71(if 72.Cm dhcp_client="dhclient" ) 73or 74.Pa /etc/dhcpcd.conf 75(if 76.Cm dhcp_client="dhcpcd" ) . 77See 78.Xr dhclient.conf 5 79and 80.Xr dhcpcd.conf 5 81for details. 82.El 83.Pp 84To set up 85.Dx 86as a DHCP server: 87.Bl -enum -offset indent 88.It 89Install 90.Xr dhcpd 8 91(available in 92.Xr dports 7 ) . 93.It 94Edit 95.Pa /usr/local/etc/dhcp/dhcpd.conf . 96See 97.Xr dhcpd.conf 5 98and 99.Xr dhcpd 8 100for details. 101.It 102Edit 103.Pa /etc/rc.conf 104and set 105.Cm dhcpd_flags="" . 106This will cause 107.Dx 108to start the 109.Xr dhcpd 8 110daemon at boot-time and listen for DHCP requests on the local network. 111To start it manually, execute the following command: 112.Pp 113.Dl # /usr/local/sbin/dhcpd [netif1 netif2 ...] 114.El 115.Pp 116The DHCP client and server use the Berkeley Packet Filter (BPF). 117Ensure the kernel has been compiled with BPF support 118and at least one 119.Pa /dev/bpf* 120file exists per broadcast network interface that is attached to the system. 121This is almost always the case and should only be considered if all other 122troubleshooting options have failed. 123.Pp 124See 125.Xr dhcpd 8 126for information on other available options. 127Note, however, that most of the flags are useful only for debugging purposes. 128.Sh FILES 129.Bl -tag -width /usr/local/etc/dhcpd.conf 130.It Pa /etc/rc.conf 131configuration file where 132DHCP client configuration is set for individual interfaces and 133.Cm dhcpd_flags 134must be set 135.It Pa /etc/dhclient.conf 136DHCP client configuration file for 137.Xr dhclient 8 138.It Pa /etc/dhcpcd.conf 139DHCP client configuration file for 140.Xr dhcpcd 8 141.It Pa /usr/local/etc/dhcp/dhcpd.conf 142DHCP server configuration file 143.El 144.Sh SEE ALSO 145.Xr dhclient.conf 5 , 146.Xr dhcpcd.conf 5 , 147.Xr dhcpd.conf 5 Pq Pa net/isc-dhcp44-server , 148.Xr dhclient 8 , 149.Xr dhcpcd 8 , 150.Xr dhcpd 8 Pq Pa net/isc-dhcp44-server , 151.Xr dhcrelay 8 Pq Pa net/isc-dhcp44-relay 152