Jesus Galan Lopez (yiyus)man page and launch scriptscf2d55616 years agoHistory
33 lines · 736 B · Text
RawDownload
#!/bin/sh# tap: set up/down a tap device fatal() { echo $* 1>&2; exit 1; }usage="usage: tap cmd [args]" cmd=$1shift || fatal $usageuser=`whoami` # Create the tap device with tunctliface=`sudo tunctl -b -u $user`# or openvpn#iface=tap0#sudo openvpn --mktun --dev $iface --user $user # Bring the tap device upsudo /sbin/ifconfig $iface 0.0.0.0 up # Add it to the bridgesudo /usr/sbin/brctl addif br0 $iface # Launch 9vx (use -F to not fork)$cmd "$@" -F "ether0=type=tap dev=$iface" # Bring the tap device down and disconnect from br0sudo /sbin/ifconfig $iface downsudo /usr/sbin/brctl delif br0 $iface # Remove the tap device with tunctlsudo tunctl -d $iface &> /dev/null# or openvpn#sudo openvpn --rmtun --dev $1