I've been poking around with this for quite a while and can't get it working. I'm using Virtualbox and I'm having to linux VMs - let's call them VM1 and VM2. There is also a linux-host. The idea I want to achieve is to have something like this:

enter image description here

So there's this brilliant drawing of mine. So VM1 cannot have internet access. VM2 is connected with VM1 (they can ping each other) but also VM2 is connected (through bridge adapter I suppose) to Host which has actual internet access causing it that VM2 has internet access too. The main idea is to keep VM1 out of the internet whatsoever. Could you help me with that? I suppose it must be really simple but I've been trying for quite a long now and I can't really get it done.

What I've tried so far is to make bridge adapter between VM2 and Host, add host only adapter on VM1 and VM2 but I couldn't really get IP of VM1. Trying nmap through DHCP IPs on VM2 caused finding a lot of weird stuff but not an actual VM1.


You would have to create an Internal Network and assign IP addresses to both VMs in the same segment manually, or add a DHCP Server as documentations tells. If you don't add a gateway address to the interface connected to internal network, or do not enable forwarding in VM2, VM1 won't be able to reach internet. Same can be achieved by Host-only network, as if you don't enable forwarding and configure NAT and routing on the host, VMs won't be able to reach outside world. Only options that would provide connectivity to outside by default are Bridged and NAT.

For listing and editing IP Address within Linux machines, use iproute2's ip command.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.