• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Virtualizing a LAN to test ClearOS hosted on 7 x64

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:
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
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.
 

Attachments

  • ClearOS_vmx_vmdk.zip
    6.2 KB · Views: 737
Last edited:

streetfighter 2

New Member
Joined
Jul 26, 2010
Messages
1,655 (0.32/day)
Location
Philly
Alright I've had a few minutes to look things over and there's just one improvement to the ClearOS VM vmx file I posted. I gave it 1024MB of RAM which is probably unnecessary for the vast majority of virtualized tests. I'd set it to 384MB which is what is recommended in the linked ClearOS install instructions.

I have achieved my entirely virtualized LAN setup and it's pretty cool. The hard part was configuring the host to connect through the ClearOS VM (which I detailed in my first post). All the LAN VMs can be configured in the same way:

1) Configure guest to use host-only ethernet mode
2) Boot guest
3) Manually enter IPv4 info so guest can connect to ClearOS VM.

Unfortunately there is a caveat to my method (other than taking up lots of RAM). Using the host-only ethernet mode causes VMware to create a virtual DHCP server which prevents automatic configuration of guest OS network settings with regard to the ClearOS VM. This, in turn, prevents leases from being created in the ClearOS VM. I'm trying to find a workaround for this.

I've also found ClearOS's network traffic report to be very slow in loading. Sometimes the network traffic report simply sits there loading for eternity. I'm hoping to figure out why and eventually fix it.

Here's a picture of Ubuntu VM, XP VM and the host (7 x64) all connected to the ClearOS VM (and amazingly I still have some RAM to spare!):

I censored pretty much anything that wasn't necessary to get the point across. Sorry if that bothers you. Also note that the ClearOS VM is named 5.1 Beta, but it's actually 5.2. I started with 5.1 and updated to 5.2 and forgot to rename the VM.

EDIT: I found a solution to the virtual DHCP issue! It's so obvious I wonder why I didn't think of it before.

Simply Start->Run->Services.msc then stop/disable the VMware DHCP Service. This means you only need to set the IPv4 settings for VMnet1 to "obtain automatically" in step 9. All other VM's then just need to be launched with "host-only" and they will automatically configure! No manually entering IP information!
 
Last edited:

W@f@

New Member
Joined
Dec 23, 2011
Messages
1 (0.00/day)
What are genius solution

I just wanted to thank you and offer you my salutation for the work you have done.

Please keep up the good work.

I wish to be able to remain in contact with you. If you allow.

Regards

Nazim
 
Joined
May 20, 2004
Messages
10,487 (1.40/day)
I would recommend playing with VMware server or Hyper-V server (both are free) and look into actual virtual networks. What you're doing now is just basic Windows networking.
Also, Vmware configures NICs just fine by default, it uses odd ranges to avoid oddities..
 

wolf29

New Member
Joined
Jan 20, 2012
Messages
1 (0.00/day)
Location
Atlanta GA
I know this is bumping an old thread

How many machines have you added to your entirely virtual lan?
I have installed clearOS on a vm within VMWare EXSi server. I set it up with 2 NICs and started off as a stand-alone machine, to get used to it.
I have no DHCP service running in my VM network, so when I make the ClearOS server a gateway, I will not use DHCP there either.
What's different with my set-up and yours seems minimal.
 
Top