Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

first couple of examples

  • Loading branch information...
commit cae411700b83d01c709b6c0dc72378c5519aee28 1 parent 6adcd65
Daniel Robbins danielrobbins authored

Showing 4 changed files with 108 additions and 0 deletions. Show diff stats Hide diff stats

  1. +1 0  README
  2. +36 0 basic/net.eth0
  3. +48 0 bridge/net.br0
  4. +23 0 bridge/net.eth0
1  README
... ... @@ -0,0 +1 @@
  1 +This directory contains sample network configuration scripts for Funtoo Linux.
36 basic/net.eth0
... ... @@ -0,0 +1,36 @@
  1 +#!/sbin/runscript
  2 +# Copyright 2009 Funtoo Technologies, LLC
  3 +# All rights reserved. Released under the 2-clause BSD license.
  4 +
  5 +IP=192.168.0.10
  6 +NM=255.255.255.0
  7 +GW=192.168.0.1
  8 +INT=eth0
  9 +DOM=example.org
  10 +NS1=a.b.c.d
  11 +NS2=e.f.g.h
  12 +
  13 +depend() {
  14 + provide net
  15 + after net.lo
  16 +}
  17 +
  18 +start() {
  19 + ebegin "Bringing up network interface $INT"
  20 + ifconfig $INT $IP netmask $NM up && \
  21 + route add default gw $GW $INT && \
  22 + resolvconf -a $INT << EOF
  23 +domain $DOM
  24 +nameserver $NS1
  25 +nameserver $NS2
  26 +EOF
  27 + eend $?
  28 +}
  29 +
  30 +stop() {
  31 + ebegin "Shutting down network interface $INT"
  32 + resolvconf -d $INT && \
  33 + route del default gw $GW $INT && \
  34 + ifconfig $INT down
  35 + eend $?
  36 +}
48 bridge/net.br0
... ... @@ -0,0 +1,48 @@
  1 +#!/sbin/runscript
  2 +# Copyright 2009 Funtoo Technologies, LLC
  3 +# All rights reserved. Released under the 2-clause BSD license.
  4 +
  5 +IP=192.168.0.10
  6 +NET=192.168.0.0
  7 +NM=255.255.255.0
  8 +GW=192.168.0.1
  9 +INT=br0
  10 +SLAVE=eth0
  11 +DOM=example.org
  12 +NS1=a.b.c.d
  13 +NS2=e.f.g.h
  14 +
  15 +depend() {
  16 + provide net
  17 + after net.lo
  18 + need net.$SLAVE
  19 + after vz
  20 +}
  21 +
  22 +ezroute() {
  23 + [ "$1" = "add" ] && ebegin "Adding routes for $INT" || ebegin "Deleting routes for $INT"
  24 + route $1 -net $NET netmask $NM $INT
  25 + route $1 default gw $GW
  26 + eend $? && return $?
  27 +}
  28 +
  29 +start() {
  30 + ebegin "Bringing up bridge $INT"
  31 +
  32 + # Note: we set the forwarding delay to zero below. If you are using STP, you should
  33 + # delete this option and enable STP instead.
  34 +
  35 + brctl addbr $INT && \
  36 + brctl addif $INT $SLAVE && \
  37 + brctl setfd $INT 0 && \
  38 + ifconfig $INT up
  39 + eend $?
  40 +}
  41 +
  42 +stop() {
  43 + ebegin "Shuttind down bridge $INT"
  44 + ifconfig $INT down && \
  45 + brctl delbr $INT
  46 + eend $?
  47 +}
  48 +
23 bridge/net.eth0
... ... @@ -0,0 +1,23 @@
  1 +#!/sbin/runscript
  2 +# Copyright 2009 Funtoo Technologies, LLC
  3 +# All rights reserved. Released under the 2-clause BSD license.
  4 +
  5 +INT=eth0
  6 +
  7 +depend() {
  8 + provide net
  9 + after net.lo
  10 +}
  11 +
  12 +start() {
  13 + ebegin "Bringing up network interface $INT"
  14 + ifconfig $INT 0.0.0.0 up
  15 + eend $?
  16 +}
  17 +
  18 +stop() {
  19 + ebegin "Shutting down network interface $INT"
  20 + ifconfig $INT down
  21 + eend $?
  22 +}
  23 +

0 comments on commit cae4117

Please sign in to comment.
Something went wrong with that request. Please try again.