This allows setting confguration settings via environment more easily.
Configure setup via configuration file /etc/grml/routersetup.
To specify which DEVICES should be bridged, use BRIDGE_DEVICES, e.g.
- BRIDGE_DEVICES="eth0 eth1"
+ BRIDGE_DEVICES="eth0 eth2"
-would bridge device eth0 and eth1.
+would bridge device eth0 and eth2.
+If unconfigured then 'eth0 eth1' is assumed as default.
Note: The auto interface name is not allowed here!
To specify the name of the bridge, use BRIDGE_NAME, e.g.
BRIDGE_STP="no"
-Per default stp is on.
+Per default STP is set to 'on'.
Example Configuration file:
# configuration for grml-router:
# IPTABLES=/sbin/iptables # the iptables binary
-OUTDEV='auto' # outgoing device [auto|default|eth0|...]
+# OUTDEV='auto' # outgoing device [auto|default|eth0|...]
# configuration for grml-bridge and grml-sniff:
# BRCTL=/usr/sbin/brctl # the brctl binary
-BRIDGE_NAME='br0' # name used for the bridge
-BRIDGE_DEVICES='eth0 eth1' # the devices used for bilding the bridge
-STP='on' # enable STP (Spanning-Tree Protocol)? on|off
-BRIDGE_CONFIG='DHCP' # Use DHCP, Fixed IP or Ipless? DHCP|FIXED|NONE
-BRIDGE_IP="192.168.1.1/24" # ip address used for bridge
+# BRIDGE_NAME='br0' # name used for the bridge
+# BRIDGE_DEVICES='eth0 eth1' # the devices used for bilding the bridge
+# BRIDGE_STP='on' # enable STP (Spanning-Tree Protocol)? on|off
+# BRIDGE_CONFIG='DHCP' # Use DHCP, Fixed IP or Ipless? DHCP|FIXED|NONE
+# BRIDGE_IP="192.168.1.1/24" # IP address used for bridge
# configuration for grml-ap:
# AP_DEVICE='wlan0' # device used as access point
check4root || exit 1
-if ! [ -r "$CONFIG_FILE" ] ; then
- eerror "$CONFIG_FILE could not be read."
- exit 1
+if [ -r "$CONFIG_FILE" ] ; then
+ . "$CONFIG_FILE"
+else
+ ewarn "Could not read $CONFIG_FILE"
fi
-. "$CONFIG_FILE"
-
+# defaults if unconfigured
[ -n "$AP_ESSID" ] || AP_ESSID=grml-ap
[ -n "$AP_ENC" ] || AP_ENC=off
check4root || exit 1
-if ! [ -r "$CONFIG_FILE" ] ; then
- eerror "$CONFIG_FILE could not be read."
- exit 1
+if [ -r "$CONFIG_FILE" ] ; then
+ . "$CONFIG_FILE"
+else
+ ewarn "Could not read $CONFIG_FILE"
fi
-. "$CONFIG_FILE"
-
-if [ -z "$BRIDGE_DEVICES" ] ; then
- eerror "Bridge devices (\$BRIDGE_DEVICES) not set in $CONFIG_FILE"
- exit 1
-fi
-
-[ -n "$BRCTL" ] || BRCTL=brctl
-[ -n "$STP" ] || STP=on
-[ -n "$BRIDGE_NAME" ] || BRIDGE_NAME=br0
+# defaults if unconfigured
+[ -n "$BRCTL" ] || BRCTL=brctl
+[ -n "$BRIDGE_STP" ] || BRIDGE_STP=on
+[ -n "$BRIDGE_NAME" ] || BRIDGE_NAME=br0
+[ -n "$BRIDGE_DEVICES" ] || BRIDGE_DEVICES='eth0 eth1'
check4progs $BRCTL || exit 1
no|false)
;;
*)
- einfo "Setting Spanning-Tree Protocol (STP) to status $STP"
- brctl stp "$BRIDGE_NAME" $STP
+ einfo "Setting Spanning-Tree Protocol (STP) to status $BRIDGE_STP"
+ brctl stp "$BRIDGE_NAME" "$BRIDGE_STP"
eend $?
;;
esac
check4root || exit 1
-if ! [ -r $CONFIG_FILE ] ; then
- eerror "$CONFIG_FILE could not be read."
- exit 1
+if [ -r "$CONFIG_FILE" ] ; then
+ . "$CONFIG_FILE"
+else
+ ewarn "Could not read $CONFIG_FILE"
fi
-. $CONFIG_FILE
-
-if [ -z "$OUTDEV" ] ; then
- eewarn "Outgoing device is not set in $CONFIG_FILE"
- eewarn "Setting Outgoing device to auto"
- OUTDEV=auto
-fi
+# defaults if unconfigured
+[ -n "$OUTDEV" ] || OUTDEV=auto
+[ -n "$IPTABLES" ] || IPTABLES=/sbin/iptables
case "$OUTDEV" in
- auto|default)
+ auto|default)
OUTDEV=$(defaultGWDev)
if [ -z "$OUTDEV" ] ; then
- eerror "The outgoing device could not be determined."
- eerror "Please adjust OUTDEV in $CONFIG_FILE"
- exit 1
+ eerror "The outgoing device could not be determined."
+ eerror "Please adjust OUTDEV in $CONFIG_FILE or set OUTDEV as environment variable"
+ exit 1
fi
;;
esac
-[ -n "$IPTABLES" ] || IPTABLES=/sbin/iptables
-
check4progs $IPTABLES || exit 1
case "$1" in
einfo "Configure via $CONFIG_FILE - see man 8 grml-sniff" ; eend 0
}
-if ! [ -r "$CONFIG_FILE" ] ; then
- eerror "$CONFIG_FILE could not be read."
- exit 1
-fi
-
-. "$CONFIG_FILE"
-
-if [ -z "$BRIDGE_DEVICES" ] ; then
- eerror "Bridge devices (\$BRIDGE_DEVICES) not set in $CONFIG_FILE"
- exit 1
+if [ -r "$CONFIG_FILE" ] ; then
+ . "$CONFIG_FILE"
+else
+ ewarn "Could not read $CONFIG_FILE"
fi
+# defaults if unconfigured
[ -n "$BRCTL" ] || BRCTL='brctl'
[ -n "$BRIDGE_NAME" ] || BRIDGE_NAME='br0'
[ -n "$BRIDGE_DEVICES" ] || BRIDGE_DEVICES='eth0 eth1'