PDA

View Full Version : How to change way HyperVM create new OpenVZ VPS?



Fli
01-23-2016, 09:49 AM
Im having CentOS 6 and HyperVM on OpenVZ

Anyone knows hot i can enable all iptables modules and set a few other things to all newly created openvz VPSs?

In my case VPSs are created automatically thru WHMCS which connects to HyperVM server to initiate setup.

THis is the commands i have to do manually so far:

vzctl set <container_ID> --netfilter full --save
vzctl set <container_ID> --devnodes net/tun:rw --capability net_admin:on --save
vzctl set $ctid --ioprio $ioprio --save
vzctl set $ctid --iolimit $iolimit --save
vzctl set $ctid --iopslimit $iopslimit --save

example:
vzctl set $VPSID --netfilter full --save
vzctl set $VPSID --devnodes net/tun:rw --capability net_admin:on --save
vzctl set $VPSID --ioprio 3 --save
vzctl set $VPSID --iolimit 5M --save
vzctl set $VPSID --iopslimit 20 --save

Is there any HyperVM config. file where i can set this?

Update: yes, there is solution: Do command cat /etc/vz/vz.conf|grep CONFIGFILE

sample output: CONFIGFILE="vswap-256m"

and edit file that has "vswap-256m" inside its name. File should be in /etc/vz/conf . In my case was named "ve-vswap-256m.conf-sample" and i added into it following lines making sure there is no duplicate:

# i added these manually
DEVNODES="net/tun:rw "
DEVICES=""
CAPABILITY=" NET_ADMIN:on"
# IOLIMIT 5MB r/w per second
IOLIMIT="5242880"
IOPSLIMIT="20"

and modiffied netfilter="stateless" to netfilter="full" so i can use NAT inside VPS