Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Edit: Added a use case for CIFS

Setup:

  • Host: Windows 7 SP2 64bit
  • Guest: Ubuntu 12.04.3 LTS 64bit (on VirtualBox 4.3.0)
  • The host laptop has a 2 network adapters:
    • A USB-pluggable WiFi module
    • An 1Gbps ethernet port

Use cases:

  • When working at the office, the USB WiFi module is connected to the host. The Ubuntu guest needs connectivity with a fixed IP configuration (A fixed IP on the 192.168.1.x network, DNS is 8.8.8.8)

  • When working at home, the USB Wifi module is absent, and the Ethernet port on the host is used. The network at home has a DHCP server (my home router) which I want to use in order to assign IP configuration for the Ubuntu guest.

  • In both cases, I want the Ubuntu guest to work in "Bridged" mode (bridge the virtual eth0 and/or eth1 to the host's currently-used physical network adapter).

  • I need the host the guest to communicate over CIFS (samba) which I think prevents me from using NAT (?)

  • Unfortunately, I noticed that when the USB WiFi is disconnected from the host, VirtualBox automatically switches the physical device used for "virtual network interface 1" to the Ethernet port.

My question:

When working either at home or at the office (that is: either with the USB WiFi connected and the Ethernet disconnected, or the other way around), I want to have Internet connectivity on the VirtualBox, without the need to manually change the configuration every time.

  • What configuration should I use in VirtualBox?

  • What configuration should I use in the guest? Specifically, in /etc/network/interfaces, in /etc/udev/rules.d/70-persistent-net.conf

  • Also, does the guest need any specific IP routing rules so that traffic is routed through the (always single) available guest interface?

  • Does a specific configuration of bridging host interfaces (Use Windows to bridge the Wifi and Ethernet adapters) help in any way? What are the VirtualBox and guest configurations in this case?

share|improve this question

migrated from serverfault.com Dec 3 '13 at 16:06

This question came from our site for professional system and network administrators.

    
Why aren't you using NAT, which would solve the issue ? –  jlliagre Dec 3 '13 at 14:41
    
I want the host & the guest to communicate using Samba (CIFS), is this possible using NAT? I will edit the question accordingly. –  montigo Dec 4 '13 at 9:05
    
Answer updated too. –  jlliagre Dec 4 '13 at 10:51

1 Answer 1

NAT allows incoming connections when configuring port forwarding but as far as I know, this won't work with CIFS at least if you want a CIFS servers on the guest side.

If you just want your guest to be a CIFS client and the server to be on the host, NAT might just work.

In any case, what I would do is configuring two interfaces on the guest.

  • The first one would use NAT so allow Internet connection.

  • The second one would use a "Host Only" network, i.e. vboxnet, and will allow unrestricted bidirectional communication between the host and the guest.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.