VMs cannot access services hosted on LXC Containers (Connection Timed Out)

murph900

New Member
Aug 23, 2023
1
0
1
As stated in the title, my VMs I set up on my proxmox host cannot access services hosted on LXC containers on the same proxmox host.
I encountered this problem now with my Git server hosted in an LXC container and a PostgreSQL server in another LXC container.
I want to access these services from a VM running Debian 11 hosting my docker services.

What I tried so far:
  • Accessing these services from another LXC container or from an outside remote computer such as my desktop PC or laptop (Win10 and Debian12) is not a problem.
  • Ping between VM and LXC works.
  • Using nc -v10.0.105.157 5432 for example to access psql port works from the router, node shell and other LXC but returns connection timed out if ran from the VM
  • Installing psql on the VM and trying to connect to a database on the LXC container also returns connection timed out
  • The same goes trying to connect to my Gitea server hosted on another LXC container
  • All firewalls in Proxmox should be off on datacenter, node and guest level
  • The VMs and the LXCs should be in the same subnet/VLAN (10.0.105.0/24)
  • My (OPNsense) router firewall is currently configured to allow all traffic on all ports between hosts in that subnet/vlan for testing purposes.

I assume I misconfigured something in my network interface of the VM and my apologies if it is something obvious but I have been looking for weeks and cannot figure it out.


VM​


/etc/network/interfaces

Code:
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens18
iface ens18 inet static
        address 10.0.105.155
        netmask 255.255.255.0
        gateway 10.0.105.1
        dns-nameservers 10.0.105.1



LXC​


/etc/network/interfaces

Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 10.0.105.151/32
# --- BEGIN PVE ---
        post-up ip route add 10.0.105.1 dev eth0
        post-up ip route add default via 10.0.105.1 dev eth0
        pre-down ip route del default via 10.0.105.1 dev eth0
        pre-down ip route del 10.0.105.1 dev eth0
# --- END PVE ---




Proxmox Node​


/etc/network/interfaces

Code:
auto lo
iface lo inet loopback

auto enp6s0f3
iface enp6s0f3 inet manual

iface eno1 inet manual

iface eno2 inet manual

iface eno3 inet manual

iface eno4 inet manual

auto enp6s0f0
iface enp6s0f0 inet manual

auto enp6s0f1
iface enp6s0f1 inet manual

auto enp6s0f2
iface enp6s0f2 inet manual

auto bond0
iface bond0 inet manual
        bond-slaves enp6s0f0 enp6s0f1
        bond-miimon 100
        bond-mode balance-rr
#Bond for link between nodes

auto vmbr1
iface vmbr1 inet static
        address 10.0.105.130/32
        bridge-ports bond0
        bridge-stp off
        bridge-fd 0
        bridge-vlan-aware yes
        bridge-vids 2-4094
#Bridge between nodes

auto vmbr0
iface vmbr0 inet static
        address 10.0.105.110/32
        gateway 10.0.105.1
        bridge-ports enp6s0f3
        bridge-stp off
        bridge-fd 0
        bridge-vlan-aware yes
        bridge-vids 2-4094
 
As stated in the title, my VMs I set up on my proxmox host cannot access services hosted on LXC containers on the same proxmox host.
I encountered this problem now with my Git server hosted in an LXC container and a PostgreSQL server in another LXC container.
I want to access these services from a VM running Debian 11 hosting my docker services.

What I tried so far:
  • Accessing these services from another LXC container or from an outside remote computer such as my desktop PC or laptop (Win10 and Debian12) is not a problem.
  • Ping between VM and LXC works.
  • Using nc -v10.0.105.157 5432 for example to access psql port works from the router, node shell and other LXC but returns connection timed out if ran from the VM
  • Installing psql on the VM and trying to connect to a database on the LXC container also returns connection timed out
  • The same goes trying to connect to my Gitea server hosted on another LXC container
  • All firewalls in Proxmox should be off on datacenter, node and guest level
  • The VMs and the LXCs should be in the same subnet/VLAN (10.0.105.0/24)
  • My (OPNsense) router firewall is currently configured to allow all traffic on all ports between hosts in that subnet/vlan for testing purposes.

I assume I misconfigured something in my geometry dash subzero network interface of the VM and my apologies if it is something obvious but I have been looking for weeks and cannot figure it out.


VM​


/etc/network/interfaces

Code:
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens18
iface ens18 inet static
        address 10.0.105.155
        netmask 255.255.255.0
        gateway 10.0.105.1
        dns-nameservers 10.0.105.1



LXC​


/etc/network/interfaces

Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 10.0.105.151/32
# --- BEGIN PVE ---
        post-up ip route add 10.0.105.1 dev eth0
        post-up ip route add default via 10.0.105.1 dev eth0
        pre-down ip route del default via 10.0.105.1 dev eth0
        pre-down ip route del 10.0.105.1 dev eth0
# --- END PVE ---




Proxmox Node​


/etc/network/interfaces

Code:
auto lo
iface lo inet loopback

auto enp6s0f3
iface enp6s0f3 inet manual

iface eno1 inet manual

iface eno2 inet manual

iface eno3 inet manual

iface eno4 inet manual

auto enp6s0f0
iface enp6s0f0 inet manual

auto enp6s0f1
iface enp6s0f1 inet manual

auto enp6s0f2
iface enp6s0f2 inet manual

auto bond0
iface bond0 inet manual
        bond-slaves enp6s0f0 enp6s0f1
        bond-miimon 100
        bond-mode balance-rr
#Bond for link between nodes

auto vmbr1
iface vmbr1 inet static
        address 10.0.105.130/32
        bridge-ports bond0
        bridge-stp off
        bridge-fd 0
        bridge-vlan-aware yes
        bridge-vids 2-4094
#Bridge between nodes

auto vmbr0
iface vmbr0 inet static
        address 10.0.105.110/32
        gateway 10.0.105.1
        bridge-ports enp6s0f3
        bridge-stp off
        bridge-fd 0
        bridge-vlan-aware yes
        bridge-vids 2-4094
I think these topics can help you.
https://forum.proxmox.com/threads/vm-and-lxc-mount-cifs-problem-solved.64157/
https://forum.proxmox.com/threads/lxc-container-wont-start.75038/
 
VM
address 10.0.105.155
netmask 255.255.255.0

That's same as:

address 10.0.105.155/24

LXC
address 10.0.105.151/32

The /32 means this LXC is its own network? Like:

address 10.0.105.151
netmask 255.255.255.255

Did you mean the LXC address to be 10.0.105.151/24 so it's same network as the VM? Or do I misunderstand what you are trying to do?
 

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!