Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
There are two Debian VMs in my Oracle VM Virtual Box.
I would like to set up a network in order to make them "pingable" among themselves. Webpages such as google.com should be "pingable" too.
How do I have to set up the network environment?
I have tried to bridge the wifi and the VirtualBox Host-Only Ethernet Adapter. ping google.com delivers a unknown host and ping vm delivers a Destination Host Unreachable.
I don't have a Debian insstall handy, but am guessing the screenshots are from the network config inside the VMs? If so, why is the bridge required - why not just configure the IPs directly onto the "wired" (virtual ethernet) interfaces?
What does the VirtualBox network settings look like? There are various network modes (see https://www.virtualbox.org/manual/ch06.html). The default is NAT, but what you probably want is Bridged networking. This will bridge the adapter in the VM to an adapter in the guest OS, and allow access to other VMs as well as the outside world. NAT, on the other hand, allows access to the outside, but not to other VMs.
One problem with your config might be the IP addresses. The two VMs seem to be on different subnets. Unless you have specific routing table entries to deal with this, they would not know how to reach each other, and will try to route traffic out onto the internet instead if only a default gateway is configured. Assuming you have an external DHCP server running (likely on your router), in Bridged mode the VMs should pick up IPs and other settings (gateway, DNS) from there, and end up on the same subnet as the host, which will solve your routing problem as well as the DNS problem which is most likely causing the "unknown host" error.
your bridge cannot be connecting properly. this is a photo of VirtualBox and my client pinging to google with bridge connection to my wifi on my laptop.
Make sure you are selecting the proper connection to your box. I don't know if you did or not. But it usually defaults to the right one.
There is another showing Solaris 11.3 pining my Void Linux, they both are VM clients.
if you have a wifi and a Network card installed. it maybe choosing the wrong one, and like @cliffordw said your Default route for both clients are different.
your VM setup for bridge looks different then mine too. what up with that?
what version are you running? Just wondering. Mine is ver 5.
You're a little vague on details. I'll make some assumptions, though, namely:
1. The networks in VirtualBox are set up to allow this traffic flow, and
2. VM C has a route to the destination (internet??)
3. There's no firewall rules on VM C that will block the traffic
The IP config on VMs A and B seems fine.
On VM C, if you want to route only between these VMs, you need to enable IP forwarding ("echo 1 > /proc/sys/net/ipv4/conf/all/forwarding"). If you want to route to other subnets or to public IP addresses (the internet) via VM C, you will need to either run NAT on that VM, or ensure your router knows the route back to the source addresses (on VM A & B).
I agree not information on how you want your VMs configured. What operating systems are running on the VMs?
It looks like VM A network is configured as a bridge instead of host only and your host only network for VM b and c is not on the same subnet (172.20.20. and 172.20.30.).
You also need to add firewall rules for VM c to be a NAT for the other two.
how do I set up two vms as hosts and one vm as a router
then go to youtube and paste that into the search bar, I got numerous hits on how tos
that might help you out, so you can see what they are doing as well.
Do you want your virtual machines to be able to talk to one another and the host machine but not other machines on the network? Are you running a lab environment where you want students to be able to set up servers or small networks. If so, the host-only adapter for Oracle VM VirtualBox may be your answer. This video from Tutorial Techie explains the host-only adapter in Oracle VM Virtual Box and how to set one up.
Okay, so I have added a second adapter.
I can ping vm1 to vm3 and vice versa.
I am not able to ping vm2 and vm3 and vice versa.
In both directions I get a DHU.
I have activated both Ethernet Connection 1 and 2.
The screenshots are as follows:
vm1 = debian1
vm2 = debian2
vm3 settings for vm1 = debian31
vm3 settings for vm2 = debian32
That is an alias not a second adapter. I've never tried using an alias with a virtual adapter yet. The two adapters on vm3 are on the same subnet and vm1 and vm 2 are still on different subnets.
How are the network adapters configured in virtualbox manager? bridged, NAT, etc.
Lets clarify your requirements again. To be pingable among themselves and still ping the outside world can be configured in several ways. Each VM has two virtual adapters i.e 1 as NAT and 2 as host only.
With VM 3 as a router mode so it has 2 virtual adpaters with vm 1 as bridged and vm 2 as host only. The other two as host only. You then configure VM 3's firewall to forward from host only port to bridged.
Lets try the first option. Go back and configure the VMs for DHCP. Configure the two virtual adapters in VBox manager as NAT and host only.
How is, or why is your gateways all becoming different? that is what I remember seeing .. and is causing the problem. Even though you say you've changed them. Hum..
If I get some time .. I'll try to set up the same thing in my VBox with completely different Linux OS's and maybe try to use my Solaris I already have installed on it.
but you are using Debian for everyone of them yes?
So Maybe I'll use (cough,cough) Debian for everything and toss in Solairs for good measure.
then if I go to that link you provide and use that then see what I see. then post back (if I get time to do this) I will.
what is your two Debian and Oracle VM Virtual Box Versions for each SO I can try to imitate everything you have. my Hardware should not matter because the others are being simulated via VBox (VM). My VM version is 5.x. the kernel ver should not matter either. so that is a no big deal.
just versions of Debain and VM you are using so I can download the Debain iso's
I only have wifi at my disposal so that may be a hindrance.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.