I have just set up a FreeBSD 8.1 in a VM and am trying to get it to do DHCP automatically. Right now, if I leave /etc/rc.conf like so:

#ifconfig_de0="DHCP"

then I can do dhclient de0 and it gets an IP instantly.

If I remove the comment so that DHCP is supposedly automatic, then dhclient de0 never gets an address (and it doesn't happen automatically either)

I get DHCPREQUEST on de0 to 255.255.255.255 port 67

Nothing else changes, what am I doing wrong?

I've also tried using sysinstall, but I have found no way to get it to write the changes to the files once I make them.....

==== Edit

Hoping to save someone else the time I spent on this, here is my rc.conf:

# -- sysinstall generated deltas -- # Mon Dec  6 11:51:13 2010
# -- sysinstall generated deltas -- # Wed Dec  8 08:28:27 2010
# Created: Mon Dec  6 11:51:13 2010
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
#REMOVED: inetd_enable="YES"
hostname="pfsensedev.intomec.com"
#ifconfig_de0="DHCP"
inetd_enable="NO"
sshd_enable="YES"

I found that I had to comment out the ifconfig_de0 line if I wanted to get an IP address assigned. If I left it in rc.conf, it was impossible to get an IP address via dhclient.

Putting the lines into /etc/rc.local did the trick

dhclient de0

I'm running this on a MS Virtual PC VM under Win7x64 (already had it loaded for XP Mode).

Thanks for the help guys.

link|improve this question

57% accept rate
The rc.conf file is only read during boot, or by manually restarting the netif stack with /etc/rc.d/netif restart; are you doing either of those after modifying the file? – Chris S Dec 7 '10 at 22:28
Do you have any other lines that start with ifconfig_de0, or any configuration options for DHCP in rc.conf (might be easiest to simply post the whole file)? What version are you running and how was it installed? – Chris S Dec 8 '10 at 13:37
feedback

1 Answer

up vote 0 down vote accepted

You are doing it right. If it doesn't work in your case, you could also use /etc/rc.local. Put the command dhclient de0 into this file and it will be run upon system start.

link|improve this answer
1  
Since 6.0 the use of rc.local is strongly discouraged, and especially in cases where there's a knob in rc.conf for the same functionality. This would work however. – Chris S Dec 8 '10 at 13:34
rc.local does fix the problem, even if strongly discouraged. I even punted and reloaded the OS to make sure I hadn't messed up rc.conf somehow, but it looks and acts the same either way. – Mark0978 Dec 8 '10 at 20:49
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.