Table of Contents

OpenVZ

Virtualisation with OpenVZ

Common tasks

I use 101 as the vpsid in these expamples.

start, stop, restart, status

vzctl start 101
vzctl stop 101 [--fast]
vzctl restart 101
vzctl status 101

run command inside VPS

vzctl exec someprog 101
vzctl exec2 someprog 101

enter a VPS

vzctl enter 101

set configuration/parameters for VPS

vzctl set 101 --setting_name value [--save]

vzctl set 101 --ipadd 192.168.2.101 --save

list VPSs

Usage:  vzlist [-a | -S] [-n] [-H] [-o field[,field...] | -1] [-s [-]field]
               [-h pattern] [-N pattern] [-d pattern] [CTID [CTID ...]]
        vzlist -L | --list

Options:
        -a, --all               list all containers
        -S, --stopped           list stopped containers
        -n, --name              display containers' names
        -H, --no-header         suppress columns header
        -o, --output            output only specified fields
        -1                      synonym for -H -octid
        -s, --sort              sort by the specified field
                                ('-field' to reverse sort order)
        -h, --hostname          filter CTs by hostname pattern
        -N, --name_filter       filter CTs by name pattern
        -d, --description       filter CTs by description pattern
        -L, --list              get possible field names

Networking

Connecting eth1 of VPS 102 to vmbr1 - if not specified, vmbr0 would be chosen by default.

vzctl set 102 --netif_add eth1,,,,vmbr1 --save

In the config file this will show up like something like this:

102.conf
[...]

NETIF="ifname=eth0,mac=6A:56:49:75:98:33,host_ifname=veth102.0,host_mac=00:18:51:41:48:12;ifname=eth1,bridge=vmbr1,mac=00:18:51:50:40:54,host_ifname=veth102.1,host_mac=00:18:51:2E:FD:57"
virtual/openvz.txt · Last modified: 2012-03 by tb
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready