Configure the VirtualBox Network

This article has been moved to my new blog at edstevensdba.com.

 

Click here to go to the new location of this article.

Advertisements

48 thoughts on “Configure the VirtualBox Network

  1. Thank you for this post, it is very useful. I followed your instructions and for the most part it works great. I am having a wierd issue that maybe you can help with. The IP address assigned to the Virtual Box network adapter in Windows changes every time I reboot my PC. It seems to bounce back and forth between a 169.254.xx.xx address and a 192.168.xx.xx address. When this happens I have to change the configuration on the 2nd ethernet adapter on all my guest vm’s. Is there something I have configured incorrectly in my VirtualBox installation, or is this normal behavior? It’s not hard to change the network config in the guest OS but it’s kind of a nuisance.

    Thanks again for your blog, keep up the good work!

    • Mark,
      This changing IP seems to be a bit of an “issue” with VBox. I don’t see it at all on my personal laptop, but it has been a real issue on my desktop machine at the office. Was fighting it just last week. Rather than constantly changing the IP address of your vm’s, you can reset the address of the adapter on the host.

      On the Virtual Box Manager go to “File”, “Preferences”, “Network”. There you can reassign the IP address and net mask for the hostonly adapter. This normally resets the adapter immediately, but last week I had some other issues and ended up twice deleting and redefining the adapter. You can see those options at the same screen where you configure it.

      You can google this and see where others have had the issue. Also check out https://forums.virtualbox.org/.

      • Apparently this seems to be a bug, although it was fixed few versions back, but looks like lot of users r facing this . I too encountered this for the first time when i switched to totally diff. wireless or perhaps after upgrading to new version of VB. Anyways the workaround is to have 192.168.56.2 at the place what Ed mentioned above. Refer to this url for more info https://www.virtualbox.org/ticket/8796

      • Neeraj – If you are referring to the issue with the changing address of the VBox net adapter, I really think there is some sort of bug there. I’ve been running Vbox 4.2.16 but last week finally caved to the constant pop-up about a newer version being available. As soon as 4.2.18 was in I started having the problem, and even completely deleting and re-createing the hostonly adapter did not fix it. I finally punted, un-installed VBox alltogether and re-installed 4.2.16. When that installed it complained about not being able to ‘rename’ a network adapter. Checking with ‘ipconfig’ I had “Ethernet adapter Local Area Connection 3:” running on the ip address I had assigned. Normally it would be identified as “Ethernet adapter VirtualBox Host-Only Network”. It’s all working and stable again. I raised the issue on the VBox support forum but never got a satisfactory response.

    • Ed,

      Thank you for your excellent post on how to configure VirtualBox. I’m building VM test boxes for Ubuntu Server and various versions of Windows for application testing. I was able to apply your example above to configure Windows 7 Professional with the first network adapter being DHCP and the second being a dedicated IP within the range of my Host Machines VirtualBox Host-Only Network.

      One question just to confirm, the VirtualBox Host-Only Network adapter on my host machine should be configured to DHCP to automatically obtain an IP Address? That was the default setup by the VirtualBox software install?

      Lastly, when I do an ipconfig on my Windows 7 Professional VM, the DHCP network adapter has an IP Address in the 10.0.x.x.x range. I expected it to be in the range 192.168.x.x. Is the 10.0.x.x.x a fake range for home networks?

      Thanks again for your help.

      Brandon

      • Brandon, I’m glad you found the posting helpful.

        As for your first question, about configuring the host-only adapter. No, it should not be configured for DHCP. Yes, that is the default that VBox wants to impose on ANY adapter, but that is not what we want for our purposes. A server (and that’s what we’re building here) must have a fixed IP address, so that clients (your host OS and any other VM’s you build) will know where to find it. Giving a server a DHCP assigned address would be like you changing your email address every day, and expecting people to still be able to send you mail. The only reason I configure a second adapter with DHCP is that the way VBox implements its neworking models, it requires DHCP for the NAT adapter, and the NAT adapter is what is needed to get to the internet (for package download).

        Let’s quickly review the network adapter types implemented by VBox
        1) NAT (Network Address Translation). With this implementation, the VM has access to the host’s actual network adapter and thus can communicate with the network on which the host sits. However, the VM’s ip address is translated to the host’s IP address, so no one outside of the host OS knows the VM even exists. Perfect for the VM to be able to access the internet without having a presence on the host’s corporate or ISP network. The VBox implementation REQUIRES a NAT adapter to have a DHCP-assigned address, and the VBox software acts as the DHCP server to assign that address. Since this requires a DHCP address, it is unsuitable for server operations, like hosting a database.

        2) host-only. This implementation allows communication only across the VBox network – between the host and guest, and between guests. It allows a fixed IP address within the subnet of the “Ethernet adapter VirtualBox Host-Only Network” process running on the host. That allows me to have the fixed address needed for server operations, but still keep all communications isolated to the physical box. Communications never hit the OS’s NIC, and so your VM remains invisible to network admins.

        3) Bridged. This implementation allows access to the host’s NIC, but unlike NAT, those communications go with the IP address of the guest VM. That is, the guest will occupy space on the corporate or ISP network. For this reason I do not use it.

        4) Internal network. I’ve never used this, but my understanding of the docs is that this only allows communication between VBox guest machines. Similar to host-only, except that it doesn’t even allow communication between the host and guest.

        As for the address of the DHCP adapter, what you see is correct. It will be assigned an address on the 10.x range. You can see the same thing on any *nix server you build with two NICs. The DHCP configuration will be assigned an address in the 10.x range. It is not a “fake” range for “home networks”. As far as tcp/ip goes, there is no such thing as a “home” network. However, there IS the concept of “private” (non-routable) networks, and the 10.x addresses are in the range reserved for this. See http://en.wikipedia.org/wiki/IP_address, particularly the section on “private networks”.

      • Ed,

        Thank you for your quick and EXCELLENT response! If you ever write a technical book, I want to be the first one to buy a copy.

        To clarify, I was asking about the VirtualBox Host-Only Adapter on the HOST Computer which is not accessed through the VirtualBox software. I noticed this was configured as NAT (DHCP) and must have been installed by the VirtualBox software setup.

        I welcome any other of your comments!

        Thanks again,

        Brandon

      • I’m not sure I know what you mean “VirtualBox Host-Only Adapter on the HOST Computer …is not accessed through the VirtualBox software”. It is created by the installation of VBox, and acts somewhat as an internal router for host-only communications within the VBox landscape. If you are talking about configuring it specifically, yes it is accessed via the VBox Manager. Look under “File -> Preferences –> Network, under the ‘host-only’ tab. There you set the ip address for adapter. You say you noticed it was configured as “NAT (DHCP)”. Exactly what were you looking at to make that determination?

      • When I look at the adapter setting on my host laptop for the VirtualBox Host-Only Network, the properties for the TCP/IPv4 is configured to obtain an IP Address automatically. I assume VirtualBox obtained this IP Address from my Router?

        As far as my last question, I’m trying to understand how VirtualBox can maintain the same IP Address we assigned to the Host-only Adapter when we setup the VM. I entered an IP Address within the subnet range of the IP Address VirtualBox assigned to the Host-Only Network on my host computer. If the router gets power cycled and the MAC Address/IP Address for the VM isn’t reserved in the Router setup, how does VirtualBox guarantee you’ll get the same IP Address you originally assigned?

        Thanks,

        Brandon

      • Brandon –

        I really don’t understand what you are looking at that you think the VirtualBox Host-Only Network adapter running on your host is getting its address from your router. If I look at that adapter in my host system’s Windows Control Panel (drilling down to the appropriate location) I see the following:

        Windows Nework Config of VBox hostonly adapter

        The fact is, that adapter process, by definition, cannot access the host’s NIC and so is invisible to your router. You can run your entire VBox network without the host even being attached to any outside network at all. I do it all the time. The adapter process on the host gets its ip address from the VBox manager. Open the VBox Manager, and from the menu select “File -> Preferences -> Network”.

        Vbox Manager Preferences Menu

        Select the “host-only networks” tab, then the “configure” icon.

        configure hostonly adapter

        And you will see where the ip address is set.

        hostonly adapter detail

      • Ed,

        First thank you for your detailed screenshots and especially your patience as I’m learning my VirtualBox configuration. I went through the same screens as you demonstrated and my TCP/IPv4 settings for my Host-Only Network is set to automatically obtain an IP Address. This is the adapter next to my Wireless Network Connection on my laptop running VirtualBox. I would attach a screenshot if I could.

        I guess the question is should I change the config to be the IP Address assigned? When I view the Host-only Network Details under File/Preferences, I get the IP Address which I thought it got from my router. This is the IP Address my Win7Pro Guest VM is using as a default gateway, but my Ubuntu Server install wouldn’t resolve when I used the same default gateway. I got it to work by deleting the gateway reference and just entered the Static IP Address and Netmask.

        I’m able to access Win7Pro and Ubuntu 14.04.1 Server via FTP and through the network. The question I ultimately have is this wrong even though it works?

        I’d be happy to send you my install screenshots if that would help answer questions.

        Thanks,

        Brandon

      • Ed,

        One last question. Is it necessary to reserve the IP Address and MAC Address of the subnet range that you assign to your VM in the Router? Does the Router need to reserve the IP Address so it remains associated with the VM if you have to reboot the Router?

        Thanks,

        Brandon

      • As for MAC address, you don’t “reserve” that at all. A MAC address is a hard, fixed address unique to each device on the network. It is like the fingerprint of the device itself. In physical devices, it is actually burned into a chip on the device. Obviously, for a virtual device, there are no chips, so it is assigned as a property of the software that is serving as the virtual implementation of the Network Interface Card (NIC). It is ultimately how the device identifies itself to the network and how the network differentiates one device from another. The MAC address is fixed and unvariable for a given device. When you get down to that level, the IP address is not really assigned to a computer, per se but rather it is assigned to a MAC address. For DHCP, what’s going on is the device goes live and says “hey, Mr. DHCP Server, here’s my MAC address, please assign me an IP address. In the case of fixed IP addresses, the OS is configured to assign the IP address to the MAC address, and broadcast it (the IP address) so the rest of the network knows. When installing Oracle Linux, when you get to the part about configuring your network adapters, it actually shows you the MAC address of the adapter you are configuring.

        Also, I don’t know what you mean by assigning anything to the “VM in the Router”. You assign a fixed IP address to either a host-only or an internal adapter (virtual NIC) and by definition neither of these are visible at all to your router. Your router never knows they are there, because they never even access the physical NIC on the host system.

  2. I think this is one of the best blog that i came across. Concept very nicely explained.Job well done. Just curious, would this whole network thing change due to the fact if RAC or ADG comes into picture ? I am assuming nothing would change , all we would need to do is assign diff. ip addresses on each node.. right ??

    • I don’t have any experience with RAC, but from what I understand you’d need to set up a 3d NIC, configured for host only. The basic principle is that you configure the first NIC as explained in the post so that your vm can get to the internet using your host OS as a proxy. But because that NIC has to be bound to a DHCP address, you need a hostonly adapter for your vm to have a fixed address required of a server. Any additional NICs required for RAC or anything else would also be configured hostonly.

    • I’m sorry, I don’t understand your question. There is no reference in my article to a “network configuration menu”, and every step is accompanied by a screenshot. The only confusion should be that you are installing RHL6, and my demo was with Oracle Linux 5. I’ve just been starting to play with OL 6 this week, and the dialogs during setup look a bit different from OL 5 but the principles are the same. I’ve never worked with any Linux other than Oracle. I know it is based on Red Hat, so I’m assuming the actual setup sequence and dialogs are the same.

  3. Hi Eddy,

    Hope you ‘ll be in the best of Health.
    I am really stuck up for the last week trying to sovle the network connectivity issue between Host And VIrtualBox which you ‘ve Identified & Resolved earlier.

    Desparately seeking you Invaluable inputs on the same Issue. Please help

    I am struggling with the VirtualBox connectivity with Host machine as last time when i resolved this Issue by disabling xen interface used by Virtualization guest and host OS’s(RHEL6)
    for network communication was enabled on both HOST & GUEST VM so once it was disbaled i.e
    virsh # net-list
    Name State Autostart
    —————————————–
    default active yes

    virsh # net-destroy default
    Network default destroyed

    The network connection between the Host and VirtualBox was establised. and It worked perfectly fine.

    But for some reasone i ‘d to delete that VirtualBox machine in order to get some free space as that machine size was 400GB.
    Now when I recreate that virtualBox with similar configuration except its size which is now 200GB. Installed the same OS that was installed earlier
    I am not able to established connectivity between Host And VirtualBox. VirtualBox configured with Host-only-Adapter.

    The Host IP configuration:
    root@ebs Desktop]# ifconfig
    eth0 Link encap:Ethernet HWaddr 00:1E:67:22:2D:6E
    inet addr:192.168.122.6 Bcast:192.168.122.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)
    Memory:d0100000-d0120000

    eth1 Link encap:Ethernet HWaddr 00:1E:67:22:2D:6F
    inet addr:192.168.122.3 Bcast:192.168.122.255 Mask:255.255.255.0
    inet6 addr: fe80::21e:67ff:fe22:2d6f/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:12343 errors:0 dropped:0 overruns:0 frame:0
    TX packets:12451 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:100
    RX bytes:10079134 (9.6 MiB) TX bytes:2473157 (2.3 MiB)
    Memory:d0000000-d0020000

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

    vboxnet0 Link encap:Ethernet HWaddr 0A:00:27:00:00:00
    inet addr:192.168.122.13 Bcast:192.168.122.255 Mask:255.255.255.0
    inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:146 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 b) TX bytes:20710 (20.2 KiB)

    THE VIRTUALBOX IP Configuration:

    [root@idmebs Desktop]# ifconfig
    eth0 Link encap:Ethernet HWaddr 08:00:27:47:43:66
    inet addr:192.168.122.10 Bcast:192.168.122.255 Mask:255.255.255.0
    inet6 addr: fe80::a00:27ff:fe47:4366/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:3 errors:0 dropped:0 overruns:0 frame:0
    TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:246 (246.0 b) TX bytes:5297 (5.1 KiB)

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

    I tried with AND Without disabling the xen enterface i .e
    virsh # net-destroy default

    on both Host machine and VIrtualBox. but when it didn’t work
    Than i remove yum groupremove “Virtualization” as well without any success.
    Also i tried this too rpm -ev libvirt* on both Host & VirtualBox and removed that libvirt* rpm as well.

    Followed this link http://www.cyberciti.biz/faq/rhel-fedora-centos-linux-remove-network-interface-virbr0/
    which you suggested earlier. ANd it was actually helped But NOT this time.

    Kindly suggest what i am missing here. as your suggestions are really of great Help.

    Thanks & Regards
    Priya

    • Well, first off, my name is “Ed”, not “Eddy”.

      You’ve shown me a lot of configuration information, but you haven’t given a real definition of the problem.

      Something like this is probably better solved on an open forum, like https://forums.oracle.com/forums/forum.jspa?forumID=822. There you will get a lot more eyeballs looking at it. When you post there, you need to specify (1) exactly what OS your Vbox guest is running, and (2) exactly what your problem is. From you posts here all I can tell is you seem to be running some form of Linux, and you are having some sort of difficulty with the network specification.

  4. Hi Ed Stevens,

    Extreemly Sorry for pronouncing your name incorrectly, as i somehow assumed its Eddy as saw it on Top of one of the Comments. so the wrong inferenced!

    I did mention the OS on both the host machine & VirtualBox is RHEL 6 in the post.

    Also i ‘ve posted query on https://forums.oracle.com/forums/forum.jspa?forumID=822. earlier and was directed to VIrtualBox forum of VMbox related Issues. and failed to get any
    response from there as well. that might sound unusual to you. but that’s case’e with me for the last week Beside if you remember i ‘ve posted the same Issue on your blog 6-7 week back
    and you ‘ve hinted of xen Interface being enabled and suggested this link http://www.cyberciti.biz/faq/rhel-fedora-centos-linux-remove-network-interface-virbr0/
    which ultimately solved the network connectivity Issue between Host & VirtualBox machine.

    The Issue is that after deleting the VirtualBox machine when i ‘ve recreated it. It is unable to esbtablished network connection to Host machine from VirtualBox even though the network
    configuration which was there in earlier VirtualBox remain the same. iptables & firewall on both the machine is disbaled and stoped as well. also the entires in /etc/hosts & /etc/resolv.conf
    of both machines is in sync and on same network subnet i.e 192.168.122.6 & 192.168.122.10 as well.

    I ‘ve posted the network configuration in the earlier post of both the machines.

    Can you suggest anything . Really appreciate.

    Thanks!!!
    Priya

  5. Hi Ed, A great article, I have noticed that your wifi adapter has a default gateway of 192.168.1.1, this is the same for my home wifi and everything works. However when I use the wifi at work which has a 10.x.x.x network I cannot ssh to my vm’s obviously because of the change to the network. What changes do you think I need to make and where? help much appreciated pulling my hair out trying to get this to work.

    • Do you get an error message?
      What IP addresses does your vm run on? What IP address are you specifying when you try to ssh to the vm?

      For my setup, the configuration (or lack of) for the wifi adapter on the host OS is totally irrelevant. If there is some connection between that and the DHCP address that is assigned to the NAT adapter on the vm, I’ve never really noticed, because I never address that adapter. I use the fixed IP that I assigned to the vm, over the hostonly adapter.

      One thing I’ve changed recently in my standard setup is that I don’t even run a NAT adapter on the vm once I have completed installing the packages for VBox Guest Additions and the Oracle validated. I need to post an update on that. If I’m building a vm for Windows, I only create one NIC and make it hostonly. If I’m creating a vm for Linux, I create the *first* NIC as hostonly (its default is NAT), and create the *second* NIC as NAT. Then, once I’ve installed the packages I need for Oracle, I remove the second NIC.

      • Hi Ed,

        This was an error on my part, re-configured from scratch and all is working well.

        I now have a 11gr2 2 node cluster running on virtualbox on my laptop, my plan is to conifgure another 2 nodes and setup dataguard.

        Thanks for the article!!!! it’s refreshing logging onto the server using putty!

  6. Hi Ed,

    I followed instructions on your blog and pretty much everything is working fine, except for 2 small things.

    1) I am not sure when this problem started appearing, but i get a feeling that it started happening either after upgrading to 2nd last update of Virtual box or may be due to some O/s patches. Currently when i put my laptop screen off which obviously puts my laptop to hyberante mode and when i start it back , if i take a new putty , it takes almost 15-20 seconds to bring prompt to enter user id. If i go inside virtual box and restart both eth0 n eth1 via network manager , and then again try to take connection via putty it works fine. Are you aware of this sort of a issue … i can get the connection , it’s those wait for 15-20 sec eveytime is painful.

    Somehow after hybernate it screws up everything.

    2) If i have a running putty connection and i put my laptop in hybernate by putting down laptop screen off , any existing active putty session becomes inactive if i start my laptop after few hours.. is this a know behavior in VM ?

    Here’s my O/S version & i am doing ssh

    Linux pr.localhosts.localdomain 2.6.32-400.29.1.el5uek #1 SMP Tue Jun 11 15:17:29 PDT 2013 i686 i686 i386 GNU/Linux

    Let me know if you need any additional information.

    -Neeraj

  7. Hi Ed,

    I had tried the suggestion you gave in but couldnt succeed to complete the steps.

    https://forums.oracle.com/thread/2557832

    i dont know if you got any mail when i commented on it few days back as the moderator close the discussion and removed my comments .

    Anyways the issue is –I dont know how to do this “bypassing the details of the full installation and focusing only on the network configuration done during the installation process.” which you posted in this bloc. ” How to do the installation as this is a vm virtualbox manager. I downloaded it from this link
    http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html

  8. Ed – thanks for the awesome blog. I could follow most part of it as my VM was on CentOS 6.5. My question is .. as long as I have just eth0 configured – guest VM to internet works fine but as soon as eth1 is configured… other connectivity from host to guest and guest to guest works but guest loses internet connectivity. ? Any idea ?

    Configured as below
    eth0 – NAT – DHCP
    eth1 – Host only Adapter – Static IP address with DNS

    • Offhand I’d guess there is some sort of collision between your configuration of eth0 and eth1.
      What do you see from ‘ifconfig’? Anything there look amiss?
      How about your config file? In /etc/sysconfig/network-scripts, look at ifcfg-eth0 and ifcfg-eth1. I realize you may not understand the full import of anything in those files, but sometimes a fishing expedition can turn up things that just don’t look ‘right’ … and lead to a solution.

      I’ve started configuring my sandboxes with eth0 assigned the hostonly, fixed address adapter and eth1 the NAT, DHCP. Here’s what my config files look like, if you want to compare. The ip address of my hostonly eth0 is 192.168.56.101

      [root@vblnxsrv01 network-scripts]# cat ifcfg-eth0
      DEVICE=eth0
      BOOTPROTO=static
      BROADCAST=192.168.56.255
      HWADDR=08:00:27:33:1F:EB
      IPADDR=192.168.56.101
      NETMASK=255.255.255.0
      NETWORK=192.168.56.0
      ONBOOT=yes
      [root@vblnxsrv01 network-scripts]# cat ifcfg-eth1
      DEVICE=eth1
      BOOTPROTO=dhcp
      HWADDR=08:00:27:00:9D:6A
      ONBOOT=yes
      DHCP_HOSTNAME=vblnxsrv01.vbdomain

  9. Pingback: A short guide to networking in Virtual Box with Oracle Linux inside. | Jobacle

  10. Your post is probably more awesome than I could possibly appreciate – I lost you very early in the piece but you solved an issue for me that for years of fooling around and reading all kinds of net, official instructiions and watching youtube videos. I have never been able to simply share folders, or have networking working (between host and guests) – the solution came by your suggestion to configure multiple network adaptors – this never occured to me before reading your post. Thank you – I doubt I will ever fully understand the big picture – I am really happy I have something that works – thank you for that.
    Cheers

    Peter

  11. Pingback: A short guide to networking in Virtual Box with Oracle Linux inside. | 懒得折腾

  12. Hi,

    Thanks, this is very informative. I have an issue with my VirtualBox, it is to do with the network (internet) settings. Everyday when i go back from work i have to go Device -> Network -> Network Settings, and disable then enable the Cable Connected option to allow all my VM’s to connect to the internet and the same applies when i get back to work the next day. what am i missing here. Is there a way so that i dont have to do this every single time i disconnect from a network and connect to another one or the same network.

    Thanks

    • Where are you seeing this “cable Connected” option? Is this something on your guest OS? What is the guest OS? I don’t find anything like a “Devices” menu option anywhere in the VBox manager or the VBox console of any of my vm’s.

  13. No its not on guest OS, Device options is available at the top of a running VM. Otherwise in the virtual box manager window you can go via Settings -> Network and in there you will find Cable Connected (tick box) under Adapter 1 tab (for me),

    • Ok, I see it now. Don’t know how I missed that page. Now that I see it I realize I’ve never really had reason to look at that particular option – the ‘cable connected’ box. Googling around I’ve not been able to come up with anything that looks like your problem at all.

      I did have a problem some time back with the ip address of the VBox adapter on the host changing whenever the host rebooted. It seems that was related to the version of VBox I was running at the time, and I haven’t seen that problem in quite some time. I don’t know if that could be related but I’d think not as I’ve upgraded VBox since, and you are a couple of point releases ahead of me at the moment.

      I’d suggest you sign up for an Oracle Technology Network account (free) and then post your question at either https://forums.virtualbox.org/index.php or https://community.oracle.com/community/server_%26_storage_systems/virtualization/virtualbox. One bit of information you’ll want to add when you post there is how the adapter is configured — NAT, hostonly, etc. If you find out anything, please let me know. I’m sorry I couldn’t be more help.

  14. No thats fine Ed, thanks for replying…. I have got another question just see if you know anything about it. Is it possible to connect my VM to another network to that of host. Eg: If host is connected to my work network X, could i somehow connect my guest VM to say a wifi network at my work?

  15. Hi,

    I am facing issue while configuring host-only adapter.
    I have installed Virtualbox and imported linux image.

    I have configured static IP address – 192.168.56.20

    ifconfig on virtual box shows following

    ifconfig
    enp0s17: flags=4163 mtu 1500
    inet 192.168.56.20 netmask 255.255.255.0 broadcast 192.168.56.255
    inet6 fe80::a00:27ff:fe90:18f3 prefixlen 64 scopeid 0x20
    ether 08:00:27:90:18:f3 txqueuelen 1000 (Ethernet)
    RX packets 77 bytes 9169 (8.9 KiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 54 bytes 7511 (7.3 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    lo: flags=73 mtu 65536
    inet 127.0.0.1 netmask 255.0.0.0
    inet6 ::1 prefixlen 128 scopeid 0x10
    loop txqueuelen 0 (Local Loopback)
    RX packets 4 bytes 340 (340.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 4 bytes 340 (340.0 B)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    But I am not able to SSH to this virtual box from my local Macbook laptop.

    Could you please tell me what is wrong ?

    Regards,

    Advait Deo

    • I’m sorry, but the phrase “I am not able to SSH to this virtual box from my local Macbook laptop.” doesn’t provide any useful information about the problem. Do you get any error messages at all? A timeout? From your host system, what do you get when you ping 192.168.56.20?

      BTW, please note that I am in the process of moving to a self-hosted site, at simply edstevensdba.com. Since this particular topic hasn’t yet been moved, we can discuss it here, but please also go to edstevensdba.com and sign up to follow me there.

  16. Sorry. I was not specific.
    I am able to ping 192.168.56.20 which is the IP address configured for my linux virtual host. But I am not able to SSH.

    When I try to SSH, it just hangs. It does not return prompt for 5 mins and after that when it displays the password prompt and I enter password, I get timeout error as shown below

    advaitd$ ssh oracle@192.168.56.20
    oracle@192.168.56.20‘s password:
    Connection closed by 192.168.56.20
    advaitd$

    Another thing that I found out was that if I turn off my wifi network and if my laptop is not connected to any network, I am able to SSH fine without any issues.

    This could be because when I am offline my /etc/resolv.conf is deleted automatically and when I enable wifi network, /etc/resolv.conf exists and has following entry

    #
    # Mac OS X Notice
    #
    # This file is not used by the host name and address resolution
    # or the DNS query routing mechanisms used by most processes on
    # this Mac OS X system.
    #
    # This file is automatically generated.
    #
    search
    nameserver 192.168.1.1

    Could you please suggest if anything wrong with my /etc/resolv.conf or any other setting ?

    • If ping works, but ssh doesn’t, then it could be a firewall issue. I believe ping uses a different protocol, and it almost certainly uses a different, which is probably left open by default on the vm’s firewall.

      Also, your description of the result when you try to ssh sounds a lot like what I first experienced when I started working with OL6 (as opposed to OL5). The fix was to not configure a default gateway for the guest interface. See the discussion I had about that on OTN for more detail, here.

      As for your host config, I’ve barely ever had my hands on a Mac. It is my understanding that the mac OS is really a variant of Linux. That said, I can’t imagine why disconnecting from or connecting to any external network would cause your resolve.conf file to be dropped/created. And the address shown is not the one that is used by default for the hostonly adapter.

      Suggestions:
      1 ) show me the result of ‘ifconfig’ command (or the mac equivalent) run on the host OS. I’m looking for the vbox host only adapter and its details.
      2) I’d suggest you take the question to the VirtuaBox forum space on Oracle Tecnology Network. There you’ll get more eyes on the problem and some guys there are better networking people than I. Just be sure to put on your ‘big boy pants’, as the best people there can also be pretty brusque. You’ll need to sign up for an OTN account, but it’s free, and that’s where you’ll find the best help with these types of questions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s