Public IP can access on Port but inside my VMs i cant acces over the Public IP the Port

DerEchteAlec

New Member
Feb 20, 2023
1
0
1
Hey,

Ich habe the Problem that i cant access inside my VM to use the 3306 port from mysql that hosted on a other vm inside the local network.

my Interface.conf
Bash:
# network interface settings; autogenerated
# Please do NOT modify this file directly, unless you know what
# you're doing.
#
# If you want to manage parts of the network configuration manually,
# please utilize the 'source' or 'source-directory' directives to do
# so.
# PVE will preserve these directives, but will NOT read its network
# configuration from sourced files, so do not attempt to move any of
# the PVE managed interfaces into external files!

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

iface lo inet6 loopback

auto enp0s31f6
iface enp0s31f6 inet manual

auto vmbr0
iface vmbr0 inet static
    address XX.XX.XX.XX/26
    gateway XX.XX.XX.XX
    bridge-ports enp0s31f6
    bridge-stp off
    bridge-fd 0
    post-up sysctl -w net.ipv4.ip_forward=1
    post-up iptables -X
    post-up iptables -F
    post-up iptables -P INPUT ACCEPT
    post-up iptables -P OUTPUT ACCEPT

    # Windows VM
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp -m tcp --dport 443 -j DNAT --to-destination 192.168.4.100:443
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp -m udp --dport 443 -j DNAT --to-destination 192.168.4.100:443
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.4.100:80
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp -m udp --dport 80 -j DNAT --to-destination 192.168.4.100:80
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp -m tcp --dport 1100 -j DNAT --to-destination 192.168.4.100:22
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp -m udp --dport 1100 -j DNAT --to-destination 192.168.4.100:22

    # Webserver VM
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp -m tcp --dport 3389 -j DNAT --to-destination 192.168.4.101:3389
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp -m udp --dport 3389 -j DNAT --to-destination 192.168.4.101:3389
   
    # Datenbank VM
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp -m tcp --dport 1102 -j DNAT --to-destination 192.168.4.102:22
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp -m udp --dport 1102 -j DNAT --to-destination 192.168.4.102:22
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp -m tcp --dport 3306 -j DNAT --to-destination 192.168.4.102:3306

    # Setup Internet Routing
    post-up iptables -t nat -A PREROUTING -i vmbr0 -d 1.1.1.1
    post-up iptables -t nat -A POSTROUTING -s 192.168.4.0/24 -o vmbr0 -j MASQUERADE
#Proxmox Netzwerk

auto vmbr1
iface vmbr1 inet static
    address 192.168.4.1/24
    netmask 255.255.255.0
    network 192.168.4.0
    broadcast 192.168.4.255
    bridge-ports none
    bridge-stp off
    bridge-fd 0
#LAN Netzwerk

Ich have these VMs with there IP for Intern Network:
1. Webserver (192.168.4.100)
2. Windows (192.168.4.101)
3. Database (192.168.4.102)

I can access to the mysql with 192.168.4.102:3306
but ican´t access to the mysql with public_ip:3306 in my VM from my PC i can use it.
 
Last edited:

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!