Multiple VMs on different subnets with different VLANs

bmacadre

Member
Jul 8, 2010
7
0
21
Hello,

I've got some trouble to configure my Promox to have multiple VMs operating on different subnets.

I explain :

I've 2 networks :

  • 192.168.145.0/24 GW 192.168.145.1 VLAN ID: 145
  • 192.168.197.0/24 GW 192.168.197.1 VLAN ID: 197
I've 2 Proxmox VE Servers operating in cluster mode :

  • srv-vm-1 => 192.168.145.100
  • srv-vm-2 => 192.168.145.101
Theses servers have 4 network interfaces.

I want to put 3 (perhaps more in future) VMs (OpenVZ containers):

  • vm-mysql => MySQL Server : 192.168.197.110
  • vm-webhosting => Apache Server : 192.168.197.111
  • wm-intranet => Apache Server : 192.168.145.110
These VMs must be accessible with their own IP addresses without any Nat (I've 2 Apache servers on port 80), and i want to migrate them at will from srv-vm-1 to srv-vm-2 (and vice versa).

I've tested a lot of tutorials found on this forum (and on this OpenVZ forum) but nothing work at all

Any Idea ?

Thx
Bruno
 
Last edited:
What problems are you having?

Also - post your /etc/network/interfaces for the hosts and guests. I would suggest you get it working on one machine first, i.e. make sure that one machine can host VMs on both VLANs.

The following is my host /etc/network/interfaces which works great:

Code:
auto lo
iface lo inet loopback

iface eth0 inet manual

auto eth0.15
iface eth0.15 inet static
        address  0.0.0.0
        netmask  0.0.0.0

iface eth1 inet manual

iface eth2 inet manual

iface eth3 inet manual

auto bond1
iface bond1 inet static
        address  172.21.1.101
        netmask  255.255.255.0
        slaves eth2 eth3
        bond_miimon 100
        bond_mode balance-rr

auto vmbr0
iface vmbr0 inet static
        address  THE-PUBLIC-IP
        netmask  255.255.255.240
        gateway  THE-PUBLIC-GW
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0

auto vmbr15
iface vmbr15 inet manual
        bridge_ports eth0.15
        bridge_stp off
        bridge_fd 0

I have a single vyatta VM which does the port forwarding from public IPs to private IPs but the important thing is that this is part of a cluster (/etc/network/interfaces obviously has to have the same network configuration - vmbr0 not withstanding). VMs can communicate on any VLANs and migration just works.

bond1 is for my SAN - I haven't bonded the public gateway yet.
 
Thanks for your answer !

My problem is that i can't use private IP all of my VMs must have a public IP and some services hosted on VM are similar so i can't use port forwarding.

All VLANs are closed so I can't communicate between VLANs my only way is to go through the gateway of the subnet.

I will try your 'interfaces' file tomorrow but if my memory is correct i've already tried a similar configuration without success.
 
Hi,

I've just tested your 'interfaces' file and it doesn't work at all.

My HN /etc/network/interfaces :
Code:
auto lo
iface lo inet loopback

iface eth0 inet manual

iface eth1 inet manual

iface eth2 inet manual

iface eth3 inet manual

auto vmbr0
iface vmbr0 inet static
    address  192.168.145.100
    netmask  255.255.255.0
    gateway  192.168.145.1
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0

auto eth0.145
iface eth0.145 inet static
    address 0.0.0.0
    netmask 0.0.0.0

auto eth0.197
iface eth0.197 inet static
    address 0.0.0.0
    netmask 0.0.0.0

auto vmbr145
iface vmbr145 inet manual
    bridge_ports eth0.145
    bridge_stp off
    bridge_fd 0

auto vmbr197
iface vmbr197 inet manual
    bridge_ports eth0.197
    bridge_stp off
    bridge_fd 0
And my VM /etc/network/interfaces :
Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.145.110
    netmask 255.255.255.0
    gateway 192.168.145.1
This VMs is an OpenVZ container with "bridged" network interface vmbr145.

When I go to this VMs and ping the gateway : nothing happens (100% packet loss).

I don't understand what is wrong...
 
The one difference is that your host and VM are on the same VLAN/subnet ID. I am not sure how you configure that, but I don't think that configuration is right.

If your host can ping the outside world then your VM should probably use vmbr0. You might need to activate port-forwarding (search the forums).
 
Hi,

I've just tested your 'interfaces' file and it doesn't work at all.

My HN /etc/network/interfaces :
Code:
auto lo
iface lo inet loopback

iface eth0 inet manual

iface eth1 inet manual

iface eth2 inet manual

iface eth3 inet manual

auto vmbr0
iface vmbr0 inet static
    address  192.168.145.100
    netmask  255.255.255.0
    gateway  192.168.145.1
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0

auto eth0.145
iface eth0.145 inet static
    address 0.0.0.0
    netmask 0.0.0.0

auto eth0.197
iface eth0.197 inet static
    address 0.0.0.0
    netmask 0.0.0.0

auto vmbr145
iface vmbr145 inet manual
    bridge_ports eth0.145
    bridge_stp off
    bridge_fd 0

auto vmbr197
iface vmbr197 inet manual
    bridge_ports eth0.197
    bridge_stp off
    bridge_fd 0
And my VM /etc/network/interfaces :
Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.145.110
    netmask 255.255.255.0
    gateway 192.168.145.1
This VMs is an OpenVZ container with "bridged" network interface vmbr145.

When I go to this VMs and ping the gateway : nothing happens (100% packet loss).

I don't understand what is wrong...
Hi,
i think the problem is, that you use vlan145 for the server, but don't use them for vmbr0.
Try following:
Code:
auto lo
iface lo inet loopback

iface eth0 inet manual

iface eth1 inet manual

iface eth2 inet manual

iface eth3 inet manual

auto eth0.145
iface eth0.145 inet static
    address 0.0.0.0
    netmask 0.0.0.0

auto eth0.197
iface eth0.197 inet static
    address 0.0.0.0
    netmask 0.0.0.0

auto vmbr0
iface vmbr0 inet static
    address  192.168.145.100
    netmask  255.255.255.0
    gateway  192.168.145.1
    bridge_ports eth0.145
    bridge_stp off
    bridge_fd 0

auto vmbr197
    bridge_ports eth0.197
    bridge_stp off
    bridge_fd 0
connect all vm which use a 192.168.145-Address with vmbr0 and the 197-Address with vmbr197.

That should work. But i'm wonder, that you can access the proxmox-host. Do you use vlan-tagging for vlan145, or is this your default-vlan?

Udo
 
Hi

VLAN 145 is my default VLAN. I will try your 'interfaces' file soon (i'll go back at work thursday).

But if I use vmbr0 for VMs in 145 i'm not sure that they would be accessible cause vmbr0 have an IP affected...

Thx
 

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!