# Setting up dhcpd



## kpedersen (Jun 21, 2010)

Hello,

I have finally got time to move over from Windows Server 2003 (internet connection sharing) to a FreeBSD solution, whilst attempting to improve my networking knowledge.

However... I have come to a slight block whilst trying to set up the DHCP server.

I am following http://docs.freebsd.org/doc/6.1-RELEASE/usr/share/doc/handbook/network-dhcp.html

I have followed it pretty much step by step but in the *rc.conf* I have replaced the *dhcpd_ifaces* to use my network card (fxp0) rather than their example one (dc0) however, when I then do *(...)/dhcpd start* it states that fxp0 is not found...

Do I need a different card or something? One that broadcasts? Surely not...

Any advice would be appreciated


----------



## wblock@ (Jun 21, 2010)

That link is to an old version, 6.1-RELEASE.

Please show your ifconfig output and the new entries you've added to /etc/rc.conf.


----------



## graudeejs (Jun 21, 2010)

show /etc/rc.conf
and output of `$ ifconfig`


----------



## kpedersen (Jun 21, 2010)

Hi,

The required information is below.

/etc/rc.conf

```
hostname="bob"
keymap="uk.iso"
powerd_enable="YES"
dhcpd_enable="YES"
dhcpd_ifaces="fxp0"
```

`ifconfig`

```
fxp0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=2009<RXCSUM,VLAN_MTU,WOL_MAGIC>
	ether 00:d0:59:cf:94:b5
	media: Ethernet autoselect (100baseTX <full-duplex>)
	status: active
plip0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> metric 0 mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=3<RXCSUM,TXCSUM>
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
	inet6 ::1 prefixlen 128 
	inet 127.0.0.1 netmask 0xff000000
```

The error I get is


```
fxp0: not found
/usr/local/etc/rc.d/isc-dhcpd: WARNING: failed to start dhcpd
```


----------



## wblock@ (Jun 21, 2010)

Try running it by hand:
`# dhcpd -cf /usr/local/etc/dhcpd.conf -lf /var/db/dhcpd/dhcpd.leases fxp0`


----------



## kpedersen (Jun 22, 2010)

That gives me the same error.


```
Internet Systems Consortium DHCP Server V3.0.7
Copyright 2004-2008 Internet Systems Consortium
All rights reserved
For info, please visit [url]http://www.isc.org/sw/dhcp/[/url]
Wrote 0 deleted host decls to leases file.
Wrote 0 new dynamic host decls to leases file.
Wrote 0 leases to leases file.
Jun 22 00:02:06 bob dhcpd: fxp0: not found
fxp0: not found
```

I really do not get it, the interface is definately there in `ifconfig`...

EDIT:
Right, it ends up that I had to give fxp0 an IP first... which kinda makes sense since a DHCP server probably doesnt assign itself an IP...
I *think* I might be able to get this working yet


----------



## SirDice (Jun 22, 2010)

Yep, you are correct. Fxp0 needs an IP address to work with dhcpd.


----------



## kpedersen (Jun 22, 2010)

Cool, everything is working well, I am now posting this using my brand new wired network which is nat'ing across the house to the university wifi 

The only thing I noticed that I didn't need to do (from the handbook) was

/boot/loader.conf

```
ipfw_load="YES"
ipdivert_load="YES"
```

Does this now mean that the translation is done in userland rather than the kernel?

Other than that, it works great and although it took a bit more work, at least I know what configuration was needed as opposed to the Windows ICS magic box which could be doing *anything*.

Thanks for the help all.


----------



## SirDice (Jun 22, 2010)

kpedersen said:
			
		

> The only thing I noticed that I didn't need to do (from the handbook) was
> 
> /boot/loader.conf
> 
> ...


They are being loaded by the /etc/rc.firewall script.


----------



## kpedersen (Jun 22, 2010)

Ah great.

Thanks.


----------

