DHCPd on OpenBSD 2.9
I wanted to set up a DHCP server for my network so that I didn't have to manually configure the IPs of each of my machines. Now if I want to change any of the IPs on my network I do it at the server and I can look it up in the configuration file to see if I forget what IP goes to what machine (but that hasn't happened yet).
Running a DHCP server with OpenBSD is really quite simple since it is installed already. All you have to do to turn it on is edit /etc/rc.conf and change dhcpd_flags to "-q" (then I rebooted since I was too lazy to look up the commandline needed to do it without rebooting).
You probably only want to answer to computers on your lan. Answering for your ISP might get you in some trouble. So edit your /etc/dhcpd.conf file. Below is mine with the MAC addresses xx'd out just in case. Note the internal IP address of the OpenBSD box is 192.168.0.1. It is giving specific "static" addresses to the machines where I have specified MAC addresses of NICs and for everything else, they get something between 192.168.0.100 and 192.168.0.155.
The domain-name-servers line has DNS servers for two different ISPs in Texas. You'll probably want to change those if you can find IP addresses of your own.
The DHCP server will assign names to the "static" machines which will probably be added to /etc/hosts and/or BIND later for internal resolution, but I havn't gotten around to doing that yet. You can see the MAC addresses for your NIC(s) in *nix by typing ifconfig or by going to start menu->run->winipcfg and selecting your NIC.
Be sure to edit your /etc/dhcpd.interfaces file so that you only serve IP addresses to the NIC on your LAN and another NIC (like the NIC for your cable modem). My file simply has x10 in it as the interface to my 3com905a NIC.
shared-network LOCAL-NET {
# option default-lease-time 3600;
# option max-lease-time 86400;
option domain-name "goodmeat.net";
option domain-name-servers 204.145.251.1, 205.128.118.1, 205.128.118.2;
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
range 192.168.0.100 192.168.0.155;
host windows {
hardware ethernet 00:00:00:00:00:00;
fixed-address 192.168.0.4;
option host-name "windows";
}
host duron {
hardware ethernet 00:00:00:00:00:00;
fixed-address 192.168.0.2;
option host-name "duron";
}
host valinux {
hardware ethernet 00:00:00:00:00:00;
fixed-address 192.168.0.3;
option host-name "valinux";
}
host dell {
hardware ethernet 00:00:00:00:00:00;
fixed-address 192.168.0.6;
option host-name "dell";
}
}
}


Post new comment