[SOLVED] Execute host command after starting guest.

das1996

Member
May 26, 2021
67
10
13
124
Last edited:
After some more research discovered the concept of hookscripts. There's several different states, for this purpose "POST-START" seemed most appropriate. Maybe there's a simpler more elegant way of doing this?

The process involves the following

1) Enable snippets
Datacenter, storage, local
under content, highlight snippets

2) copy hookscript example to snippets
cp /usr/share/pve-docs/examples/guest-example-hookscript.pl /var/lib/vz/snippets/somefilename.pl

3) edit /var/lib/vz/snippets/somefilename.pl
Under POST-START

add the following - adjust id/interface as needed
Code:
    # set bridge flags to pass eapol traffic
        system("echo 8 > /sys/class/net/vmbr1/bridge/group_fwd_mask");
        system("echo 8 > /sys/class/net/fwbr105i1/bridge/group_fwd_mask");

4) associate script with guest vm
qm set 105 --hookscript local:snippets/somefilename.pl
 
  • Like
Reactions: pvps1