How we composed our KVM/VMware setup at Hetzner.de


Link : http://www.compa.nl/hetznervmware

In our setup (EQ4) we have a different IP for the dedicated rootserver (the EQ4) than our subnet.

As Hetzner routes subnets and doesn’t provide them ‘just’ available you can’t use bridged networking in a normal way.

The network at Hetzner is setup that ONLY the MAC-address (physical network adapter so to speak) of the EQ4 machine is allowed on the network.

Their solution, provided through their wiki, is to use NAT.

Our professionals in networking don’t like NAT, certainly not on dedicated hardware and there is an easy way around this.

We got our details from;

Assumptions

  • You are on a different subnet with your EQ4 than your host is
  • or, same as above but you have multiple subnets (implicitly making your host differing from one of them)
  • You run Linux (any, really) as your host operating system
  • You use VMware Server to virtualize your environmentHelpfull
  • We made this using debian as the host
  • We have FreeBSD guests
  • Installed VMware Server version 2Syntax
    • We will use EQ4 host address 1.2.3.4
    • We get subnet 5.6.7.32/28 routed to our box from Hetzner (14 usable ip)

    Setup of the Host

    • By defailt your /etc/network/interfaces (or similar) will look like
      	# device: eth0
      	auto  eth0
      	iface eth0 inet static
      	  address   1.2.3.4
      	  broadcast 1.2.3.31
      	  netmask   255.255.255.224
      	  gateway   1.2.3.1
      
      	# default route to access subnet
      	up route add -net 1.2.3.192 netmask 255.255.255.224 gw 1.2.3.1 eth0

       

    • We added the following (basically one route add per usable IP)
      	# Virtual subnet hosts routing
      	up ip addr add 5.6.7.32/255.255.255.240 dev eth0
      
      	# Virtual hosts dedicated routing
      	up route add -host 5.6.7.33 gw 5.6.7.33
      	up route add -host 5.6.7.34 gw 5.6.7.34
      	up route add -host 5.6.7.35 gw 5.6.7.35
      	up route add -host 5.6.7.36 gw 5.6.7.36
      	up route add -host 5.6.7.37 gw 5.6.7.37
      	up route add -host 5.6.7.38 gw 5.6.7.38
      	up route add -host 5.6.7.39 gw 5.6.7.39
      	up route add -host 5.6.7.40 gw 5.6.7.40
      	up route add -host 5.6.7.41 gw 5.6.7.41
      	up route add -host 5.6.7.42 gw 5.6.7.42
      	up route add -host 5.6.7.43 gw 5.6.7.43
      	up route add -host 5.6.7.44 gw 5.6.7.44
      	up route add -host 5.6.7.45 gw 5.6.7.45
      	up route add -host 5.6.7.46 gw 5.6.7.46
    • Now just setup VMware to provide your virtual machines with BRIDGED networking

    Setup of the Guest

    • Install the VMware tools if you like (remember to install /usr/ports/misc/compat6x for FreeBSD 7 and up with VMware 2.0.2 or lower)
    • For FreeBSD your almost there, just add these lines to your /etc/rc.conf
      	ifconfig_em0="5.6.7.33"
      
      	# Static routes
      	static_routes="direct default"
      	route_direct="1.2.3.4 -iface em0"
      	route_default="default 1.2.3.4"

       

    • Remember/note that you have to add your EQ4 ip-address as the default route on your guest. Do not use the ‘Hetzner‘ provided gateway as that will block traffic
    • Also remember to put a usefull /etc/pf.conf on your machine!
    • (which goes for the linux base EQ4 as well!)