How make Linux guest get IP from the LAN's DHCP?

Discussions related to using VirtualBox on Windows hosts.
Post Reply
esutton
Posts: 9
Joined: 23. Dec 2008, 22:50

How make Linux guest get IP from the LAN's DHCP?

Post by esutton »

( Please forgive my beginner Linux, networking, & virtualBox fluency. )

How can I make the Linux guest get it's IP from the LAN's DHCP and a Vista host?

On VMware, a guest OS installs to bridged networking. Or at least it defaulted to what I wanted - it got it's IP from the LAN DHCP and was accessible like it was a physical machine on the LAN. I am seeking advice how to do same under virtualbox.
  • My Vista host has an IP of 10.0.0.13
    My CentOS 5.2 guest is configured for NAT
    Typing ifconfig reveals my guest has an IP of: 10.0.2.15 while I was hoping to see something in the 10.0.0.* range.
    I am using VirtualBox 2.1.0
-Ed
ssetbob7
Posts: 8
Joined: 22. Dec 2008, 17:29

Post by ssetbob7 »

Are you trying to get your guest OS to appear as if it is on your network?

If so then just set the network setting to Host Interface. Don't use NAT. Make sure you have the new guest additions installed. Check "ifconfig" in terminal to see if it worked, it should.
esutton
Posts: 9
Joined: 23. Dec 2008, 22:50

Post by esutton »

For other newbies, here's what I did to resolve it after receiving your helpful advice:

1 - Configure the VM Network setting to use Network > Attached to: = "Host Interface" and start your VM
2 - Log on as root
3 - From the guest OS VitualBox window select Devices >Install Guest Additions. After a minute it will mount a disk image on your desktop and open up a window displaying VBOXADDITIONS.
4 - Double-click and run VBoxLinuxAdditions-x86.run. ( Runs *very* quickly on CentOs 5.2 )
5 - Open a terminal and enter ifconfig, and verify the IP is now on the host's LAN.
6 - Open a console in my Vista host OS and verify I can ping the guest's IP

Thank you for taking time to assist! I had tried "Host Interface" to get the guest OS to appear as if it a machine on my network . However, I had not installed Guest Additions. Thank you very much for your help!

Merry Christmas to all and to all goodnight! :-)


-Ed
esutton
Posts: 9
Joined: 23. Dec 2008, 22:50

Post by esutton »

I guess I do not have it figured out all.

After VM reboot ( the first reboot VBox had stopped repsonding) the IP is no longer on the LAN. I tried re-running the VBoxLinuxAddition without success. Not sure what's is up.

Any tips or suggestions are much appreciated.

-Ed
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Setting it to HIF should have been enough. You do need to select the proper interface. Check it again. Maybe you made a change in your network config when it was running and that was not saved?
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
esutton
Posts: 9
Joined: 23. Dec 2008, 22:50

Post by esutton »

Sorry, it *is* working.

I went back and temporarily changed VM Networking to NAT, then backed-out, then went back in and set to Host Interface, and now it's getting the IP from the local LAN's IP.

Excellent, thanks!

-Ed
simha.chow
Posts: 9
Joined: 24. Dec 2008, 13:10

Post by simha.chow »

hi
its perfect
but what if i want to set up my own network without any DHCP
i want to ping to my guest from host and outside of host (all machines are in LAN with out DHCP)
how can i do this ,plz help me
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post by TerryE »

This isn't really a VBox issue but more just how to configure a network manually without DHCP. You basically choose a private class C address (typically 192.168.N.*) and if you have a broadband router ensure that this uses the same class C address LAN-side then manually allocate IP addresses to machines. How you set up each machine is different for Windows and Linux, but the relevant online guides will explain.

If you are using NAT within VBox then your guest thinks its is just a DHCP serviced node in a virtual network presented by the host. If you are using a bridged Host IF then you need to manually allocate an address as before.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
Shiggity
Posts: 1
Joined: 26. Dec 2008, 00:50

Post by Shiggity »

Hello all. Merry Christmas!

I'm having a similar problem as the people posting to this thread. I'm somewhat of a Linux newbie. Though I learn quite quick.

I've installed Gentoo Linux 2008.0 (32 bit) into a VM, and it boots, but even with the Guest Additions I can't get networking to work at all, DHCP or not.

Host is Windows XP Pro 32bit running on an Intel Core 2 Duo 2.2 GHz.

I know that's assumed since this IS the Windows host form, but the more information I can give the better.

I've tried setting the VM's network setting as Host Interface as well as NAT with no luck. Would I need to boot from the minimal install LiveCD again and install dhcpd? Running from the LiveCD is the only way the VM has network or internet access at all.

I'd like the VM to have internet access because I'd like to emerge in xorg-x11 and KDE or GNOME (preferably KDE) and I'd rather not have to download binary install ISOs.

All help is appreciated,
Shiggity
simha.chow
Posts: 9
Joined: 24. Dec 2008, 13:10

Post by simha.chow »

Hi ,,,
i also faced the same issue,,but it almost resolved
1.NAT
if we enable this,,on VM setting , we can get An ip from VBox (DHCP is inside the VBOx , as 10.0.2.15) .if host is having internet connection,automaticallyy Nattig will happen between host and guest.

we can ping from guest to host, and we cant ping from guest to host

this is the case with LAN

2.Hostinterface
in this case we need to installl driver( automatically installed in the following way) ,this driver enables connectivity between host and guest and outside.

steps:
1.up on the installation of VB ,select hostinterface setting from Network setting on VB.
2.in the bottom, select the appropriate ethernet card.
3.close the connection ,and start new virtual machine, at this time , a window will appear in host scree, like , Install Driver for New Hardware , just press NEXT ,it will be done automatically, check whether the driver is installed on host in following way
A).go to TCP\IP properties (selectd eternet card) there u can find virtual box driver in installed state.
4.now install the guest , assign some IP (for ex class C) , and assign the same IP in Host
now u can ping in bothways,and host cable should be conected in LAN
or
just install microsoft loop back adaptor,,and make it as bridge bitween Host and guesty\

Hope this solves your Problem, please let me know for any clarificatrion\
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post by TerryE »

simha.chow wrote:NAT ... we can't ping from guest to host
See the Forum FAQ. NAT doesn't route ICMP so ping won't work.

Shiggity, have you a DNS problem rather than a IP connectivity problem. If you can browse http://216.239.59.103/ and see google them it's a DNS problem. See the FAQ for more details.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
simha.chow
Posts: 9
Joined: 24. Dec 2008, 13:10

Post by simha.chow »

hai

Am able to connect to internet in bothways that is from NAT and from HIF
1.NAT
A .in this method am getting IP from VB as 10.0.2.15 , i can ping to public DNS and i can ping to Host
B.but i cant ping from host to guest (might be this future is not there with VB)

2.HIF
A.in this am getting IP directly from LAN DHCP .
ping is working in bothways
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

simha.chow wrote:hai

Am able to connect to internet in bothways that is from NAT and from HIF
1.NAT
A .in this method am getting IP from VB as 10.0.2.15 , i can ping to public DNS and i can ping to Host
B.but i cant ping from host to guest (might be this future is not there with VB)
Read up on what NAT actually does. Can you ping your own machine from your work or school? No, you can't, because your machine is behind a NAT router.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply