NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Problem setting up DHCP with Virtual Box


I have a situation here that looks like either a documentation bug or a software bug. I am running NetBSD 5.1 on VirtualBox. Due to a known issue with VirtualBox, I have to run VB with the command:

VBoxSDL --norawr0 --startvm NetBSD

The problem I'm having is with networking and DHCP. This is what I did:

1) I can confirm that the ethernet card is detected but has no IP:

# ifconfig -a
pcn0: flags=8802<BROADCAST,SIMPLE,MULTICAST> mtu 1500
        address: 08:00:27:7a:5b:67
        media: Ethernet autoselect (autoselect)

2) I have configured DHCP:

# grep dhclient /etc/rc.conf

But when I try to start dhcp nothing happens... literally nothing. The command just returns without any comment. Like this:

# sh /etc/rc.d/dhclient start

No output, no delay, no error message, no DHCPDISCOVER... nothing. The instruction to run the above command comes from here:

After a few reboots and about half an hour of Googling and poking around at VirtualBox and NetBSD I took a look at the dhclient script:

# grep -v ^# /etc/rc.d/dhclient

$_rc_subr_loaded . /etc/rc.subr


load_rc_config $name
run_rc_command "$1"

Ok, I see that at some point it is supposed to run /sbin/dhclient so I thought I'd run that directly:

# /sbin/dhclient
Internet Systems Consortium DHCP Client V3.0.3
copyright 2004-2005 Internet Systems Consortiium
Aug 6  00:42:53  dhclient: Corrupt lease file - possible data loss!
Corrupt lease file - possible data loss!
Listening on BPF/pcn0/...
Sending on   PBF/pcn0/...
Sending on   Socket/fallback
DHCPDISCOVER on pcn0 to port 67 interval 5
DHCPREQUEST on pcn0 to port 67

bound to -- renewal in 42424 seconds.

I can confirm that after this, internet works fine (aka I can ping Google). I don't know if the "corrupt lease file" is a big deal (it sounds bad) but other than that, it looks great.

So, going back to /etc/rc.d/dhclient, it looks like something must have happened in the "$_rc_subr_loaded" line (I don't really know what it does) that made the script fail before it got anywhere.

I'm not overweight, I'm undertall.

Home | Main Index | Thread Index | Old Index