setup IPs for VMs in Proxmox

zimrain

New Member
Oct 7, 2009
1
0
1
Hello,

I have a Server with a installed Proxmox.

There is a vmbr0 with the ip 123.123.123.10

When i create a VM (KVM, not OpenVZ) how can i give it the IP 123.123.123.20 ?

Which MAC-adress is seen outside, the mac from vmbr0 or the mac from the virtualnetworkcard in the vm?

Is a special networkconfiguration required in the guest-system?

thank you.
 
Last edited:
For a KVM virtual machine, just set the IP address up in the guest as you would with a physical machine.

For OpenVZ, the IP address is set from the Proxmox web interface.
 
  • Like
Reactions: janmir
Just a bit more details about the above installation:

It's a Proxmox 1.4b2 server. We created a KVM VM with network options "Bridge" (vmbr0).

Network settings on Proxmox-Host (default after installation):

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

iface eth0 inet manual

auto vmbr0
iface vmbr0 inet static
	address  189.149.217.112
	netmask  255.255.255.0
	gateway  189.149.217.1
	bridge_ports eth0
	bridge_stp off
	bridge_fd 0

(these are just example-IPs, but the schema is the same on the Proxmox-Host: a static IP and a Gateway on the same network with the adress .1)

So now I have a second static IP, let's name her 178.159.114.146. I would like to build a KVM-VM and assign the IP to it, so the network settings look like this at the moment:

Code:
auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet static
	address 178.159.114.146
	netmask 255.255.255.0
	network 178.159.114.0
	broadcast 178.159.114.255
	gateway 178.159.114.1
	dns-nameservers 178.177.176.34
	dns-search mydns.de

Unfortunatly this doesn't work. After some search on google I used the IP "189.149.217.112" (the IP of vmbr0) as gateway and executed the following commands on the Proxmox Host:

Code:
route add 178.159.114.146 dev vmbr0
echo 1 > /proc/sys/net/ipv4/conf/vmbr0/proxy_arp

Now the proxmox Host can ping the VM and the VM to proxmox, but it's not possible to reach the VM from outside or to ping an internet-host from the VM :-(

Do we also need to activate IPv4/IPv6 Forwarding in /etc/sysctl.conf ?

We like to keep things simple - we have some physical machines running with their static IPs and want to convert them to KVM-Images on the Proxmox-Host. It would be perfect if we don't need to change anything in the network-configuration of the VM, just on the proxmox-host - is this possible? All physical servers will be on different networks, do we have to define several bridge-devices in this case (vmbr0, vmbr1, ...) ?
 
Code:
auto lo
iface lo inet loopback
 
allow-hotplug eth0
iface eth0 inet static
    address 178.159.114.146
    netmask 255.255.255.0
    network 178.159.114.0
    broadcast 178.159.114.255
    gateway 178.159.114.1
    dns-nameservers 178.177.176.34
    dns-search mydns.de

Unfortunatly this doesn't work.

Why not? Try to use tcpdump to debug.