Run script when tap interface of VM connects/disconnects

lousek

New Member
Mar 6, 2012
12
0
1
Hello Forum

I like to run a script when a KVM-VM connects/starts or disconnects/stops its tap-interface.
In syslog, I can see the events for the tap interface:
Start:
Code:
device tap172i0 entered promiscuous mode
vmbr1000: port 5(tap172i0) entering forwarding state
Stop:
Code:
Deleting interface #29 tap172i0

I have tried to insert a simple echo-command into /etc/kvm/kvm-ifup:
Code:
#!/bin/sh

/bin/echo $1 just got up PRE >> /tmp/ifup.txt

switch=$(/sbin/ip route list | awk '/^default / { print $NF }')
/sbin/ifconfig $1 0.0.0.0 promisc up
/sbin/brctl addif ${switch} $1
/bin/echo $1 just got up >> /tmp/ifup.txt

And also in /etc/kvm/kvm-ifdown:
Code:
#!/bin/sh

/bin/echo $1 just got down >> /tmp/ifdown.txt

exit 0

The echo-command in the ifdown-script is executed.
BUT the echo-command in the ifup-script is NOT.

Does Proxmox use any custom ifup-script for the VMs?
How can I achieve to simply run a script when a TAP-interface connects?

KR & Thanks!
lousek