LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 03-16-2011, 02:08 PM   #1
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Partially Sandboxing a Virtual Machine


What is the simplest way to deny a virtual machine access to the internet, that is, outside a LAN subnet?

I'm guessing this has been covered previously, but I found no obvious threads.

I'd like to isolate a virtual machine from the internet but not a local network. I'm using VirtualBox and the Host Interface mode to allow access to the LAN.

IP addresses are static.

Unless I'm missing the big picture, Internal mode would not succeed as that mode is internal to the virtual machines and excludes the actual physical LAN.

From what I have read, perhaps a iptables firewall rule on the host machine will suffice, but I haven't found a good example of that.

I get the idea that another possibility is to block access at the router, which is a Linksys WRT54GL 1.1 with DD-WRT, but I don't know how to do that.

Thanks much.
 
Old 03-16-2011, 02:12 PM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Code:
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT	
iptables -A INPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -d 192.168.0.0/16 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -j DROP
This will allow anyone to get to it. But, it will not be able to get to anything else except the 192.168.0/26 network.
 
Old 03-16-2011, 03:15 PM   #3
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Quote:
This will allow anyone to get to it. But, it will not be able to get to anything else except the 192.168.0/26 network.
Are these rules for the host machine?

My host is a Linux based system, but the VMs might be other OSs too.
 
Old 03-16-2011, 04:14 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
don't put a gateway address in the VM and set it to bridged.
 
Old 03-17-2011, 03:21 PM   #5
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Thanks for the suggestions. Hopefully I remember to update this thread with my final solution.
 
Old 04-06-2011, 05:23 AM   #6
beowulfnode
Member
 
Registered: Jun 2007
Distribution: debian, ubuntu, centos, esxi
Posts: 39

Rep: Reputation: 4
Quote:
Originally Posted by jefro View Post
don't put a gateway address in the VM and set it to bridged.
for preventing the VM from accessing the net I agree with this.

For preventing the net from sending packets to the VM you shouldn't need to do anything, unless the VM is on the same IP as a former server and you haven't removed the firewall/NAT port forwarding to that IP yet.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pwn2Own 2011 and general questions/ Sandboxing rico001 Linux - Security 2 03-14-2011 04:42 AM
Is it possible to create a virtual LAN on my machine using virtual box or MS virtula nhammoud Linux - Networking 1 01-27-2011 03:49 PM
unable to auto mount 'shared folder' iin Suse 11.2 virtual machine using Virtual Box marvinudy Linux - Virtualization and Cloud 1 02-03-2010 02:29 PM
How to configure the serial port of my virtual machine with host machine. akram Linux - Newbie 4 07-31-2009 10:39 PM
Running virtual pc files in a virtual machine in linux ... preferably virtual box biharibong Linux - Software 4 01-21-2009 01:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 04:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration