streetfighter 2
New Member
- Joined
- Jul 26, 2010
- Messages
- 1,655 (0.32/day)
- Location
- Philly
I recently got into virtualization, something I haven't been able to experiment with until quite recently because I lacked the CPU horsepower (not to mention VT-x/AMD-V). After virtualizing every OS I own in VMware I started looking for new systems to run and I eventually found something that peaked my interest: ClearOS.
I do have the ability to set up a dedicated ClearOS box and slap it down as the gateway for my entire LAN, but I don't want to do that for several reasons. First and foremost is I haven't tested it at all. (I can't think of any other reasons that aren't just restatements of the first reason.)
So I thought it would make a lot of sense to virtualize ClearOS and run the hosts internet (and other VMs internet) through it so I could test it without having to run risky experiments on my entire LAN. To give you an idea of what I'm talking about have a look at this here fancy-pants diagram I made with a Crayola (and partly stolen from here):
Essentially I want to virtualize an entire LAN in order to test ClearOS.
So far I've accomplished getting the hosts internet to run through the guest OS (ClearOS) in VMware. Now for an explanation of how I did it in case anyone else wants to do it for lack of anything better to do.
Requirements:
-A beefy computer preferably multi-core with virtualization ability and a decent chunk of ram
-One or more NICs connected to the interwebs (directly or not)
-VMware Player (it's free)
-ClearOS Enterprise 5.2 (it's free)
-Windows 7 32/64 (it's not free)
-VMware configuration file (.vmx) for ClearOS. (free if you use my attachment or make your own)
-A virtual disk (.vmdk) to install on (free if you download my attachment.) Alternatively you can use qemu-img.exe and type:
Instructions:
1) Ask yourself why you're reading this instead of jumping out of an airplane to fight a forest fire and kill Nazis.
2) Get VMware Player 3.1.X and install it. It's free but you have to fill out a registration thingy dealie or some such.
3) Get ClearOS Enterprise 5.2 iso.
4) Open VMware player and load your ClearOS vmx. Make sure the ClearOS iso is loaded and set as the first boot item. Set the first NIC as bridged and the second NIC as host-only. Your configurations should look similar to this:
5) Then start up the VM and install ClearOS. Select as many packages as you want so you can test them later without having to reinstall. (If you have installation questions consult these instructions.)
6) Once you're done installing ClearOS in the VM you'll want to unmount the ClearOS iso otherwise it'll autoload every time you start up the VM. Login as 'root' with whatever password you picked during setup.
7) Chances are you're probably already on a DHCP network so you'll want to configure the VM's two NICs like so:
You can see that my router is at 192.168.1.1 and the IP assigned to ClearOS by the router's DHCP service is 192.168.1.3. The ClearOS VM LAN IP is 192.168.2.1. Consequently anything external to ClearOS is going to have a 192.168.1.X address whereas anything internal is going to have a 192.168.2.X address. I did this to resolve any address disputes and it may be different for you on your setup.
8) The last thing you need to do is configure your network adapters in Windows. You can begin by Start->Run->"ncpa.cpl". Once in the Network Connections window you can safely disable all VMware network adapters except "VMware Network Adapter VMnet1".
9) Right-click "VMware Network Adapter VMnet1" and go to Properties. Click on "Internet Protocol Version 4 (TCP/IPv4)" and click the Properties button. You'll notice that VMware has configured this adapter for you. You may also notice that VMware is going to auomatically configure it wrong for you every single time that you start VMware (and it's going to get annoying). Unfortunately there is nothing you can do about that so just remember to change it every time you close and reopen VMware.
Notice how the last digits of the IP are >100. That's because by default ClearOS starts assigning IPs over 100 so it'd be wise to do the same unless you've modified this setting in ClearOS. Your gateway and DNS servers are, of course, the LAN IP of ClearOS (192.168.2.1 in my case). Subnet mask is obviously 255.255.255.0. Once you're happy with the settings hit Ok until you're back to the Network Connections folder.
10) If all goes well the status of "VMware Network Adapter VMnet1", which can be found by double-clicking on it, has internet access on IPv4. (If it doesn't you can assign it a static lease which I'll explain in a second.) Now the only thing left to do is make sure that Windows uses that adapter for the internets as opposed to your physical adapter that it's currently using. First double click your physical adapter (which is probably named "Local Area Connection") so you get the physical adapter's status window and then click the "Details..." button. Move the window aside because you'll be needing to copy the IP out of it in a second. Go back to the Network Connections window and right-click your physical adapter and go to Properties. Click on "Internet Protocol Version 4 (TCP/IPv4)" and click the Properties button. Set it to "Use the following" and then enter the IP and subnet mask you got from the adapters status window. Leave Gateway and DNS blank. It should look something like this:
You may notice that my physical adapter's status->details... window is missing some information. That's because when I wrote this I had already configured it and it's still valid in this writeup.
11) By removing the Gateway IP in step 10 you've forced Windows to think that the physical adapter cannot connect to the internet so it defaults to VMnet1 which you configured in step 9. The only thing left to do now is mess around with ClearOS and see how well it performs now that you have a fairly isolated test environment. My next step will be to get additional VMs running on the ClearOS VM LAN. I'll update this when I get that going.
Try opening a command prompt on the host and typing "tracert www.google.com". If everything is working right the first two hops should look something like this (unless you're not using a conventional router in which case only the first hop should match):
You can also check traffic and status outputs of ClearOS to see how well it's all functioning.
If you didn't get IPv4 on VMnet1 when you completed step 9 you can try adding a static lease for the VMnet1 adapter. Open the VMnet1 status window in the Network Connections folder and click "Details...". Then go into the ClearOS VM and in "Network>Settings>DHCP Server" add a Static Lease with the IP and MAC from the status window you have open.
If you want to undo what you did it's really very simple. Just go into your physical adapter's Properties window and change everything back the way it was and shutdown the ClearOS VM. Done.
NOTE: Once you've set everything up any connections made to an external IP from your host machine will go through your virtual adapter VMnet1. Any connections made to an IP that is in your regular LAN will go through your physical adapter. This is because access to your LAN does not require a gateway IP address for your physical adapter.
I do have the ability to set up a dedicated ClearOS box and slap it down as the gateway for my entire LAN, but I don't want to do that for several reasons. First and foremost is I haven't tested it at all. (I can't think of any other reasons that aren't just restatements of the first reason.)
So I thought it would make a lot of sense to virtualize ClearOS and run the hosts internet (and other VMs internet) through it so I could test it without having to run risky experiments on my entire LAN. To give you an idea of what I'm talking about have a look at this here fancy-pants diagram I made with a Crayola (and partly stolen from here):
Essentially I want to virtualize an entire LAN in order to test ClearOS.
So far I've accomplished getting the hosts internet to run through the guest OS (ClearOS) in VMware. Now for an explanation of how I did it in case anyone else wants to do it for lack of anything better to do.
Requirements:
-A beefy computer preferably multi-core with virtualization ability and a decent chunk of ram
-One or more NICs connected to the interwebs (directly or not)
-VMware Player (it's free)
-ClearOS Enterprise 5.2 (it's free)
-Windows 7 32/64 (it's not free)
-VMware configuration file (.vmx) for ClearOS. (free if you use my attachment or make your own)
-A virtual disk (.vmdk) to install on (free if you download my attachment.) Alternatively you can use qemu-img.exe and type:
Code:
qemu-img.exe create -f vmdk ClearOS.vmdk 20G
Instructions:
1) Ask yourself why you're reading this instead of jumping out of an airplane to fight a forest fire and kill Nazis.
2) Get VMware Player 3.1.X and install it. It's free but you have to fill out a registration thingy dealie or some such.
3) Get ClearOS Enterprise 5.2 iso.
4) Open VMware player and load your ClearOS vmx. Make sure the ClearOS iso is loaded and set as the first boot item. Set the first NIC as bridged and the second NIC as host-only. Your configurations should look similar to this:
5) Then start up the VM and install ClearOS. Select as many packages as you want so you can test them later without having to reinstall. (If you have installation questions consult these instructions.)
6) Once you're done installing ClearOS in the VM you'll want to unmount the ClearOS iso otherwise it'll autoload every time you start up the VM. Login as 'root' with whatever password you picked during setup.
7) Chances are you're probably already on a DHCP network so you'll want to configure the VM's two NICs like so:
You can see that my router is at 192.168.1.1 and the IP assigned to ClearOS by the router's DHCP service is 192.168.1.3. The ClearOS VM LAN IP is 192.168.2.1. Consequently anything external to ClearOS is going to have a 192.168.1.X address whereas anything internal is going to have a 192.168.2.X address. I did this to resolve any address disputes and it may be different for you on your setup.
8) The last thing you need to do is configure your network adapters in Windows. You can begin by Start->Run->"ncpa.cpl". Once in the Network Connections window you can safely disable all VMware network adapters except "VMware Network Adapter VMnet1".
9) Right-click "VMware Network Adapter VMnet1" and go to Properties. Click on "Internet Protocol Version 4 (TCP/IPv4)" and click the Properties button. You'll notice that VMware has configured this adapter for you. You may also notice that VMware is going to auomatically configure it wrong for you every single time that you start VMware (and it's going to get annoying). Unfortunately there is nothing you can do about that so just remember to change it every time you close and reopen VMware.
Notice how the last digits of the IP are >100. That's because by default ClearOS starts assigning IPs over 100 so it'd be wise to do the same unless you've modified this setting in ClearOS. Your gateway and DNS servers are, of course, the LAN IP of ClearOS (192.168.2.1 in my case). Subnet mask is obviously 255.255.255.0. Once you're happy with the settings hit Ok until you're back to the Network Connections folder.
10) If all goes well the status of "VMware Network Adapter VMnet1", which can be found by double-clicking on it, has internet access on IPv4. (If it doesn't you can assign it a static lease which I'll explain in a second.) Now the only thing left to do is make sure that Windows uses that adapter for the internets as opposed to your physical adapter that it's currently using. First double click your physical adapter (which is probably named "Local Area Connection") so you get the physical adapter's status window and then click the "Details..." button. Move the window aside because you'll be needing to copy the IP out of it in a second. Go back to the Network Connections window and right-click your physical adapter and go to Properties. Click on "Internet Protocol Version 4 (TCP/IPv4)" and click the Properties button. Set it to "Use the following" and then enter the IP and subnet mask you got from the adapters status window. Leave Gateway and DNS blank. It should look something like this:
You may notice that my physical adapter's status->details... window is missing some information. That's because when I wrote this I had already configured it and it's still valid in this writeup.
11) By removing the Gateway IP in step 10 you've forced Windows to think that the physical adapter cannot connect to the internet so it defaults to VMnet1 which you configured in step 9. The only thing left to do now is mess around with ClearOS and see how well it performs now that you have a fairly isolated test environment. My next step will be to get additional VMs running on the ClearOS VM LAN. I'll update this when I get that going.
Try opening a command prompt on the host and typing "tracert www.google.com". If everything is working right the first two hops should look something like this (unless you're not using a conventional router in which case only the first hop should match):
Code:
1 <1 ms <1 ms <1 ms generic.host [192.168.2.1]
2 <1 ms <1 ms <1 ms 192.168.1.1
If you didn't get IPv4 on VMnet1 when you completed step 9 you can try adding a static lease for the VMnet1 adapter. Open the VMnet1 status window in the Network Connections folder and click "Details...". Then go into the ClearOS VM and in "Network>Settings>DHCP Server" add a Static Lease with the IP and MAC from the status window you have open.
If you want to undo what you did it's really very simple. Just go into your physical adapter's Properties window and change everything back the way it was and shutdown the ClearOS VM. Done.
NOTE: Once you've set everything up any connections made to an external IP from your host machine will go through your virtual adapter VMnet1. Any connections made to an IP that is in your regular LAN will go through your physical adapter. This is because access to your LAN does not require a gateway IP address for your physical adapter.
Attachments
Last edited: