Bekomme NAT nicht zum laufen

emt1803

New Member
May 22, 2017
2
0
1
23
Sehr geehrte Community Mitglieder!

Ich wende mich Heute an euch, da ich trotz vieler Versuche mein NAT nicht zum Laufen bekomme. Nach wie vor habe ich den Fehler: "Connection refused"

Ausgangssituation:
Interfaces:

Standard Eth:
auto eth0
iface eth0 inet static
address 46.4.***.87
netmask 255.255.255.224
gateway 46.4.***.65
up route add -net 46.4.***.64 netmask 255.255.255.224 gw 46.4.***.65 dev eth0

Bridge für meinen CT:
auto vmbr2
iface vmbr2 inet static
address 10.21.21.254
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-up iptables -t nat -A POSTROUTING -s '10.21.21.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.21.21.0/24' -o vmbr0 -j MASQUERADE
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 2222 -j DNAT --to 10.21.21.5:22
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 2222 -j DNAT --to 10.21.21.5:22

Public IP Bridge:
auto vmbr0
iface vmbr0 inet static
address 46.4.***.87
netmask 255.255.255.224
bridge_ports none
bridge_stp off
bridge_fd 0

Mein CT hat:
die IP Adresse: 10.21.21.5/24
das Standardgateway: 10.21.5.1

Ich bitte um eure Hilfe!
 
Warum hast du einmal eth0 und einmal vmbr0 mit der gleichen IP? Was soll denn deine Bridge vmbr0 genau machen?

Dein Gateway ist die .1 wo ist die definiert? Dein Host hat .254 und das sollte (nur auf basis deins Posts) der Gateway sein.
 
Warum hast du einmal eth0 und einmal vmbr0 mit der gleichen IP? Was soll denn deine Bridge vmbr0 genau machen?

Dein Gateway ist die .1 wo ist die definiert? Dein Host hat .254 und das sollte (nur auf basis deins Posts) der Gateway sein.
Ich habe das Gateway von meinem CT auf **.254 geändert und den vmbr0 gelöscht.

Ich habe aber weiterhin den Fehler wenn ich mich per SSH über den Port 222 mit der Public IP verbinden will, dass der sagt "Connection refused".
 
Last edited:
Generell würde zuerst mal immer deine Public IP noch in den DNAT-Befehl einbauen über -d, das ist dann korrekter und baut intern keinen Mist.

So in etwa:
Code:
post-up iptables -t nat -A PREROUTING -d <public-ip> -p tcp --dport 2222 -j DNAT --to 10.21.21.5:22
post-up iptables -t nat -A POSTROUTING -s 10.21.21.0/24 ! -d 10.21.21.0/24 -j MASQUERADE

Sonst kann es natürlich immer ein Routing-Problem sein, dass er nicht weiß wie die Pakete weitergeschickt werden sollen. Bitte Poste nochmal deine komplette interfaces (zur Sicherstellung der korrekten Verwendung der Konfiguration sollte der Server am besten durchgestartet sein).
 

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!