Setting up a DHCP Server for your home or company network is pretty simple with NetBSD. You don't need to install any software, because everything you need, is part of the base system. Just create the file /etc/dhcpd.conf like this:

deny unknown-clients;       
ddns-update-style none;      
subnet 192.168.0.0 netmask 255.255.255.0 {
        range 192.168.0.200 192.168.0.254; 
        default-lease-time 28800;
        max-lease-time 86400;
        option broadcast-address 192.168.0.255;
        option domain-name "mycompanydomainname.com";
        option domain-name-servers 194.152.64.35, 194.25.2.132;
        option routers 192.168.0.1;

        host ftp-server {
                hardware ethernet 00:00:0a:d8:39:ee;
                fixed-address 192.168.0.199;
                }
        host sparc {
                hardware ethernet 00:50:04:01:ee:20;
                fixed-address 192.168.0.198;
                }
}

Now add the service to your /etc/rc.conf. This way the DHCP will be started on every reboot.

dhcpd=yes
dhcpd_flags="-q ex0"

ex0 is the Network Interface to listen on for dhcp requests. This is important if you have more than one Network Interface. If you don't, you can omit the second line.

Before starting the service, you have to create a lease file, that the dhcp server needs.

# touch /var/db/dhcpd.leases

Now start the service:

# /etc/rc.d/dhcpd start

To test if your dhcp server is running, run dhclient on another host on the same network.

# dhclient

Also check your /var/db/dhcpd.leases file. That's it. Have fun.

Additional Information

Add a comment