Proxmox auf dediziertem Server mit 1x öffentlicher IPv4-Adresse

dex24536

New Member
Mar 3, 2023
7
0
1
Hallo zusammen.

Ich versuche gerade proxmox auf einem netcup-root-Server so einzustellen, dass der Proxmox selbst das Portforwarding an die einzelnen Container übernimmt. Für meine Zwecke ist der Einsatz von pfsense, usw. IMO überdimensioniert - und ehrlich gesagt: ich habe mit der Einrichtung auch so meine Schwierigkeiten gehabt.

Ich habe nun diese Anleitung in Augenschein genommen und die Informationen entsprechend umgesetzt:
Code:
auto lo
iface lo inet loopback

auto ens3
iface ens3 inet static
    address 89.58.31.203/22
    gateway 89.58.28.1
#WAN


auto vmbr0
iface vmbr0 inet static
    address 172.20.23.100
    netmask 255.255.255.0
    bridge_ports none
    bridge_stp off
    bridge_fd 0
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    post-down echo 0 > /proc/sys/net/ipv4/ip_forward
    post-up iptables -t nat -A POSTROUTING -s '172.20.23.0/24' -o ens3 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '172.20.23.0/24' -o ens3 -j MASQUERADE
    post-up iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 80 -j DNAT --to 172.20.23.101:80
    post-down iptables -t nat -D PREROUTING -i ens3 -p tcp --dport 80 -j DNAT --to 172.20.23.101:80
    post-up iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 81 -j DNAT --to 172.20.23.101:81
    post-down iptables -t nat -D PREROUTING -i ens3 -p tcp --dport 81 -j DNAT --to 172.20.23.101:81
    post-up iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 443 -j DNAT --to 172.20.23.101:443
    post-down iptables -t nat -D PREROUTING -i ens3 -p tcp --dport 443 -j DNAT --to 172.20.23.101:443
#LAN

Was funktioniert:

(Test-Container mit Debian 11 - nur shell - mit 172.20.23.101 + 172.20.23.169)
  • Meine beiden Test-Container können Adressen im WWW anpingen
  • Meine beiden Test-Container können die Adresse 172.20.23.100 anpingen
  • Meine beiden Test-Container können sich auch untereinander erreichen
Was nicht funktioniert:

Wo habe ich hier bei der Übersetzung der Schnittstellen einen Fehler gemacht?

VG Dex
 
Last edited:

Da sollte man sich das mal im LANtrace (tcpdump) ansehen (d.h. welche Pakete kommen von extern an, wo werden sie weitergeleitet, selbiges dann für die Antworten aus dem Container).
Mögliche Fehlerquelle ist ein Firewall irgendwo auf dem Weg.

Wo habe ich hier bei der Übersetzung der Schnittstellen einen Fehler gemacht?
Ist auf Basis der obigen Anweisungen keiner erkennbar.
 
Hey ho.
Danke für Deine Vorschläge. Gute Idee mit dem Paketmitschnitt... jedoch geht es plötzlich.

Warum? Nun... ich habe Proxmox einfach mal neugestartet. Bislang hatte ich lediglich
Code:
systemctl restart networking
durchgeführt. Für mein Verständnis hätte das eigentlich ausreichen sollen.

What ever. Thx - Thread kann zu :)
 
@Falk R. Oh natürlich. Sorry. Logisch.

Da er ja nun aber noch offen ist... Frage:
Wenn ich nun das gesamte Routing von einem Container aus machen möchte, welche Einträge wären dann dafür nötig?

Bislang hab ich es so versucht:

/etc/network/interfaces (Host)
Code:
auto lo
iface lo inet loopback

auto ens3
iface ens3 inet static
        address 89.58.██.███/22
        gateway 89.58.██.█

auto vmbr0
iface vmbr0 inet static
        address 172.0.0.1/30
        bridge-ports none
        bridge-stp off
        bridge-fd 0
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-down echo 0 > /proc/sys/net/ipv4/ip_forward
        post-up iptables -t nat -A POSTROUTING -s '172.0.0.0/30' -o ens3 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '172.0.0.0/30' -o ens3 -j MASQUERADE
        post-up iptables -t nat -A PREROUTING -i ens3 -p tcp -m multiport ! --dport 22,8006 -j DNAT --to 172.0.0.2
        post-down iptables -t nat -D PREROUTING -i ens3 -p tcp -m multiport ! --dport 22,8006 -j DNAT --to 172.0.0.2

auto vmbr1
iface vmbr1 inet static
        address 172.19.71.100/24
        bridge-ports none
        bridge-stp off
        bridge-fd 0

/etc/network/interfaces (Router-Container 100) | eth0 -> vmbr0 ; eth1 -> vmbr1
Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 172.0.0.2/30
        gateway 172.0.0.1

auto eth1
iface eth1 inet static
        address 172.19.71.100/24
        bridge-ports none
        bridge-stp off
        bridge-fd 0
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-down echo 0 > /proc/sys/net/ipv4/ip_forward
        post-up iptables -t nat -A POSTROUTING -s '172.19.71.0/24' -o eth0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '172.19.71.0/24' -o eth0 -j MASQUERADE
        post-up iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 22101 -j DNAT --to 172.19.71.101:22
        post-down iptables -t nat -D PREROUTING -i eth0 -p tcp --dport 22101 -j DNAT --to 172.19.71.101:22
        post-up iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 22102 -j DNAT --to 172.19.71.102:22
        post-down iptables -t nat -D PREROUTING -i eth0 -p tcp --dport 22102 -j DNAT --to 172.19.71.102:22
        post-up iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 22103 -j DNAT --to 172.19.71.103:22
        post-down iptables -t nat -D PREROUTING -i eth0 -p tcp --dport 22103 -j DNAT --to 172.19.71.103:22

Und dann abschließend in weiteren Client-Containern (101, 102, usw.) | eth1 -> vmbr1
Code:
auto lo
iface lo inet loopback

auto eth1
iface eth1 inet static
        address 172.19.71.101/24
        gateway 172.19.71.100

Jedoch habe ich von CT101 weder eine DNS-Auflösung, noch bekomme ich einen WAN-Zugriff. Lediglich pings auf 172.0.0.1; 172.0.0.2; 172.19.71.100; 172.19.71.101 und auf meine von netcup vergebene WAN IPv4 89.58.██.███ sind möglich.

Kann mir jemand sagen, wo ich mich hier verhakt hab?
(Dieses Mal habe ich natürlich schon Neustarts versucht - ohne Erfolg)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!