Virtualisation with OpenVZ

Published: Wednesday, Dec 26, 2007 Last modified: Monday, May 10, 2021

I do not recommend OpenVZ user vserver instead! You need the openvz patched kernel:

deb etch main

See what resources the Virtual Environment (VE) is using:

sudo vzcalc -v 100

What VEs are currently running?

sudo vzlist

Start the machine:

sudo vzctl start 100

Stop the machine:

sudo vzctl stop 100

Get inside:

sudo vzctl enter 100

Create a machine called simon:

sudo debootstrap --arch i386 etch /var/lib/vz/private/100

sudo vzctl set 100 --applyconfig vps.basic --save

sudo vzctl set 100 --ipadd --nameserver --hostname simon --save

More on networking: The guide was: So we create openvz VEs (virtual machines) with private addresses like in this test case. Then I’ll use the IP of eth0:0, I want to setup a VE with lighttpd. This is a good guide to setting up a Debian VE /usr/share/doc/vzctl/README.Debian, though in future I’ll like to make a template. So I am going to setup a VE with

this sets up networking for the VE

sudo iptables -t nat -A POSTROUTING -s -o eth0 -j SNAT –to

This gets outside Internet access working

sudo iptables -t nat -A PREROUTING -p tcp -d –dport 80 -i eth0 -j DNAT –to-destination It works well! Increasing disk space and memory allocation:

sudo vzctl set 100 --diskspace 10G --save

sudo vzctl set 100 --vmguarpages $((256 * 256)) --save

sudo vzctl set 100 --privvmpages $((256 * 1024)) --save