Notes to Self

Proxmox 3.1 on hetzner.de, OpenVZ and VMs with internal IPs

Just in case you have been wondering how to run your own virtualized servers without knowing much about network setup: Get your root server at Hetzner.de, install the (unofficial and unsupported) Proxmox 3.1 server image, and start creating OpenVZ containers (NOT KVM machines) with internal IPs such as 192.168.0.1. Proxmox does all the hard work for you, using the super-simple “venet” network setup. The VMs already have access to the internet, all you have to do is to route incoming IP traffic from port to port:

iptables -t nat -A PREROUTING -p tcp -d host_ip_address --dport port_num \
  -i eth0 -j DNAT --to-destination ve_address:dst_port_num

After having read tutorial after tutorial containing very complicated bridged and routed network setups, I was surprised that it was so easy. Hope this helps.

Advertisements

2 thoughts on “Proxmox 3.1 on hetzner.de, OpenVZ and VMs with internal IPs

  1. One problem that I just stumbled upon: in the above mentioned setup, the root LVM partition is limited to 15GB by default, which resulted in the the clients having only a fraction of the disk size available of what I assigned to them in the GUI. Make sure to remove this default value during the setup (please leave a comment if you know how). Or extend the disk later (this works without having to reboot):

    lvextend -L+100G /dev/vg0/root
    resize2fs /dev/vg0/root

    I found suggestions to use lvresize instead of lvextend, and to create and use extra LV instead of increasing the root volume. If you have an opinion on this, please leave a comment. In any case, the above commands did the trick and the clients now have the proper disk size available.

  2. The claim “The VMs already have access to the internet” is incorrect. You have to connect the VM first, using

    iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j SNAT –to XX.XX.XX.XX

    Replace 192.168.0.0 with the subnet you are using and XX.XX.XX.XX. with the IP address of the main node.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s