How to make my VM connect to internet ?

Discussions related to using VirtualBox on Windows hosts.
Post Reply
liuyue15
Posts: 1
Joined: 3. Apr 2013, 04:33

How to make my VM connect to internet ?

Post by liuyue15 »

I install VirtualBox on my windows 7 home version PC, and I create a Linux 2.6 with CentOS 6.3.

I do the settings for network of VirtualBox Manager: VirtualBox Host-Only Ethernet Adapter as below

Adapter: IPv4 Address: 192.168.17.2
IPv4 Network Mask: 255.255.255.0

DHCP Server: Server Address: 192.168.17.226 (same as my windows 7 home host pc IP setting)
Server Mask: 255.255.255.0
Lower Address Bound: 192.168.17.101
Upper Address Bound: 192.168.17.254

And for my Linux VM network setting, I enable network adapter 1 and 2.

Adapter 1: attached to Bridged Adapter (Because my windows 7 laptop is using wireless connection to internet), Name (Intel(R) Centrino(R) Wireless-N 1030) (same as my windows 7 laptop wireless adapter), advanced: adapter Type - PCnet-FAST III (Am79C973), Promiscuous Mode: Deny, MAC Address: 080027523116, Cable connected check

Adapter 2: attached to Host-Only Adapter, name: virtualBox host-only Ethernet adapter, advanced: adapter type: intel PRO/1000 MT Desktop (82540EM), Promiscuous Mode: Deny, MAC Address: 0800279B4F25, Cable connected check

And from my windows 7 laptop network and sharing center, I found out another Unidentified network, VirtualBox Host-Only Network, so I click it go to its IPv4 properties to change its IP:
192.168.17.2, subnetmask: 255.255.255.0, Default gateway: 192.168.17.1, Preferred DNS server: 192.168.17.1

After all the above setting is done, I run my Linux VM, and type ifconfig, the IP for lo still show 127.0.0.1, how to check whether my VM can connect to internet use command ? Is my setting all correct ?
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: How to make my VM connect to internet ?

Post by noteirak »

Two issues here :

1. Bridging over Wireless is never guaranteed to work due to the technical possible limiation of your wireless Access Point. Any traffic originating from your VM would then be discarded by the access point.
2. Host-Only is not made to be configured the way you do it. It is normal for Host-Only NIC on the host to not have a gateway or the likes, it is not meant to be the same network as your LAN.
Also, the network on the Host-Only must be different from your real LAN. Manually configurnig the interface is for people with advanced knowledge in networking.

What I would suggest for you is to only have a single NIC on your VM set to NAT. This will give you internet access, if you only require basic access to your LAN & Internet.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply