Die GeoIP2-Datenbanken laufen allerdings mit den alten, bisher genutzten Webserver-Modulen nicht mehr, was darin resultiert, dass man entweder die alten – nicht mehr aktuellen – Datenbanken nutzen oder aber den Webserver selbst kompilieren muss. Natürlich ist es sehr unschön, an der Paketverwaltung vorbei zu arbeiten; die alten Daten will aber auch niemand mehr nutzen.
Nach vielen erfolglosen Recherchen bei der Suchmaschine meiner Wahl, bin ich nicht fündig geworden und war schon sehr kurz davor, den NGINX händisch an der Paketverwaltung vorbei zu kompilieren – wenn auch mit einem unguten Gefühl.
Ein Dilemma…
Die Lösung
deb.sury.org! Sehr bekannt für seine PHP-Pakete betreibt er auch noch weitere Repositories – darunter auch eins für NGINX und dazugehörige Module.
Die Installation
Zu Beginn binden wir das angesprochene Repository ein. Hierzu installieren wir erst ein paar Abhängigkeiten, um danach den GPG-Key zu installieren und dann das Repository hinzuzufügen.
Nun steht uns die ganze Welt des schönen Repository offen und wir können das GeoIP2-Modul installieren:
apt-get install libnginx-mod-http-geoip2
Zack, das war’s schon. Natürlich muss jetzt noch der NGINX entsprechend konfiguriert und die GeoIP2-Datenbanken heruntergeladen werden, das überlasse ich aber wieder dem geneigten Leser. Weitere Informationen zum Modul findet man hier.
Since my instructions for setting up a pfSense router VM have been so well received by Hetzner, I would like to explain today how you can also use the IPv6 assigned by Hetzner with this VM.
Foreword
In the meantime, I have turned my back on the pfSense project and switched fully to OPNSense. The reasons for this are manifold, but first of all I like the interface of the OPNSense much better. Whether you use a pfSense or an OPNSense VM, however, should be completely irrelevant – only the menu items could be found in different places.
Hetzner assigns each dedicated server a /64-IPv6 network, which can be freely routed to its MAC addresses. For this you have to click on the small computer behind the IPv6 subnet in the robot. Here we change the routing to the MAC address of the router VM.
Configuration WAN interface
The configuration of the WAN interface is very simple, so I just want to show a screenshot:
As you can see we are using DHCP6 here and have the IP address for the WAN assigned to us by Hetzner. I needed to restart the VM after enabling IPv6 on the WAN. In the dashboard you can see the newly assigned IPv6 addresses on the WAN interface – in my case this was the fe80::250:56ff:fe00:222c.
The DHCPv6 client configuration (Request only to IPv6 prefix, Send IPv6 prefix hint and Use IPv4 connectivity) has to be set – without these options I had no success.
LAN Interface Configuration
Also here I would like to use a screenshot to show the configuration.
For the IPv6 address, it is best to use the first IPv6 address from the subnet assigned by Hetzner (at my site: 2a01:4f9:2a:129e:: 64). Further settings are not necessary here!
Gateway configuration
Unfortunately, the OPNSense didn’t always reach me via IPv6, so I puzzled for some time what was going on.
Under System -> Gateways the error was hidden. Here I have adapted the gateway accordingly:
I didn’t set the gateway as default gateway and I entered the static IPv6 address instead of leaving the gateway on „dynamic“ – but the real problem resulted from the missing default gateway.
After finishing the work I restarted the OPNSense and tested the IPv6 availability again: with success.
Configuration of a VM
Finally, I would like to show you how to make a Ubuntu or Windows VM accessible via IPv6 in this setup. I have decided against the use of DHCP6 in the internal network and configure the virtual machines statically.
The configuration of a Ubuntu-/Debian-VM is usual easy to manage. For this we add our IPv6 configuration block to the file /etc/network/interfaces:
The configuration of the Windows VM is also quite simple for once. Enable IPv6 in the adapter settings, if this has not already been done, and enter the same data there as under Linux:
Address: freely selectable IPv6 address from the subnet
Subnet Mask: /64
Gateway: IPv6 address of pfSense/OPNSense
In both configurations you may have to enter one or more IPv6 name servers in order for the name resolution to work properly.
Bottom line
On the internet you can read many horror stories about the configuration of IPv6 at Hetzner – but if you are occupied with the whole setup the setup isn’t difficult at all in the end and done pretty quickly.
I will be happy to answer any questions or to receive information about my setup. It’s certainly not perfect, I know that, but it works reliably for me, which is why I actually think about it. I’m very happy. If somebody has a good tip for you: please feel free to add it to your comments!
As many of my readers know, I use some Hetzner servers in combination with the virtualization solution Proxmox.
To make the setup a little more secure and not rely on the Hetzner firewall, I recently took care of shielding my virtual machines behind a pfSense VM. The network configuration was not quite trivial and therefore I would like to give my readers a little insight.
Prerequisites
dedicated Hetzner server (here: EX41-SSD)
running Proxmox system
an additional IP for the pfSense VM with MAC address (Hetzner-Robot)
Subnet, routed to the pfSense VM
As soon as these requirements are met, we can start configuring the system.
Proxmox Configuration
My Proxmox configuration looks like this (/etc/network/interfaces):
auto lo
iface lo inet loopback
iface eth0 inet manual
auto vmbr0
iface vmbr0 inet static
address <SERVER-HAUPT-IP>
netmask 255.255.255.255
gateway <SERVER-HAUPT-GATEWAY>
pointopoint <SERVER-HAUPT-GATEWAY>
bridge_ports eth0
bridge_stp off
bridge_fd 0
up ip route add 192.168.0.0/16 via 138.201.203.59 dev vmbr0
up ip route add 172.16.0.0/12 via 138.201.203.59 dev vmbr0
up ip route add 10.0.0.0/8 via 138.201.203.59 dev vmbr0
up sysctl -w net.ipv4.ip_forward=1
up sysctl -w net.ipv4.conf.eth0.send_redirects=0
# Virtual switch for DMZ
# (connect your firewall/router KVM instance and private DMZ hosts here)
auto vmbr1
iface vmbr1 inet manual
bridge_ports none
bridge_stp off
bridge_fd 0
You can read the main server IP and the main server gateway from the Hetzner Robot – there are actually not many sources of error here.
pfSense Configuration
WAN/LAN configuration
The pfSense configuration is not really more complicated. In the Proxmox interface we create the VM with two network devices, one bound to vmbr0 – our WAN interface – and one to vmbr1 – the LAN interface.
After the pfSense installation, we assign the interfaces in pfSense accordingly and configure the WAN interface:
pfSense WAN Configuration
The configuration of the LAN interface should be self-explanatory – private subnet, no gateway.
Virtual IP Address
To be able to use our subnet behind pfSense, we now have to enter each IP to be used under „Firewall -> Virtual IPs“. Here it is possible to enter all IP addresses of the subnet, we do not need a broadcast or host address.
Internal IP addresses
We are now able to distribute their IP addresses to our clients in the LAN. Either you use the DHCP server of pfSense and assign static reservations in the simplest case or you configure the clients manually.
I decided to use the DHCP variant, but I don’t want to go into the configuration here, because it’s quite self-explanatory.
1:1 NAT
In order to be able to reach our internal clients now also from the Internet, we still have to configure the 1:1 NAT.
Firewall configuration
Finally, it is up to the administrator to configure the firewall correctly. There are so many solutions here, I don’t want to go into them any further. which ports are opened where, the operator of the firewall has to decide for himself.
ICMP ping rule
I find it quite pleasant to be able to check the accessibility of a host from the outside with a ping. I always create this rule in the pfSense firewall first:
The internal IP or the internal subnet must of course be specified as the destination.
Bottom line
The configuration of a pfSense VM at Hetzner is not quite trivial, but it can be easily done. A little Trial & Error is included, but that’s always the case with firewalls. As a little tip I would like to give you not to block the access to the Proxmox web interface too early, so that in case of doubt you still have access to the pfSense console when you configure yourself.
I will be happy to answer any questions or to receive information about my setup. It’s certainly not perfect, I know that, but it works reliably for me, which is why I’m actually quite happy about it. If somebody has a good tip for you: please feel free to add it to your comments!
As already known, I use a Proxmox setup on servers of the German host Hetzner for myself and my customers. The wiki article about the Proxmox configuration is unfortunately not really up-to-date or easy to understand…
Often my readers asked me to pour the basic network configuration into an article: said, done – here’s the article!
Preparation
In principle, you don’t have to prepare much to use a simple Proxmox setup.
Of course we need a dedicated server with installed Proxmox image and an additional IP from the Hetzner robot. We assume the following IP addresses:
dedicated main IP
IP: 138.201.203.16
Gateway: 138.201.203.1
Additional IPs (ordered via Robot – without MAC address!)
138.201.203.49
138.201.203.52
138.201.203.56
138.201.203.57
We also enable IP forwarding by executing the following command:
sysctl -w net.ipv4.ip_forward=1
We permanently enable forwarding by inserting the corresponding line in /etc/sysctl.d/99-hetzner.conf or removing the comment character.
More preparation is not necessary in this case.
Configuration Proxmox Host
On the Proxmox host, the /etc/network/interfaces file looks like this:
auto eth0
iface eth0 inet static
address 138.201.203.16
netmask 255.255.255.255
gateway 138.201.203.1
pointopoint 138.201.203.1
auto vmbr0
iface vmbr0 inet static
address 138.201.203.16
netmask 255.255.255.255
bridge_ports none
bridge_stp off
bridge_fd 0
bridge_maxwait 0
up ip route add 138.201.203.49/32 dev vmbr0
up ip route add 138.201.203.52/32 dev vmbr0
up ip route add 138.201.203.56/32 dev vmbr0
up ip route add 138.201.203.57/32 dev vmbr0
It is important here to enter the main IP (here: 138.201.203.16) for the eth0 and vmbr0 devices as a quasi „double“ entry. The gateway address must also be entered at gateway and pointopoint – Attention: pointopoint has only one t in the middle, this is not a typo!
A reboot later should display two network devices – eth0 and vmbr0.
Virtual Machine Configuration (Linux)
After the installation I change the file /etc/network/interfaces as follows:
After a restart the VM should be reachable via ping as well as via SSH.
Virtual Machine Configuration (Windows)
Sometimes you also need a Windows machine, which is why I would like to show the configuration here simply by screenshot:
he DNS servers can of course be customized, but the rest should look the same – with your own IP addresses, of course.
The option „Check settings on exit“ must not be activated, since Windows – just like Debian – checks the configuration and would report an error – despite these error messages of the The virtual machines are running completely stable.
Bottom line
The configuration is actually quite simple and very clear. By adding a single line in the network configuration, additional IP addresses can be added and superfluous ones removed. The configuration runs very stable, you don’t have to bother with DHCP servers and the performance is also satisfactory.
I hope I have been able to help some readers – and of course Google visitors – with my instructions and of course I am happy to support you in setting up your own setup – just contact me for a non-binding offer!
Questions, criticism and hints to the article I accept naturally gladly in the comments – please have however also understanding that I can offer free support only in certain framework.
Nach einer Neuinstallation oder dem Upgrade auf Debian Buster konnte ich mich nicht mehr per SSH an meinem Server anmelden. Mich begrüßte ständig nur die Meldung Connection refused.
Interessanterweise konnte ich das Problem immer „lösen“, indem ich mich per Konsole direkt an der Maschine angemeldet hatte (geht dank Proxmox ja ganz einfach). Nach nur einem Login funktionierte die SSH-Verbindung wieder problemlos.
Nach einiger Recherche bin ich dann auf diesen Bug gestoßen. Um es kurz zu machen benötigt die Generierung von zufälliger Entropie mehr Zeit als zuvor unter Debian Stretch – der Start des OpenSSH-Servers benötigt allerdings ebendiese Entropie und dauert daher sehr viel länger als zuvor.
Eine einfache Lösung des Problems ist die Installation des Pakets haveged. Direkt nach der Installation dieses Pakets und einem erneuten Neustart ist das Problem behoben.
Was ist haveged? Kurz umrissen haben es die Kollegen des Linux Magazin:
Das Verfahren macht sich den Umstand zunutze, dass moderne Prozessoren Elemente zur Verzweigungsvorhersage (Branch Prediction), Caches, Pipelines und vieles mehr besitzen. Das normale Benutzen der CPU löst ein Trommelfeuer an Statusänderungen bei Tausenden dieser Elemente aus, und genau daraus produziert das Havege-Verfahren viel und hochwertigen Zufall.