Setting up a DHCP server
Depending on the network infrastructure, you may need a DHCP server. This step shows how to install and configure a DHCP server.
Requirements:
- Internet connection.
- Adjust the firewall and apply the rules to the WLAN interface (see: Firewall)
Proceed as follows:
- 1. Enter the
doas pkg install dhcpd
command in the console to install the DHCP server. - 2. Open the
dhcpd.conf
. file withdoas ee /usr/local/etc/dhcpd.conf
and edit the configuration according to your requirements..
Sample:
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.20;
default-lease-time 600;
max-lease-time 72400;
option subnet-mask 255.255.255.0;
}
- 3. Open the
rc.conf
file withdoas ee /etc/rc.conf
and add the following lines:
dhcpd_enable="YES"
dhcpd_flags="wlan0"
dhcpd_ifaces="wlan0"
- 4. Enter the
doas service dhcpd start
command to start the DHCP service. After a restart, the DHCP service is started automatically because of the corresponding entry inrc.conf
. - 5. The
ee /var/db/dhcpd.leases
command can be used to view current and expired leases.
- The DHCP server is thus active and only listens to requests on the interface
wlan0
.
For more information, see: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-dhcp.html or https://man.openbsd.org/dhcpd.8