Have you ever wanted a mobile SharePoint platform, but couldn’t afford Azure or other “cloud” platforms, yet could afford a 32GB laptop with a secondary SSD drive for Hyper-V? Then this post is for you! As you know SharePoint 2013 requires as a Domain Controller. What does a Domain Controller require? A static IP address, of course! But what if you have a laptop, are mobile, and need to allow your SharePoint (or other servers) on Hyper-V to reach the Internet, such as to reach the public SharePoint App catalog? In order to have a static IP address, the solution is to use an Internal Virtual Switch, but in order to have Internet access, you need an External Virtual Switch. So how does one go about reconciling these needs? Linux! So I’ll admit it. I’ve been using Slackware since 1997, and RedHat from roughly around that time. I used Gentoo briefly, and now use CentOS exclusively for my Linux needs. If it can do one thing well here, it can make a great proxy/firewall device for us to use within Hyper-V to route traffic. Here is what you’ll need. Create two vSwitches in Hyper-V. An External vSwitch and Internal vSwitch. Attach your Windows Servers to the Internal vSwitch and assign them to the [crayon-53aa109c8b5dc292265556-i/] network (or any other internal network of your choosing — it is best to not conflict with any other non-public network that may exist on the External vSwitch). It doesn’t matter what IPs you assign your Windows Servers, but to keep things clear, let’s reserve 192.168.0.1 for the gateway IP address. Download [crayon-53aa109c8b5ff314349960-i/] from one of the CentOS Mirrors. Create a new Generation 1 VM in Hyper-V for CentOS, attach the first NIC to the External vSwitch, and the second NIC to the Internal vSwitch. I’d strongly recommend not only using this order, but creating the NICs prior to building the VM — there is additional manual work that must be done if you add the NIC post-installation! Allocate at least 512MB RAM and 1 vCPU should be plenty for non-production use. Attach the CentOS ISO to the VM, start it up, and run the installation. For the most part, choose the defaults. Enter a sane root password, and for partitioning, use the entire drive. The entire installation should only take a couple of minutes, and then the system will request a reboot. Note that the Microsoft Linux Integration Components are baked into the Linux kernel, so there is no need to install them. The next step is to configure networking. The network scripts are located in [crayon-53aa109c8b642159827576-i/] and are named [crayon-53aa109c8b65b028363496-i/] (External vNIC) and [crayon-53aa109c8b671844195781-i/] (Internal vNIC). Because this is a minimal install of CentOS, our text editor of choice is going to be vi. This is not the easiest text editor to use, but once you get used to it, it makes sense (I promise). I recall once being on campus at Microsoft in Redmond as part of a high school job shadow and employees argued over what editor was better vi or emacs. Clearly those who argued for emacs were wrong and probably worked on such projects as Microsoft Bob 2.0. Let’s get started. If you ever make a mistake with [crayon-53aa109c8b689165341285-i/] and just want to back out of making a change, just use the following sequence of characters: [crayon-53aa109c8b69f304426621/] That will you out of any mode and quit without saving any changes to the file. Ok, first thing is first, let’s get an IP address from the external DHCP server on the network. [crayon-53aa109c8b6b4421613170/] Use the arrow keys to go to the [crayon-53aa109c8b6c9698400544-i/] line, go to n in no, and hit the [crayon-53aa109c8b6df092210802-i/] key to erase [crayon-53aa109c8b6f3944307684-i/]. Next, hit [crayon-53aa109c8b708813593939-i/] for Insert, use the right arrow to put your cursor to the right of the = sign, and type in [crayon-53aa109c8b71d945545501-i/]. Hit the [crayon-53aa109c8b732045683126-i/] key (notice the [crayon-53aa109c8b747995127699-i/] at the bottom of the screen disappears). Next, type in [crayon-53aa109c8b75c107474968-i/] which means “write quit”. This will save the file, and exit [crayon-53aa109c8b771786841762-i/]. Now, type [crayon-53aa109c8b786764800640-i/] and the prompt. This will request an IP address from the DHCP server on the network. If you were successful, you can type in [crayon-53aa109c8b79b305020824-i/] and you should see two entries, one for [crayon-53aa109c8b7b0465224481-i/] (our External vNIC) and another for [crayon-53aa109c8b7c5353409376-i/] (loopback). Our External vNIC will have a DHCP assigned IP address, and we should be able to [crayon-53aa109c8b7da275186797-i/] (type [crayon-53aa109c8b7ee987549573-i/] to cancel). Great! Now, onto assigning the internal IP address on [crayon-53aa109c8b804462927830-i/]. [crayon-53aa109c8b818001242613/] Using the same procedure as above, change [crayon-53aa109c8b82e223261280-i/]. Change [crayon-53aa109c8b842088997044-i/] from [crayon-53aa109c8b857761742222-i/] to [crayon-53aa109c8b86c987731924-i/] (this means we’re going to put this interface in a static IP mode). When at the end of the [crayon-53aa109c8b881223271340-i/] line, hit the [crayon-53aa109c8b896020443640-i/] key, and type in the following lines: [crayon-53aa109c8b8ab591856458/] Again, hit [crayon-53aa109c8b8c0932533661-i/], then [crayon-53aa109c8b8d4224678581-i/] to save and quit [crayon-53aa109c8b8e9134727017-i/]. At the prompt, type [crayon-53aa109c8b8fe325270426-i/] which will bring the [crayon-53aa109c8b912000558817-i/] interface online. The next step will be to enable IP Forwarding on all of our network interfaces. This is done in one of two ways, the first way is temporary until reboot, and the second way makes it permanent. Temporary: [crayon-53aa109c8b928303743753/] Permanent: [crayon-53aa109c8b93d716498009/] Insert a new line at any point, adding: [crayon-53aa109c8b951060537470/] Use [crayon-53aa109c8b966438677546-i/] to save and quit [crayon-53aa109c8b97a676739740-i/]. To commit the change, from the command line, use [crayon-53aa109c8b98f710492981-i/] to restart CentOS. Log back in as [crayon-53aa109c8b9a4736608079-i/]. The next step will be to configure iptables. This is what will allow us to forward traffic from the internal network to the outside world. Fortunately we can do this through the iptables command line interface! Use the following commands: [crayon-53aa109c8b9ba390607995/] Then, save the ruleset and restart the iptables service: [crayon-53aa109c8b9cf514921597/] The last step? [crayon-53aa109c8b9e4409636698/] This will update all of the packages to the latest version from the distribution’s repository. You may need to restart for some of the packages to update completely. But that is it! Given your Windows Servers on the Internal vSwitch are using the IP address assigned to the Internal vNIC of the Linux VM as their Gateway, you should be able to ping to public IP addresses. Setting up a Domain Controller should also allow you to resolve public domain names, as well (given other network restrictions are not in place). […]
More Pages to Explore .....