How to get a valid IP address on a VM?

Discussions related to using VirtualBox on Windows hosts.
Post Reply
bonesaw
Posts: 4
Joined: 15. Jan 2008, 18:27

How to get a valid IP address on a VM?

Post by bonesaw »

Hey.
So, I'll explain what I'm trying to do... I've managed to do it under Vmware and running Windows XP, but I prefer VirtualBox and I want to run Linux, so here's the deal:
I'm running Windows XP on my host, I need a VM to get a valid IP address from the same DHCP server my Windows XP gets (it is possible under VMware). That means I'll have 2 valid IPs, one on my Windows box and one on my VM. Then I'll install a proxy on the VM so I can have 2 IPs in the same system (there's a reason for that - remote access without affecting my Windows box - jailed).

Hence that I do not want to NAT.
I've installed Damn Small Linux and created a "host-interface" NIC, but when I run dhclient it doesn't get any IP at all and for some reason it tries to ping 10.0.2.2, which fails. I've removed the default gateway route. It's supposed to get everything through DHCP while broadcasting.

Anyone know if that's possible?

[PC] -> Internet (ip1)
[PC] -> [VM] -> Internet (ip2)

At the same time?
Tried to search but didn't found something that could answer my question.
Thanks in advance.
bonesaw
Posts: 4
Joined: 15. Jan 2008, 18:27

Post by bonesaw »

Don't think it's possible under VirtualBox since I don't see the option I have on VMWare when I create a VM for a virtual NIC.
Done it using VMWare, Damn Small Linux and DanteD (socks server), with only 64mb ram, maybe I even get it lower since I don't even need any GUI, just console. :D

If anyone knows how to do it on VirtualBox, let me know.
Thanks anyway.
S.SubZero
Volunteer
Posts: 123
Joined: 5. Oct 2007, 21:30

Post by S.SubZero »

With XP Host, you use Host Interface Networking, and you bridge the virtual and real interfaces together under start->settings->network connections. Highlight the real and virtual interfaces and choose the bridge option. Poof, instant bridge.

Now the virtual adapter will sit in the local network and get it's own IP from your DHCP server.
bonesaw
Posts: 4
Joined: 15. Jan 2008, 18:27

Post by bonesaw »

I thought about doing that, but I didn't really knew if it would work or not.
The VMware interface used to get an IP to my ISP's DHCP server doesn't even show on my host, only inside the VM. I thought host-interfaces were only for VM<->Host like it is on VMW, I think.
Makes sense to bridge them, but wouldn't I have 2 valid IPs on my host? That could be a problem, that why I haven't done it.
frank
Oracle Corporation
Posts: 3362
Joined: 7. Jun 2007, 09:11
Primary OS: Debian Sid
VBox Version: PUEL
Guest OSses: Linux, Windows
Location: Dresden, Germany
Contact:

Post by frank »

If you use a host network interface and bridge the host interface on the host side with the external interface then, yes, you need two IPs, one for the host itself and one for the guest. The reason is that the external network and the host interface network share the same network (bridging).

But if you don't bridge the host interface, the host uses a different network than the guest and you can use a DHCP server on the host side which is connected to the guest's network interface. I assume that VMware ships a DHCP server for host network interfaces but we don't. There should be DHCP servers for Windows available in the public.
Post Reply