Hetzner - DokuWiki

Windows Server Subnet/en

The following article describes how to use an additional subnet for virtual machines with Hyper-V.

Inhaltsverzeichnis

Roles and Features

The required roles and features are:

  • DHCP server
  • Hyper-V

These can be installed in the Server Manager by adding Roles and Features.

During the initial installation of Hyper-V don't create a virtual switch.

Routing & Network

Hetzner routes the additional subnet onto the main IP of the server and doesn't assign any MAC addresses. Therefore, to be able to use the additional IPs they must be routed locally on the server.

Activating TCP/IP Forwarding

  • Run regedit.exe
  • Navigate to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters
  • Change the entry IPEnableRouter (REG_DWORD type) to 1
Ip enable.jpg


Creating a Virtual Switch

  • Open the Hyper-V Manager and create a new internal virtual switch type in the manager for virtual switches
Virt switch.jpg


Configure the Interface

  • Configure an IP from the subnet in the adapter settings of the newly created virtual switch by selecting the Network and Sharing Center in the Control Panel

After a reboot this configured IP is reachable (ping) when forwarding has been correctly enabled.

Router ip.jpg

DHCP

To automatically assign IPs from the the subnet to the virtual machines and enable PXE boot, it is required to set up a DHCP server.

Configuration

In the Server Manager, open the DHCP applet and change the following settings:

  • Right-click on the server -> Add/Remove Bindings -> Remove the checkbox for the external interface
Bindungen.jpg


  • Right-click on IPv4 -> New Scope -> Configure Subnet IPs
    • Please note that the first IP to the final IP must be specified, minus the Network IP, the already configured virtual switch IP and the Broadcast IP
    • Example: the subnet received from Hetzner: 192.168.53.72/29
Network IP: 192.168.53.72
(Proposed) Virtual Switch IP: 192.168.53.73
Broadcast IP: 192.168.53.79
Usable IPs: 192.168.53.74 – 192.168.53.78
  • Set the Router IP to the IP configured for the virtual switch
  • Don't change any of the steps not mentioned in this guide
Dhcp subnet.jpg


  • Right-click on the newly created scope -> select Properties in the tab Advanced and set and confirm the configuration on both (DHCP & BOOTP)
Bootp clients.jpg


  • In the newly created scope select the category scope options -> richt-click on options and set two additional checks next to the points 066 and 067
    • 066 Hostname of the Service Point -> string value: dhcp.your-server.de
    • 067 Name of the Service File -> string value: pxelinux.0
Bereichsoptionen.jpg


IP - MAC mappings for static VM IPs - Optional (recommended)

Upon successful completion of point Hyper-V

  • In the newly created scope select the category address leases -> richt-click on each listed IP -> select „add to reservation“

Each IP is then statically bound to each virtual machine.

Hyper-V

  • Create a new "Generation 1" virtual machine
  • Via Settings remove the automatically added network card
  • Via Add Hardware add a new network card of the type legacy network adapter and connect it to the internal virtual switch
Vm.jpg


  • Start the virtual machine and test PXE Boot
    • With a correct configuration the Hetzner PXE Boot menu will be shown (blue logo)
Pxe boot.jpg


  • Perform the optional point IP-Mac Mapping
  • Enable the installation of an OS via Robot for the configured subnet IP and restart the virtual machine letting it boot via PXE. Instead of the Hetzner PXE boot menu, the installation of the OS will automatically start. Once the standard login screen appears, the installation is complete and the virtual machine can be used

IPv6

Hetzner routes the IPv6 subnet on the respective link local address of the server (fe80::/64). Therefore, to be able to use the above mentioned setup for IPv6 for your virtual machines you will need to make the following configuration changes

  • Give the external interface the first address of the subnet ::1/128, with the gateway fe80::1
  • Give the virtual switch the second address ::2/64, without a gateway
  • Give the virtual machines the following consecutive IPs and use the IP of the virtual switch as the gateway (::2)

Using netsh activate forwarding:

netsh interface ipv6 set interface Extern forwarding=enabled advertise=enabled
netsh interface ipv6 set interface vSwitch forwarding=enabled advertise=enabled

If not set automatically by Windows use netsh to set the routes:

netsh interface ipv6 add route prefix=xxxx:xxxx:xxxx:xxxx::/128 interface=Extern publish=yes
netsh interface ipv6 add route prefix=xxxx:xxxx:xxxx:xxxx::/64 interface=vSwitch publish=yes


© 2018. Hetzner Online GmbH. Alle Rechte vorbehalten.