PCLinuxOS-Forums
News: ...FLASH!!! ...New PCLinuxOS Testing board now open. Register today! Be an active contributor to the PCLinuxOS future! ... Read all about it now, on THIS forum!!!..
 
*
Welcome, Guest. Please login or register. May 27, 2012, 06:53:27 PM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: Internet connection for VirtualBox guest OS  (Read 897 times)
David_J_D
Jr. Member
**
Offline Offline

Posts: 37


« on: October 19, 2011, 02:00:42 PM »

I'll shortly be running a small virtual network as part of my degree course.  How do I give internet access to the virtual network in Virtual Box?
Logged
pags
Hero Member
*****
Offline Offline

Posts: 1951


Keep it clean.


« Reply #1 on: October 19, 2011, 03:08:56 PM »

I think you'll need one of your VMs to be dual-homed (setup with two virtual NICs).  One of them should be connected to the Internal (virtual) network.  the other should be either NAT or Bridged Adapter.  Then, that dual-homed node will need to be setup as a router.
Logged
GermanTux
Hero Member
*****
Offline Offline

Posts: 576



« Reply #2 on: October 20, 2011, 06:38:30 AM »

While Pags solution does work, it should be noted that Virtualbox, or even VMWare enterprise, really cannot do "virtual networks"  You can attach your VM's to internal only networks, but these cannot be routed at all. 
Logged

I like sleep.
menotu
PCLinuxOS Tester
Super Villain
*******
Offline Offline

Posts: 11992

┌∩┐(◕_◕)┌∩┐


« Reply #3 on: October 20, 2011, 06:52:57 AM »

The following gives some useful info on VBox networks etc.........

http://www.virtualbox.org/manual/ch06.html
Logged

If you can keep you head while all around you are losing theirs, then you have misunderstood the situation.

PCLinuxOS 32bit & 64bit; 3.2.17bfs kernel, KDE 4.8.3; nvidia 295.53, Athlon 64 X2 4200+; 4GB Ram; NVidia GeForce 8400GS 1GB; x.org 1.10.4 ; 500GB/320GB
kjpetrie
PCLinuxOS Tester
Hero Member
*******
Offline Offline

Posts: 3133


« Reply #4 on: October 20, 2011, 08:24:30 AM »

If you mean allowing incoming connections to the VM, yes, it can be done. First you will need to set your router to forward the appropriate port to the host machine (logically it's first, but for security reasons you should do this second to protect your host). Secondly (but do it first) you need to set the VM to use bridged networking and configure its OS to use a static IP and then use IPtables to forward all incoming connections on the port to the guest and all related outgoing to the host's internet connection.

There are lots of options for bridged networking, ranging from a direct connection to the host's internet connection (I wouldn't recommend that, though I did once use it to flash my router firmware from a Windows VM!)) to downloading bridge-utils and tunctl and creating a completely self-contained virtual network inside the host's kernel tun/tap device, to which only the desired traffic can be forwarded, before being forwarded on to the host (this is what I use).

There really is no substitute for reading up on IPtables, networking, Virtualbox networking options and the kernel's tun/tap interface. Enjoy learning all about it!
Logged

-----------
KJP
-----------------------------------------------------------
PClos 2010 on Intel D945GCLF2 motherboard (Atom 330), 2GB DDR2 RAM, Maxtor STM325031, Hitachi CDR-7930, ‎HL-DT-ST DVDRAM GSA-H42N, Amilo LSL 3220T monitor. Also Acer 5810TG and Asus eeePC 2G surf
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM