LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Networking - Virtual Box (WinXP Guest) (https://www.linuxquestions.org/questions/slackware-14/networking-virtual-box-winxp-guest-779675/)

dc_eros 01-04-2010 03:20 AM

Networking - Virtual Box (WinXP Guest)
 
I installed VirtualBox on Slackware 13.0 32 bit (VB from slackbuilds.org). After installing Windows XP as a guest, I tried connecting the slackware host to the winXP guest. I set up static ip for both OS.

xxx.xxx.xxx.130 - for the slack
xxx.xxx.xxx.131 - for XP

however, I cannot ping from both directions.

I noticed that vboxnet0 was not alive in ifconfig
Out of curiosity, (since I have no internet at home) I tried to UP it up.

I tried bridged connections, NAT, internal network, host only (network settings in virtualbox) yet it nothing happens.

To further worsen the situation, I tried:
ifconfig vboxnet0 xxx.xxx.xxx.131
But I regret from doing so and I cannot revert back the changes. :D

the output of:

ifconfig -a returns eth0, wan0, lo, a vmware device (since I attempted to install VMWare before I realized VirtualBox is what I need).

Gerard Lally 01-04-2010 06:47 AM

Not sure about Virtualbox but I do know that KVM needs the Tun/Tap kernel module loaded, and tunctl to control the TAP interface. Probably brctl to set up the bridge for host networking as well.

mostlyharmless 01-04-2010 01:57 PM

You could try using the vmware network you accidentally installed; works for me under Slackware 12.1

dc_eros 01-04-2010 05:57 PM

I cannot use the vmware network device I've accidentally installed. It does not appear on the list when I go to VirtualBox->Machines->Settings->Network Settings -> any networking options does not show the vmware device.

Perhaps I have to try the tunctl and brctl commands.

But how about the IP address i have setup on vboxnet0 device? I want to remove it since there is no IP address when it is first setup. I have set an IP address accidentally, thinking that it will do the trick :D

afreitascs 01-04-2010 10:09 PM

My English is bad, but you installed Guest Additions.He is on the menu
Machine Devices Helps, after you get the XP ...

Decices >>>> Install Guest Additions

Click in Install Guest Additions ...

Then open the Windows Explorer and go to networks

Good Luck :-)

dc_eros 01-04-2010 10:27 PM

Thank you for the help. I will try to install guest additions when I get home.

Erik_FL 01-05-2010 12:02 AM

Quote:

Originally Posted by dc_eros (Post 3813342)
I installed VirtualBox on Slackware 13.0 32 bit (VB from slackbuilds.org). After installing Windows XP as a guest, I tried connecting the slackware host to the winXP guest. I set up static ip for both OS.

xxx.xxx.xxx.130 - for the slack
xxx.xxx.xxx.131 - for XP

however, I cannot ping from both directions.

I noticed that vboxnet0 was not alive in ifconfig
Out of curiosity, (since I have no internet at home) I tried to UP it up.

I tried bridged connections, NAT, internal network, host only (network settings in virtualbox) yet it nothing happens.

To further worsen the situation, I tried:
ifconfig vboxnet0 xxx.xxx.xxx.131
But I regret from doing so and I cannot revert back the changes. :D

the output of:

ifconfig -a returns eth0, wan0, lo, a vmware device (since I attempted to install VMWare before I realized VirtualBox is what I need).

"vboxnet0" is only used for the option "Host Only Network". For NAT or Bridged mode VirtualBox communicates directly into the IP stack, "eth0" or "wlan0" device driver.

Ping between a guest and host did not work on older versions of VirtualBox when using VirtualBox NAT. VirtualBox NAT always uses a 10.0.xxx prefix and the "xxx" part depends on the virtual machine network adapter number. You must set the Windows XP network interface to use "10.0.xxx.yyy" (or better yet, DHCP). You can find more information about NAT on the VirtualBox site. I don't know if ping works with NAT in the current version.

Ping should work for bridged mode if you put the IP addresses in the same IP network. In addition to the address prefix (the xxx.xxx.xxx part) being the same for Slackware and XP, you must make sure that the network masks are set for the correct number of bits (255.255.255.0).

In Windows XP you configure that in the Network Connections folder, and right click on the Local Area Connection. Then click "Properties" and double click on the TCP/IP protocol. Set the IP address and network manually and DO NOT select "Obtain IP address automatically". Double check the configuration by running "ipconfig /all" from a Windows command prompt. NOTE: To use VirtualBox NAT you should normally select "Obtain IP address automatically". For "Host Only" you should usually select "Obtain IP address automatically" and use DHCP for the "vboxnet0" interface in Linux.

In Slackware you edit the "/etc/rc.d/rc.inet1.conf" file for the correct IP address and network mask on "eth0" (or [0]). Make sure that the DHCP option is either "" or "no". When using VirtualBox NAT the address for "eth0" does not matter, as this has no effect on the address seen by the virtual machine (it's always 10.0.xxx.zzz). For "Host Only" mode you must specify an interface name, plus IP address or DHCP to make "vboxnet0" communicate. In "Host Only" mode the address for "eth0" does not matter as the virtual machine sees the address for "vboxnet0".

Example of lines in "rc.inet1.conf" for "vboxnet0".

Code:

# Config information for vboxnet0:
IFNAME[1]="vboxnet0"
IPADDR[1]="192.168.33.11"
NETMASK[1]="255.255.255.0"
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

- or -

Code:

# Config information for vboxnet0:
IFNAME[1]="vboxnet0"
IPADDR[1]=""
NETMASK[1]=""
USE_DHCP[1]="yes"
DHCP_HOSTNAME[1]=""

Replace "[1]" with an available entry number that is not already used for some other interface. Also, make sure that Windows XP and Linux both agree on the IP address, or both use DHCP (DHCP is provided by the VirtualBox software for host and guest).

Also look at "/etc/udev/rules.d/70-persistent-net.rules". That assigns the Ethernet device names based on the MAC address. If the correct interface is not being assigned "eth0" then you may have to edit the file. Otherwise you might find that your Ethernet adapter is being called "eth1" or something else. Use "ifconfig -a" to see all the network interfaces. If you see "eth1" or other things besides "eth0" then you might have to change the rules file.

If you're using a really old version of VirtualBox then you must use "brctl" in Linux to get a bridged virtual network adapter. The current version of VirtualBox (2.0 and above) does not require using "brctl". I encourage you to use the most recent version of VirtualBox since the network setup is much simpler.

NOTE: You can use "brctl" if you want to bridge the "vboxnet0" interface on the current version of VirtualBox. Set the virtual network interface to use "Host Only" mode and then bridge the "vboxnet0" interface. That is only needed for unusual network bridges (such as two host adapters bridged with one virtual adapter). In that case the IP address of "vboxnet0" is set for the bridge device (EX: "br0") and not in "rc.inet1.conf". This is possible but not usually required.

NAT Virtual Network Interface
Host IP: 10.0.xxx.yyy (can change with "vboxmanage")
Linux "rc.inet1.conf": does not matter
VM IP: 10.0.xxx.zzz use DHCP (provided by VirtualBox)
NOTE: Not sure if ping between host and guest works.

Bridged Virtual Network Interface
Host IP: depends on selected Linux device (EX: eth0)
Linux "rc.inet1.conf": use to set Linux device IP (EX: eth0 IP address)
VM IP: set manually or use DHCP (provided by your LAN or Linux)

Host Only Virtual Network Interface
Host IP: depends on Linux settings for "vboxnet0" interface (or "vboxmanage" to set VirtualBox DHCP address)
Linux "rc.inet1.conf": add "vboxnet0" with manual IP or DHCP (provided by VirtualBox)
VM IP: set manually or use DHCP (provided by VirtualBox)
NOTE: Default VirtualBox DHCP address is probably 192.168.56.nnn

It is usually better to have both the host and guest use DHCP, or both use a manually set address. Do not have one using DHCP and the other not using DHCP since it's harder to make sure that the network addresses are the same. When you're using the VirtualBox DHCP server (NAT or Host Only) you can change the network address using "vboxmanage". For Bridged mode you have to provide the DHCP server (Linux or your LAN) if you want one.

dc_eros 01-05-2010 12:24 AM

I think I'm going with the bridged mode. I see, I need to clear first the IP I've accidentally set to vboxnet0 and set it to DHCP. And I think I'm using a not so old version of VirtualBox since it is for Slackware 13.0 32 bit, from SlackBuilds.org

Got to copy this and try at home :D

Thank you.

By the way, this is the full details:

Host:

Slackware 13.0 32 bit
VirtualBox 3.1.2 from SlackBuilds.org
IP address for eth0: 10.xx.xxx.130
Subnet mask: 255.255.255.0

Windows XP Pro
10.xx.xxx.131
Subnet mask: 255.255.255.0

VBox network settings tried:

Bridged - eth0 used
NAT - eth0 used
Internal network - I forget already :D
Host only - vboxnet0 used

Reason: Need to use Internet Explorer 6, 7 and 8 for web development.

Erik_FL 01-05-2010 11:06 AM

Quote:

Originally Posted by dc_eros (Post 3814424)
I think I'm going with the bridged mode. I see, I need to clear first the IP I've accidentally set to vboxnet0 and set it to DHCP. And I think I'm using a not so old version of VirtualBox since it is for Slackware 13.0 32 bit, from SlackBuilds.org

Got to copy this and try at home :D

Thank you.

By the way, this is the full details:

Host:

Slackware 13.0 32 bit
VirtualBox 3.1.2 from SlackBuilds.org
IP address for eth0: 10.xx.xxx.130
Subnet mask: 255.255.255.0

Windows XP Pro
10.xx.xxx.131
Subnet mask: 255.255.255.0

VBox network settings tried:

Bridged - eth0 used
NAT - eth0 used
Internal network - I forget already :D
Host only - vboxnet0 used

Reason: Need to use Internet Explorer 6, 7 and 8 for web development.

I recommend that you use NAT if you don't care about Microsoft Networking (file sharing) or if you have multiple network interfaces (wired and wireless). Use Bridged if you do want to use Microsoft Networking (file sharing) and you use just one network interface to reach the Internet.

When you use NAT for a virtual network interface it uses ALL the network interfaces in Slackware, not just "eth0". The default gateway in Slackware will determine how VirtualBox NAT gets to the Internet. IP routing is done by Slackware. That's good if there are multiple network interfaces (wired and wireless) used to reach the Internet. You do not need to do anything with "vboxnet0". NAT does not work well with Microsoft Networking (file sharing).

If you use a "Bridged" virtual network interface for the virtual machine then you do not need to do anything with "vboxnet0". You do have to make sure that the Windows XP system is set to a compatible IP address with the same network prefix as your LAN. If your LAN supports DHCP then you can set Windows XP to obtain an IP address automatically. The default gateway in Windows XP determines how it gets to the Internet.Windows XP does its own IP routing. That works well if there is only one network interface in Slackware used to reach the Internet. A bridged virtual network interface works the best with Microsoft Networking (file sharing).

The latest version of VirtualBox (from their web site) installs with no problem on Slackware. You don't need to use a Slackbuild, and you're better off to use the latest 3.1.2 version. One of the latest fixes is that you can use more than one Bridged virtual network interface on a virtual machine. That's helpful if you have wired and wireless, so that you can bridge two virtual network interfaces and allow Windows XP to access both.

dc_eros 01-11-2010 03:45 AM

Hi there again. Sorry, but still my networking from host to guest doesn't work. The laptop is stand alone. No network / LAN of whatsoever and no wireless network to connect.

I remembered in Windows, using VMWare that when I attempt to run a virtual machine, while the main hub/switch is switched off, it gives me warning that networking may not work.

So I guess it was because I have no network that's why my host to guest networking does not work no matter how I've tried? Or maybe still I miss something.

All of my network adapters eth0 and wireless are working.

By the way, I tried the suggestion above, regarding NAT.

Erik_FL 01-11-2010 10:16 AM

It's difficult to help you when you have not made it clear how you now have the system configured. Please pick one configuration for the virtual machine and Linux, then post exactly how you have everything configured. Describe exactly what isn't working along with the configuration. The "bridged" virtual network interface is probably the best choice since it supports all types of communication like a normal computer on the LAN.

Your main router most likely provides a DHCP (Dynamic Host Configuration Protocol) server and assigns the IP addresses to computers on your LAN. To avoid a problem when that is turned off you have to set the IP addresses manually instead of automatically using DHCP.

dc_eros 01-11-2010 07:00 PM

1 Attachment(s)
Sorry for the incomplete details. Here is my ifconfig output:

Code:

root@darkstar:/home/lysender# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:90:f5:66:fe:f9 
          inet addr:10.0.2.1  Bcast:10.0.2.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  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:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:23 Base address:0xc400

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:28 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1480 (1.4 KiB)  TX bytes:1480 (1.4 KiB)

vboxnet0  Link encap:Ethernet  HWaddr 0a:00:27:00:00:00
          BROADCAST MULTICAST  MTU:1500  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:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0    Link encap:Ethernet  HWaddr 00:15:af:40:f8:f8
          UP BROADCAST MULTICAST  MTU:1500  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:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wmaster0  Link encap:UNSPEC  HWaddr 00-15-AF-40-F8-F8-6C-6F-00-00-00-00-00-00-00-00
          UP BROADCAST RUNNING MULTICAST  MTU:1500  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:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

And I've attached the screenshot of my VirtualBox configuration for Windows Guest.

The Windows Guest is configured with ip address 10.0.2.1, netmask address 255.255.255.0, default gateway to 10.0.2.1 and no DNS settings.

I cannot ping from both directions. I want to test my project into Windows XP using different IE versions. And also with Safari and other browsers.

I have installed Guest Additions to the guest but it seems to not affect anything related to networking.

I have also tried Bridged connection using eth0 but still they cannot communicate.

I hope I have given enough information. If you need more information, please tell me and I will take it tomorrow.

TIA

Erik_FL 01-11-2010 09:30 PM

To use VirtualBox NAT you must set "eth0" to some other network address besides 10.0.2.nnn. That is because the NAT is a sort of network gateway/router and connects the two networks (host LAN and virtual machine LAN). The host and the guest SHOULD NOT be on the same IP sub-network.

eth0 (10.1.xxx.xxx/24) <===> NAT (10.0.2.2/24) <===> (10.0.2.yyy/24) PCNet Fast III Windows XP

NOTE: "/24" is the same as saying network mask "255.255.255.0".

VirtualBox NAT assigns the virtual machine's virtual adapters addresses of 10.0.2.yyy for the first adapter, 10.0.3.yyy for the second adapter, and so forth. In order for NAT routing to work, the host OS (Linux) cannot use the same network addresses for any network interfaces. NAT is different than the other virtual networking modes in that respect.

In order for the guest to connect to the host, the guest must use the VirtualBox NAT host address 10.0.nnn.2 (EX: 10.0.3.2), or the address assigned to one of the host's hardware interfaces such as eth0 (EX: 10.1.4.5). The host cannot connect to the guest unless you forward ports using "vboxmanage". The host also can't ping the guest.

ALL the virtual machines that have NAT virtual interfaces will share the same set of addresses. In other words the first network interface of all virtual machines will use 10.0.2.yyy if configured for NAT and all of those virtual machines will be able to communicate with each other.

The default gateway for a guest OS should be set to the VirtualBox NAT host address 10.0.nnn.2 (EX: 10.0.3.2). That is usually done by the VirtualBox DHCP server. If the default gateway is not defined, then guests can only communicate with the host using the NAT host address 10.0.nnn.2.

dc_eros 01-11-2010 10:25 PM

Many thanks! Noted. I have to try this at home and report the result tomorrow. Thanks a lot.

dc_eros 01-12-2010 05:47 PM

Hi there, I made it successfully and here is my settings:

host: 10.1.1.1
guest: 10.0.2.15 <= this was what I've put before, not 10.0.2.1, maybe I forgot to type 5 when I post it above.

In guest, I can ping 10.0.2.2 and out of curiosity, I tried to browse in via Internet Explorer 6 and it outputs the default "It works!" page from apache 2.2.

Yes, it really works :D

Regarding file sharing, I just created a shared folder, which I made it ready on day 1 on /share
Everything works fine, though I think I don't need the ability to ping the guest from the host :D

You guys rocks! I'll be blogging this and read it again when Slackware 13.1 is released!


All times are GMT -5. The time now is 07:44 PM.