fedora 15 virtualbox dhcp

If you’re test driving a “minimal” Fedora install on the completely awesome VirtualBox, you may be having a little trouble getting a DHCP address while using VBox’s bridged adapter.

Here’s what you DON’T need to do- install and run the DHCP service. Resist the urge to install the dhcp package. You don’t need it.

Two easy steps should solve this problem:

  1. Get the eth0 interface up. It’s now called p2p1, not eth0 (info).
  2. Get the “network” service running on runlevel 3, the default text-only runlevel. If you’re running a desktop, you’ll also want it running on level 5 (graphical mode). By default, the network service will not be running (at least during a “minimal” install).

Using chkconfig

You can get a list of which services are running at each runlevel with chkconfig:

# chkconfig --list

Note: This output shows SysV services only and does not include native
 systemd services. SysV configuration data might be overridden by native
 systemd configuration.

auditd             0:off    1:off    2:on    3:on    4:on    5:on    6:off
ip6tables          0:off    1:off    2:on    3:on    4:on    5:on    6:off
iptables           0:off    1:off    2:on    3:on    4:on    5:on    6:off
lvm2-monitor       0:off    1:on    2:on    3:on    4:on    5:on    6:off
netconsole         0:off    1:off    2:off    3:off    4:off    5:off    6:off
netfs              0:off    1:off    2:off    3:on    4:on    5:on    6:off
network            0:off    1:off    2:off    3:off    4:off    5:off    6:off
saslauthd          0:off    1:off    2:off    3:off    4:off    5:off    6:off
sendmail           0:off    1:off    2:on    3:on    4:on    5:on    6:off
sshd               0:off    1:off    2:on    3:on    4:on    5:on    6:off

You’ll note that my network service is off for all runlevels in this output.

Using ifconfig

You can check to see if your p2p1 interface is up with ifconfig:

# ifconfig

You’ll likely see just one entry for “lo”, the loopback interface.

# ifconfig
lo        Link encap:Local Loopback
 inet addr:127.0.0.1  Mask:255.0.0.0
 inet6 addr: ::1/128 Scope:Host
 UP LOOPBACK RUNNING  MTU:16436  Metric:1
 RX packets:0 errors:0 dropped:0 overruns:0 frame:0
 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:0
 RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Bring up p2p1

To get p2p1 going, open “/etc/sysconfig/network-scripts/ifcfg-p2p1″ with your text editor. The changes to make are in blue:

DEVICE="p2p1"
BOOTPROTO=dhcp
HWADDR="04:00:21:55:71:1C"
ONBOOT="yes"
NM_CONTROLLED="yes"

Fix runlevels 3 & 5

Now we need to tell Fedora to enable networking for runlevels 3 & 5:

# chkconfig --level 35 network on

Good to Go!

Reboot your virtual machine. If your host device has internet connectivity, the virtual machine should too now. Test it by pinging yahoo.com:

# ping yahoo.com
PING yahoo.com (209.191.122.70) 56(84) bytes of data.
64 bytes from ir1.fp.vip.mud.yahoo.com (209.191.122.70): icmp_req=1 ttl=56 time=202 ms
64 bytes from ir1.fp.vip.mud.yahoo.com (209.191.122.70): icmp_req=2 ttl=56 time=167 ms
64 bytes from ir1.fp.vip.mud.yahoo.com (209.191.122.70): icmp_req=3 ttl=56 time=194 ms
64 bytes from ir1.fp.vip.mud.yahoo.com (209.191.122.70): icmp_req=4 ttl=56 time=196 ms

ifconfig should now look something like below. Note that the p2p1 interface is now present and has an IP address on the local network.

# ifconfig
lo        Link encap:Local Loopback
 inet addr:127.0.0.1  Mask:255.0.0.0
 inet6 addr: ::1/128 Scope:Host
 UP LOOPBACK RUNNING  MTU:16436  Metric:1
 RX packets:0 errors:0 dropped:0 overruns:0 frame:0
 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:0
 RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

p2p1      Link encap:Ethernet  HWaddr 04:00:21:55:71:1C
 inet addr:192.168.1.127  Bcast:192.168.1.255  Mask:255.255.255.0
 inet6 addr: fe80::a00:29ff:fe25:741c/64 Scope:Link
 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 RX packets:61359 errors:0 dropped:0 overruns:0 frame:0
 TX packets:45598 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:79521429 (75.8 MiB)  TX bytes:7321021 (6.9 MiB)
This entry was posted in fedora, linux, virtualization. Bookmark the permalink.

4 Responses to fedora 15 virtualbox dhcp

  1. Sebastian says:

    Wow, that helped a lot! Thanks for providing this tutorial.
    My only problem was that the network the host is in disabled ping to the outside, so I couldn’t test properly. lynx was more helpful.

  2. Jan Vermeir says:

    Hi Larry, works! thanks for sharing.

  3. Dinesh says:

    A perfect solution with perfect explanation.

  4. Nigel Smith says:

    Larry, many thanks for doing this write-up.
    It worked a treat, and saved me a lot of time.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>