Browse files

first couple of examples

  • Loading branch information...
1 parent 6adcd65 commit cae411700b83d01c709b6c0dc72378c5519aee28 @danielrobbins danielrobbins committed Jul 27, 2009
Showing with 108 additions and 0 deletions.
  1. +1 −0 README
  2. +36 −0 basic/net.eth0
  3. +48 −0 bridge/net.br0
  4. +23 −0 bridge/net.eth0
View
1 README
@@ -0,0 +1 @@
+This directory contains sample network configuration scripts for Funtoo Linux.
View
36 basic/net.eth0
@@ -0,0 +1,36 @@
+#!/sbin/runscript
+# Copyright 2009 Funtoo Technologies, LLC
+# All rights reserved. Released under the 2-clause BSD license.
+
+IP=192.168.0.10
+NM=255.255.255.0
+GW=192.168.0.1
+INT=eth0
+DOM=example.org
+NS1=a.b.c.d
+NS2=e.f.g.h
+
+depend() {
+ provide net
+ after net.lo
+}
+
+start() {
+ ebegin "Bringing up network interface $INT"
+ ifconfig $INT $IP netmask $NM up && \
+ route add default gw $GW $INT && \
+ resolvconf -a $INT << EOF
+domain $DOM
+nameserver $NS1
+nameserver $NS2
+EOF
+ eend $?
+}
+
+stop() {
+ ebegin "Shutting down network interface $INT"
+ resolvconf -d $INT && \
+ route del default gw $GW $INT && \
+ ifconfig $INT down
+ eend $?
+}
View
48 bridge/net.br0
@@ -0,0 +1,48 @@
+#!/sbin/runscript
+# Copyright 2009 Funtoo Technologies, LLC
+# All rights reserved. Released under the 2-clause BSD license.
+
+IP=192.168.0.10
+NET=192.168.0.0
+NM=255.255.255.0
+GW=192.168.0.1
+INT=br0
+SLAVE=eth0
+DOM=example.org
+NS1=a.b.c.d
+NS2=e.f.g.h
+
+depend() {
+ provide net
+ after net.lo
+ need net.$SLAVE
+ after vz
+}
+
+ezroute() {
+ [ "$1" = "add" ] && ebegin "Adding routes for $INT" || ebegin "Deleting routes for $INT"
+ route $1 -net $NET netmask $NM $INT
+ route $1 default gw $GW
+ eend $? && return $?
+}
+
+start() {
+ ebegin "Bringing up bridge $INT"
+
+ # Note: we set the forwarding delay to zero below. If you are using STP, you should
+ # delete this option and enable STP instead.
+
+ brctl addbr $INT && \
+ brctl addif $INT $SLAVE && \
+ brctl setfd $INT 0 && \
+ ifconfig $INT up
+ eend $?
+}
+
+stop() {
+ ebegin "Shuttind down bridge $INT"
+ ifconfig $INT down && \
+ brctl delbr $INT
+ eend $?
+}
+
View
23 bridge/net.eth0
@@ -0,0 +1,23 @@
+#!/sbin/runscript
+# Copyright 2009 Funtoo Technologies, LLC
+# All rights reserved. Released under the 2-clause BSD license.
+
+INT=eth0
+
+depend() {
+ provide net
+ after net.lo
+}
+
+start() {
+ ebegin "Bringing up network interface $INT"
+ ifconfig $INT 0.0.0.0 up
+ eend $?
+}
+
+stop() {
+ ebegin "Shutting down network interface $INT"
+ ifconfig $INT down
+ eend $?
+}
+

0 comments on commit cae4117

Please sign in to comment.