Last time, we planned how we are going to assign fixed IP addresses to our test environment, solving the chicken-egg problem of accessing the computer to configure the IP address without knowing the IP address and thus being unable to remove into the machine.
Let’s see how can we set up the networking for the virtual environment through PowerShell scripting. I have already provisioned a virtual machine with the help of the Jenkins build project, developed earlier. The virtual machine in this example is called dhcpserver.
Creating the internal switch
This virtual network switch needs to be created once only and it is the switch for the Virtual Test Network on the plan. I will name it ate-internal.
The DHCP server will serve IP addresses on its connection to this switch to avoid any interference with the real environment DHCP assignments.
Removing all network adapters from the provisioned image
It turned out that having a default network adapter on the image might not be the best idea. In the production environment, it will be better to correct the base image to remove the network adapter, but for now, let’s remove the installed one.
Adding the adapter connecting the test network
Here, into a problem with the Hyper-V manager constantly complaining about incorrect MAC addresses. After searching around the net, I found that setting the first half of the MAC address to 00:60:2F solves the problem, the second half can be freely changed. Since these network cards are going to be attached to a non-public switch, the addresses won’t interfere with any real MACs. While technically on the DHCP server we are going to manually configure this adapter, this allows us to test out how we will create the adapters for the test environment virtual machines.
Creating the management network adapter
Here, we don’t set the MAC address for the adapter, because we will manually configure the IP address and this adapter will be seen from the outside.
You can connect with me on LinkedIn, Twitter or you can register on the blog. Share if you found this article useful or know somebody who would benefit from reading it.
No comments yet.