Skip to content

Commit

Permalink
Add note in "Install and Configure Proxmox VE" (#845)
Browse files Browse the repository at this point in the history
* Update 01.en.md
* Update 01.en.md
  • Loading branch information
enl-mk authored May 7, 2024
1 parent 109af82 commit 6ad622a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
14 changes: 8 additions & 6 deletions tutorials/install-and-configure-proxmox_ve/01.de.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ Wählen Sie eine passende Variante:

* [Hetzner Cloud Netzwerk](#hetzner-cloud-netzwerk)<br>
<small>» Eine Verbindung zwischen den virtuellen Maschinen/LXC in Proxmox herstellen.</small><br>
<small>» Masquerading (NAT): VMs mit pvt IPs den Internetzugang über die öfftl. IP des Hosts ermöglichen.</small>
* [Masquerading (NAT)](#masquerading-nat)<br>
<small>» VMs mit pvt IPs den Internetzugang über die öfftl. IP des Hosts ermöglichen.</small><br>

##### Routed Setup

Expand Down Expand Up @@ -384,7 +385,7 @@ Die Konfiguration sollte in etwa wie folgt aussehen:

![](images/3935fcac-0bc7-47c1-8965-511f11d7f72c.png)

Ähnlich wie im Beispiel zuvor erstellen wir zunächst eine virtuelle Schnittstelle und definieren die VLAN ID, in unserem Fall wäre das `enp0s31f6.4000`. Wir müssen die Route zum Cloud Netzwerk `192.168.0.0/16` über den vSwitch hinzufügen.
Ähnlich wie im Beispiel zuvor erstellen wir zunächst eine virtuelle Schnittstelle und definieren die VLAN ID, in unserem Fall wäre das `enp0s31f6.4000`. Wir müssen die Route zum Cloud Netzwerk `192.168.0.0/16` über den vSwitch hinzufügen. Bitte beachten Sie, dass das Hinzufügen einer Route zum Hetzner-Cloud-Netzwerk und das Zuweisen einer IP-Adresse aus dem privaten Subnetzbereich des vSwitch an die Bridge nur notwendig ist, wenn der Proxmox-Host selbst mit dem Hetzner-Cloud-Netzwerk kommunizieren soll.

* Hostsystem Konfiguration:
```Go
Expand All @@ -395,6 +396,7 @@ Die Konfiguration sollte in etwa wie folgt aussehen:
auto vmbr4000
iface vmbr4000 inet static
address 192.168.1.10/24
bridge-ports enp0s31f6.4000
bridge-stp off
bridge-fd 0
Expand Down Expand Up @@ -422,7 +424,7 @@ Die Konfiguration sollte in etwa wie folgt aussehen:

<br>

* Masquerading (NAT) mit iptables
##### Masquerading (NAT)

Die Freigabe der virtuellen Maschinen/LXC-Container gegenüber dem Internet ist auch möglich, ohne weitere öffentliche zusätzliche IP-Adressen zu konfigurieren/zu nutzen. Hetzner hat eine strenge IP/MAC-Bindung, d.h. wenn der Datenverkehr nicht richtig geroutet wird, kommt es zu Abuse und kann zu Server-Sperrungen führen. Um dieses Problem zu vermeiden, können wir den Datenverkehr von den LXC/VMs über das Main-Interface des Hosts leiten. Dadurch wird sichergestellt, dass alle Netzwerkpakete die gleiche MAC-Adresse verwenden. Masquerading ermöglicht virtuellen Maschinen mit privaten IP-Adressen den Internetzugang über die öffentliche IP-Adresse des Hosts für ausgehende Kommunikation. Iptables ändert jedes ausgehende Datenpaket so, dass es so aussieht, als käme es vom Host, und eingehende Antworten werden so angepasst, dass sie an den ursprünglichen Absender zurückgeleitet werden können.

Expand Down Expand Up @@ -452,12 +454,12 @@ Die Konfiguration sollte in etwa wie folgt aussehen:
post-down iptables -t nat -D POSTROUTING -s '172.16.16.0/24' -o enp0s31f6 -j MASQUERADE
#NAT/Masq
```
<br>
Bitte beachten Sie, dass diese Regeln (unten) nicht notwendig sind, damit die LXC/VM's Zugang zum Internet haben. Diese Regel ist optional und dient dem Zweck des externen Zugriffs auf eine bestimmte VM/Container. Sie leitet den gesamten eingehenden Datenverkehr, außer auf den Ports 22 und 8006 (22 ist hier ausgenommen, damit Sie sich weiterhin über SSH mit Proxmox verbinden können, und 8006 ist der Port für das Webinterface), an eine bestimmte virtuelle Maschine unter `172.16.16.2` innerhalb des Subnetzes um. Dies ist ein übliches Szenario/Setup für Router-VMs wie pfSense, bei dem der gesamte eingehende Verkehr an die Router-VM umgeleitet und dann entsprechend geroutet wird.
```Go
post-up iptables -t nat -A PREROUTING -i enp0s31f6 -p tcp -m multiport ! --dports 22,8006 -j DNAT --to 172.16.16.1/24
post-down iptables -t nat -D PREROUTING -i enp0s31f6 -p tcp -m multiport ! --dports 22,8006 -j DNAT --an 172.16.16.1/24
post-up iptables -t nat -A PREROUTING -i enp0s31f6 -p tcp -m multiport ! --dports 22,8006 -j DNAT --to 172.16.16.2
post-down iptables -t nat -D PREROUTING -i enp0s31f6 -p tcp -m multiport ! --dports 22,8006 -j DNAT --an 172.16.16.2
```
## Schritt 3 - Sicherheit
Expand Down
16 changes: 10 additions & 6 deletions tutorials/install-and-configure-proxmox_ve/01.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ Choose one of the variants:

* [Hetzner Cloud Network](#hetzner-cloud-network)<br>
<small>» Establish a connection between the virtual machines/LXC in Proxmox.</small><br>
<small>» Masquerading (NAT): Enable VMs with pvt IPs to have internet access through the host's public IP.</small>
* [Masquerading (NAT)](#masquerading-nat)<br>
<small>» Enable VMs with pvt IPs to have internet access through the host's public IP.</small><br>
##### Routed Setup
Expand Down Expand Up @@ -384,7 +385,7 @@ The configuration should look something like this:
![](images/3935fcac-0bc7-47c1-8965-511f11d7f72c.png)
Similarly as in the example before, we will first create a virtual interface and define the VLAN ID, so in our case that would be the `enp0s31f6.4000`. We will have to add the route to the Cloud Network `192.168.0.0/16` via the vSwitch.
Similarly as in the example before, we will first create a virtual interface and define the VLAN ID, so in our case that would be the `enp0s31f6.4000`. We will have to add the route to the Cloud Network `192.168.0.0/16` via the vSwitch. Please note that adding a route to the Hetzner Cloud network and assigning an IP address from the private subnet range of the vSwitch to the bridge is only necessary if the Proxmox host itself is to communicate with the Hetzner Cloud network.
* Host system configuration:
```Go
Expand All @@ -395,6 +396,7 @@ Similarly as in the example before, we will first create a virtual interface and
auto vmbr4000
iface vmbr4000 inet static
address 192.168.1.10/24
bridge-ports enp0s31f6.4000
bridge-stp off
bridge-fd 0
Expand Down Expand Up @@ -422,7 +424,7 @@ Similarly as in the example before, we will first create a virtual interface and
<br>
* Masquerading (NAT) with iptables
##### Masquerading (NAT)
Exposing the virtual machines/LXC containers to the internet is also possible without configuring/having any further public additional IP addresses. Hetzner has a strict IP/MAC binding which means that if the traffic is not routed properly, it will cause abuse and can lead to server blockings. In order to avoid this problem, we can route the traffic from the LXC/VM's through the main interface of the host. This ensures that the MAC address is the same across all network packets. Masquerading enables virtual machines with private IP addresses to have internet access through the host's public IP address for outbound communications. Iptables modifies each outgoing data packet to seem as if it is coming from the host and incoming replies are adjusted so they can be directed back to the initial sender.
Expand Down Expand Up @@ -454,10 +456,12 @@ Similarly as in the example before, we will first create a virtual interface and
```
Please note that these rules (bellow) are not necessary for the LXC/VM's to have internet access. This rule is optional and serves the purpose of external accessibility to a specific VM/Container. It redirects all incoming traffic, besides on ports 22 and 8006 (here, 22 is excluded so that you can still connect to Proxmox via SSH, and 8006 is the port for the web interface), to a designated virtual machine at `172.16.16.2` within the subnet. This is a common scenario/setup for router VM's like pfSense where all incoming traffic will be redirected to the router VM and then routed accordingly.
<br>
```Go
post-up iptables -t nat -A PREROUTING -i enp0s31f6 -p tcp -m multiport ! --dports 22,8006 -j DNAT --to 172.16.16.1/24
post-down iptables -t nat -D PREROUTING -i enp0s31f6 -p tcp -m multiport ! --dports 22,8006 -j DNAT --to 172.16.16.1/24
post-up iptables -t nat -A PREROUTING -i enp0s31f6 -p tcp -m multiport ! --dports 22,8006 -j DNAT --to 172.16.16.2
post-down iptables -t nat -D PREROUTING -i enp0s31f6 -p tcp -m multiport ! --dports 22,8006 -j DNAT --to 172.16.16.2
```
## Step 3 - Security
Expand Down

0 comments on commit 6ad622a

Please sign in to comment.