All pastes #346095 Raw Edit

Stuff

public text v1 · immutable
·published 2007-02-09 02:01 UTC
rendered paste body
#!/bin/sh

   DESC="User-mode networking"

   set -e

   case "$1" in
     start)
           echo -n "Starting $DESC"

           brctl addbr br0

           # create TAP device and set it writeable
           tunctl -u <user> -t tap0
           tunctl -u <user> -t tap1
           tunctl -u <user> -t tap2
           chmod 666 /dev/net/tun

           # configure eth and tap to promiscuous mode
           ifconfig eth1 up
           ifconfig tap0 up
           ifconfig tap1 up
           ifconfig tap2 up

           # configure bridge
           brctl stp br0 off
           brctl setfd br0 1
           brctl sethello br0 1

           # add both eth and tap to bridge
           brctl addif br0 eth1
           brctl addif br0 tap0
           brctl addif br0 tap1
           brctl addif br0 tap2

           echo "."
           ;;
     stop)
           echo "."
           ;;
     restart|force-reload)
           $0 stop
           $0 start
           ;;
     *)
           N=/etc/init.d/uml-networking
           # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
           echo "Usage: $N {start|stop|restart|force-reload}" >&2
           exit 1
           ;;
   esac

   exit 0


/etc/init.d/uml-networking