Auto execute OpenVZ commands on mounted/created/started container?

Discussion in 'Questions and Answers' started by ICPH, Feb 9, 2016.

Tags:
  1. ICPH

    ICPH New Member

    161
    2
    Aug 24, 2013
    Hello,


    please can i run some vzctl commands on the OpenVZ VM (VPS) once it is created/bootting/got mounted?


    I would like to enable --netfilter full (vzctl set $CTID --netfilter full --setmode restart --save) on all OpenVZ VMs by default and also enable tun/tap device by default for all new VMs (VPSs) (vzctl set $CTID --devnodes net/tun:rw --capability net_admin:eek:n --save)


    any way to do it automatically after OpenVZ creates VM or VM is booted or is mounted? Thank you
     
    Last edited by a moderator: Feb 9, 2016
  2. Geek

    Geek Technolojesus Verified Provider

    395
    223
    May 31, 2014
    Just vim your /etc/vz/vz.conf and append...

     
    Last edited by a moderator: Dec 31, 2016
  3. Geek

    Geek Technolojesus Verified Provider

    395
    223
    May 31, 2014
    Aww party foul -- stale thread & I fell for it.  Oh well, maybe this'll help someone down the line... there's also:

    Code:
    # iptables inside CT
    IPTABLES="ip_tables ipt_recent iptable_mangle iptable_filter ipt_limit ipt_multiport ipt_tos ipt_TOS ipt_REJECT ipt_REDIRECT ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_LOG ipt_length ip_conntrack ip_conntrack_ftp ip_conntrack_irc ipt_conntrack ipt_state ipt_helper iptable_nat ip_nat_ftp ipt_owner ipt_state"
     
    Last edited by a moderator: Dec 31, 2016