Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- src/initscripts/init.d/macvtap-green | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/initscripts/init.d/macvtap-green
diff --git a/src/initscripts/init.d/macvtap-green b/src/initscripts/init.d/macvtap-green new file mode 100644 index 0000000..2b0e1b1 --- /dev/null +++ b/src/initscripts/init.d/macvtap-green @@ -0,0 +1,52 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/bridge +# +# Description : Skript to use a macvtap device as green0. +# The green0 nic is renamed to greennic0 +# +# Authors : Jonatan Schlag jonatan.schlag@ipfire.org +# +# Version : 01.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + start) + boot_mesg "Create macvtap device for green0..." + #set green nic down + ip link set green0 down + # rename green0 to greennic0 + ip link set green0 name greennic0 + # bring greennic0 up + ip link set greennic0 up + # create the macvtap device for green0 + ip link add link greennic0 green0 type macvlan mode bridge + #bring green0 up + ip link set green0 up + ;; + + stop) + boot_mesg "Remove macvtap device for green0..." + + #bring both devices down + ip link set green0 down + ip link set greennic0 down + #remove the macvtap device + ip link del green0 + # rename the greennic0 to green0 + ip link set greennic0 name green0 + ;; + *) + echo "Usage: ${0} {start|stop}" + exit 1 + ;; +esac + +# End $rc_base/init.d/bridge +