Hi!
I actually have a few issues, not just one, so I'll start with the beginning.
Using Windows 8.1 as host, CentOS 6.5 netinstall i386 as guests.
So, what I want to do is have a VM, let's call it VM1, with 4 Adapters - one that gives it Internet Access, and 3 other Internal Adapters, that other 3 VMs (VM2, VM3, VM4) will use for connecting to the Internet, through VM1.
So for VM1, the first adapter I set it Bridged Adapter. All was good, it had connection. This was while using another CentOS as host. When I tried to copy the VM structures to my Windows Laptop, Bridged Adapter does not work, in the sense that the VM doesn't connect to the network. It sees my Intel(R) Ethernet Connection I218-V and I can select it, but it just doesn't give my VM an IP. Whatever, I switched to NAT and it works, but I'm not sure if this impacts what I need to do.
The other three adapters have the name intnet1, intnet2, intnet3.
To simplify the problem, let's just assume I only want ONE VM (VM2) to connect through VM1 (because if I sort this out, the other 2 will be easier to do).
on VM2 I also set the adapter to be Internal Network, and the name is intnet1.
Now, in /etc/sysconfig/network-scripts, I didn't modify ifcfg-eth0 (as it's working), but maybe I should.
I've attached some screenshots with how ifcfg-eth1 looks in VM1 (), how ifcfg-eth1 looks in VM2 () (I named it that way and in /etc/udev/rules.d70-persistent-net.rules eth1 has the right MAC address).
SS with ifconfig from VM1:
Oh, also checked all the MACs, they are fine, the same as seen in the VirtualBox Settings for each VM.
The thing is, the two VMs don't find each other when I try to ping them using the ip I added as static.
What am I doing wrong, any idea? I appreciate any kind of feedback or suggestion. Or maybe there is a tutorial out there, somewhere, I just couldn't find it.
I need to use this configuration (with internal adapters between them).
Connect 3 VMs to internet through another VM (CentOS)
-
socratis
- Site Moderator
- Posts: 27329
- Joined: 22. Oct 2010, 11:03
- Primary OS: Mac OS X other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Win(*>98), Linux*, OSX>10.5
- Location: Greece
Re: Connect 3 VMs to internet through another VM (CentOS)
This seems like a "Linux Guests" question, so I'll move it from "Windows Hosts". You'll find more Linux experts there.
I can say this about the Bridged connection though. From a quick search it seems like a wired connection. If it was wireless, it could be a problem between NIC and WiFi router, but not with wired. So, I'd check if there is a restriction in the router about MAC addresses allowed or not.
Wait a minute... I just noticed it. Did you give your internal network a 10.0.2.0/24 range? That's "reserved" for the NAT address scheme in VirtualBox, maybe that's why things are not working. Try with something like 10.1.0.0/24 and see if it works.
I can say this about the Bridged connection though. From a quick search it seems like a wired connection. If it was wireless, it could be a problem between NIC and WiFi router, but not with wired. So, I'd check if there is a restriction in the router about MAC addresses allowed or not.
Wait a minute... I just noticed it. Did you give your internal network a 10.0.2.0/24 range? That's "reserved" for the NAT address scheme in VirtualBox, maybe that's why things are not working. Try with something like 10.1.0.0/24 and see if it works.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: Connect 3 VMs to internet through another VM (CentOS)
Why? You realise this will make the serving guest to have three aditional networks in three separate schemes, right?The other three adapters have the name intnet1, intnet2, intnet3.
Re: Connect 3 VMs to internet through another VM (CentOS)
Yes, I realize that's what means to have 3 intnets. I didn't make the rules, this "schema" with its restrictions were given to me.
This is a "whole semester" assignment for a course I take.
Why I ask here instead of waiting for the professor to "teach" us? Because he doesn't really teach us anything, plus he said that 80% of this will be our own "digging" at home...
We spent the last class learning about CTRL Z and 'man' and how to edit and save a file with Vi, because some of my colleagues have no idea how to use Linux (like...not even the basics) and, apparently, they can't even google that basic stuff. Whatever, enough with the complaining.
@socratis - thank you for the move.
Yes, it's a cable connection. And yes, it might be a problem because I'm actually at work, using the company's network, and this might be the restriction. I'll try it at home today/tomorrow.
Tried with the 10.1.0.0/24 IPs, but still not pinging between them.
This is a "whole semester" assignment for a course I take.
Why I ask here instead of waiting for the professor to "teach" us? Because he doesn't really teach us anything, plus he said that 80% of this will be our own "digging" at home...
We spent the last class learning about CTRL Z and 'man' and how to edit and save a file with Vi, because some of my colleagues have no idea how to use Linux (like...not even the basics) and, apparently, they can't even google that basic stuff. Whatever, enough with the complaining.
@socratis - thank you for the move.
Yes, it's a cable connection. And yes, it might be a problem because I'm actually at work, using the company's network, and this might be the restriction. I'll try it at home today/tomorrow.
Tried with the 10.1.0.0/24 IPs, but still not pinging between them.
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: Connect 3 VMs to internet through another VM (CentOS)
Are you sure you understood the assignment?
To me this sounds like a standard "network 4 PCs together, have one of them act as Internet gateway" problem. The ideal solution would not involve the gateway PC having 3 or more network cards. It would involve each PC having one network card, with the PCs connected together by multidropping the LAN cable, or using a router/modem in star formation.
To me this sounds like a standard "network 4 PCs together, have one of them act as Internet gateway" problem. The ideal solution would not involve the gateway PC having 3 or more network cards. It would involve each PC having one network card, with the PCs connected together by multidropping the LAN cable, or using a router/modem in star formation.
Re: Connect 3 VMs to internet through another VM (CentOS)
He specifically made us this schema
Plus, the part where we named and set the Adapters (in each VMs settings, whilst they are turned off) was done following the professor's exact instructions. He was doing the same thing on his laptop, while projecting his screen so that we follow the exact steps. So yes, this is what he wants, 3 internal networks, one for each of the 3 VMs.
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: Connect 3 VMs to internet through another VM (CentOS)
What you are attempting surely can be achieved. The issue you are facing is a configuration issue of VM1 and not VirtualBox. You need to setup your iptables to perform forwarding/routing properly, which is the hard part and why I asked my original question. By using IntNet you actually have 3 separate virtual switches all connected to the same lan segment and since you are forced to use different schemes you need to learn how to use iptables, and properly setup the guests to use various gateways, Etc..
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: Connect 3 VMs to internet through another VM (CentOS)
Hmm. Now I'm wondering if the Professor understood the assignment. I can't imagine the circumstances in which having 4 network cards in one PC, with attendant packet copying between networks, would be preferable to just multidropping the Ethernet cable. Still, I guess the awkward design makes for a greater config challenge, which may be his point.
Re: Connect 3 VMs to internet through another VM (CentOS)
OK Guys, so I figured it out, thanks to some hints from the prof:
need to use subnets.
So basically, configuring it like this (this is for the 3rd subnet, in the first VM): In the last VM, on the other side, the IPADDR would be something between .130 and .191
For the first subnet it's up to .63 and for the second up to .128
Calculating this easier is by doing ipcalc x.x.x.x/26 -bnm
Of course, it's not necessarily /26, but this allows up to 4 subnets. /25 would allow only 2.
Now I need to transform the first connection, the eth0 in the first VM (the one that has Internet access) into a router, so it allows internet in the 3 subnets.
need to use subnets.
So basically, configuring it like this (this is for the 3rd subnet, in the first VM): In the last VM, on the other side, the IPADDR would be something between .130 and .191
For the first subnet it's up to .63 and for the second up to .128
Calculating this easier is by doing ipcalc x.x.x.x/26 -bnm
Of course, it's not necessarily /26, but this allows up to 4 subnets. /25 would allow only 2.
Now I need to transform the first connection, the eth0 in the first VM (the one that has Internet access) into a router, so it allows internet in the 3 subnets.