about summary refs log tree commit diff stats
path: root/tools/conf/etc/rc.d/blan
diff options
context:
space:
mode:
Diffstat (limited to 'tools/conf/etc/rc.d/blan')
-rwxr-xr-xtools/conf/etc/rc.d/blan93
1 files changed, 44 insertions, 49 deletions
diff --git a/tools/conf/etc/rc.d/blan b/tools/conf/etc/rc.d/blan
index f75d272..f3ea322 100755
--- a/tools/conf/etc/rc.d/blan
+++ b/tools/conf/etc/rc.d/blan
@@ -4,60 +4,55 @@
 #
 
 DEV="br0"
-PHY="enp8s0"
 
-ADDR=10.0.0.1
+ADDR=10.0.0.254
 NET=10.0.0.0
+GW=192.168.1.254
 MASK=24
-GTW=10.0.0.1
-NTAPS=$((`/usr/bin/nproc`-1))
+
+# one tap for each cpu core
+NTAPS=$((`/usr/bin/nproc`))
 
 case $1 in
-	start)
-                /sbin/ip link add name ${DEV} type bridge
-                /sbin/ip link set dev ${DEV} up
-
-                /bin/sleep 0.2s
-                /sbin/ip route flush dev ${PHY}
-                /sbin/ip addr flush dev ${PHY}
-                /sbin/ip link set dev ${PHY} master ${DEV}
-
-                /sbin/ip addr add ${ADDR}/${MASK} dev ${DEV} broadcast +
-
-                for i in `/usr/bin/seq $NTAPS`
-                do
-                    TAP="tap$i"
-                    echo $TAP
-                    /sbin/ip tuntap add ${TAP} mode tap group kvm
-                    /sbin/ip link set ${TAP} up
-                    /bin/sleep 0.2s
-                    #brctl addif $switch $1
-                    /sbin/ip link set ${TAP} master ${DEV}
-                done
-
-		exit 0
-		;;
-	stop)
-
-                for i in `/usr/bin/seq $NTAPS`
-                do
-                    TAP="tap$i"
-		    /sbin/ip link del ${TAP}
-                    echo $TAP
-                done
-
-       		/sbin/ip link set dev ${DEV} down
-		/sbin/ip route flush dev ${DEV}
-		/sbin/ip link del ${DEV}
-		exit 0
-		;;
-	restart)
-		$0 stop
-		$0 start
-		;;
-	*)
-		echo "Usage: $0 [start|stop|restart]"
-		;;
+    start)
+        /sbin/ip link add name ${DEV} type bridge
+        /sbin/ip addr add ${ADDR}/${MASK} dev ${DEV} broadcast +
+        /sbin/ip link set dev ${DEV} up
+        /bin/sleep 0.2s
+
+        for i in `/usr/bin/seq $NTAPS`
+        do
+            TAP="tap$i"
+            echo "Setting up ${TAP} tap interface."
+            /sbin/ip tuntap add ${TAP} mode tap group kvm
+            /sbin/ip link set ${TAP} up
+            /bin/sleep 0.2s
+            /sbin/ip link set ${TAP} master ${DEV}
+        done
+
+        exit 0
+        ;;
+    stop)
+
+        for i in `/usr/bin/seq $NTAPS`
+        do
+            TAP="tap$i"
+            echo "Deleting ${TAP} tap interface."
+            /sbin/ip link del ${TAP}
+        done
+
+        /sbin/ip link set dev ${DEV} down
+        /sbin/ip route flush dev ${DEV}
+        /sbin/ip link del ${DEV}
+        exit 0
+        ;;
+    restart)
+        $0 stop
+        $0 start
+        ;;
+    *)
+        echo "Usage: $0 [start|stop|restart]"
+        ;;
 esac
 
 # End of file