# Configuring a DHCP Server



## balanga (Oct 12, 2014)

I'm attempting to configure my FreeBSD system as a DHCP server and am a little unclear as to what I need to set in dhcpd.conf....

I'm guessing that the basic minimum to get going is to set:-

default-lease-time 
max-lease-time 

and a subnet

Can I get by with just this?

I'm trying to learn how all this works so that I can eventually disable dhcp on my modem/router and let FreeBSD provide IP adresses to hosts on my network.

One thing which puzzles me is how do direct hosts to a nameserver, as this is provide by my ISP.

Is this something which is configured by 
	
	



```
option domain-name-servers
```
?


----------



## Oko (Oct 12, 2014)

You should be able to get a way with something like this

```
option  domain-name "bagdala2.net";
option  domain-name-servers 192.168.3.1; 

subnet 192.168.3.0 netmask 255.255.255.0 {
                option routers 192.168.3.1;
                range 192.168.3.2 192.168.3.10;
        }
```

Note that above is my working dhcpd on my OpenBSD machine which servers my house domain. Note also that I actaully run my own DNS server (Unbound) on the same machine which issues dhcp leases thus

```
option  domain-name-servers 192.168.3.1;
```

Now interface setting, starting dhcpd with flags, PF and sysctl is beyond the scope of this post. You really should read man pages and documentation!


----------



## balanga (Oct 12, 2014)

I'm completely lost trying to work out what dhcpd_ifaces refers to. I have left it set to "dc0"  but I get some error saying that no interface is configured. Google doesn't provide any help showing any links. Can only think this refers to my ethernet NIC but where to equate "dc0" with the NIC is beyond me.


----------



## DutchDaemon (Oct 12, 2014)

dhcpd_ifaces pertains to the ethernet interface(s) where you want your DHCP server to respond to DHCP requests. E.g. if you have a WAN interface em0 and a LAN interface em1 you would typically serve IP addresses to your LAN, not the whole world, so you would use em1 in your dhcpd_ifaces directive. If you have more than one LAN, and you serve different IP ranges to both, both of these ethernet interfaces (let's say em1 and em2) would be in dhcpd_ifaces.


----------



## balanga (Oct 12, 2014)

Ok I have this working now having changed "dc0" to "igb0", but still wonder why the term "dc0" was used. I could have easily figured it out if "en0" had been used as this seems to be the generic identifier for a NIC.

Anyway now to develop my DHCP server to enable PXE booting. That should be fun..


----------



## SirDice (Oct 13, 2014)

balanga said:
			
		

> I could have easily figured it out if en0 had been used as this seems to be the generic identifier for a NIC....


On a Mac maybe but on FreeBSD interfaces have names depending on their driver. The en(4) driver is a specific driver that has nothing to do with ethernet.


----------

