Assigning IP to KVM VPS

kengimel

New Member
Sep 15, 2013
11
0
1
It has been easy to assign via venet, an OVH failover public IP via the webGUI tool which is very quickly picked up.But now having read the Network Model wiki..

I use the below to establish connection from the KVM VPS to the host proxmox server.

post-up echo 1 > /proc/sys/net/ipv4/ip_forward # These are important for NAT access to internet for VMs
post-up iptables -t nat -A POSTROUTING -s '0.0.0.0/24’ -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '0.0.0.0/24’ -o vmbr0 -j MASQUERADE

My question now is.. how can one allocate a public IP to a KVM based VPs. Can this assign be automated ?
 
Last edited:
Hello kengimel,

Assume you have the following configuration (some example values):

- vmbr0 contains
- eth0 connected with internet
- tap777i1 (777=kvm machine id, 1=eth1 in kvm 777)

- your provider offered you at least 2 public addresses:

123.45.67.81 and 123.45.67.82

- 123.45.67.81 is statically assigned to vmbr0

- 123.45.67.82 should be assigned to eth1 in kvm 777

- the easiest way: assign it statically inside kvm 777
but that´s probably not what you want

- the "automatic way" - from the kvm´s point of view:
- inside kvm 777 eth1 expects DHCP
- in PROXMOX server you define a DHCP server which grants 123.45.67.82 to kvm 777
find more details about a similar problem here ("About DHCP" paragraph):
http://forum.proxmox.com/threads/18249-RDP-from-external-IP-to-KVM-(WinSvr-2008)?p=93093#post93093


Best regards

Mr.Holmes