AlpineLinux 3.6: Install dhcp for DHCP server

This article will describe installing dhcp and running DHCP server.

1 Install dhcp

Install dhcp package.

$ sudo apk add dhcp

2 /etc/dhcp/dhcpd.conf

Define domain name, DHCP server IP address and gateway IP address. Mapping MAC address 52:54:00:c0:07:60 to IP address

$ cat /etc/dhcp/dhcpd.conf
subnet netmask {
  option domain-name "";
  option domain-name-servers,;
  option routers;

host dhcp-client {
  hardware ethernet 52:54:00:c0:07:60;

3 Run dhcpd

Run dhcpd.

$ sudo rc-update add dhcpd
$ sudo rc-service dhcpd start

4 Execution result

Run the following command on client machine.

IP address is provided.

$ ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000
    link/ether 52:54:00:c0:07:60 brd ff:ff:ff:ff:ff:ff
    inet scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fec0:760/64 scope link
       valid_lft forever preferred_lft forever

DNS servers are provided.

$ cat /etc/resolv.conf