Linux - Virtualization and CloudThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.