aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsysconfig/network-scripts/ifdown4
-rwxr-xr-xsysconfig/network-scripts/ifdown-ipv657
-rwxr-xr-xsysconfig/network-scripts/ifdown-sit42
-rwxr-xr-xsysconfig/network-scripts/ifup6
-rwxr-xr-xsysconfig/network-scripts/ifup-ipv656
-rwxr-xr-xsysconfig/network-scripts/ifup-sit41
-rw-r--r--sysconfig/network-scripts/network-functions-ipv6341
-rw-r--r--sysconfig/static-routes-ipv614
8 files changed, 561 insertions, 0 deletions
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index 3a7074ba..f055b944 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -38,6 +38,10 @@ if [ -x $OTHERSCRIPT ]; then
exec $OTHERSCRIPT $CONFIG $2
fi
+if [ "${NETWORKING_IPV6}" = "yes" ]; then
+ /etc/sysconfig/network-scripts/ifdown-ipv6 $DEVICE
+fi
+
# Check to make sure the device is actually up
check_device_down && exit 0
diff --git a/sysconfig/network-scripts/ifdown-ipv6 b/sysconfig/network-scripts/ifdown-ipv6
new file mode 100755
index 00000000..5d443cf1
--- /dev/null
+++ b/sysconfig/network-scripts/ifdown-ipv6
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+# ifdown-ipv6
+#
+# Taken from scripts from:
+#
+# (P) & (C) 2000 Peter Bieringer <pb@bieringer.de>
+# some hints taken from RedHat scripts
+
+. /etc/sysconfig/network
+
+cd /etc/sysconfig/network-scripts
+. network-functions
+
+CONFIG=$1
+[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
+source_config
+
+# Test if IPv6 configuration is enabled
+if [ ! "$IPV6INIT" = "yes" ]; then
+ # not enabled, stop here
+ exit 0
+fi
+
+# Test if IPv6 is up
+if [ "${NETWORKING_IPV6}" = "yes" ]; then
+ . /etc/sysconfig/network-scripts/network-functions-ipv6
+
+ # Delete additional static IPv6 routes on specified interface
+ if [ -f /etc/sysconfig/static-routes-ipv6 ]; then
+ grep "^$DEVICE" /etc/sysconfig/static-routes-ipv6 | while read device args; do
+ if [ "$device" = "$DEVICE" ]; then
+ ifdown_ipv6_route $args $DEVICE
+ fi
+ done
+ fi
+
+ # Delete tunnel
+ if ! [ -z "$IPV6TUNNELIPV4" -o -z "$IPV6TUNNELROUTE" ]; then
+ ifdown_ipv6_tunnel $DEVICE $IPV6TUNNELIPV4 $IPV6TUNNELROUTE
+ fi
+
+ # Shutdown additional (1) IPv6 address on specified interface
+ if ! [ -z "$IPV6ADDR_0" -o -z "$IPV6PREFIXLENGTH_0" ]; then
+ ifdown_ipv6_real $DEVICE $IPV6ADDR_0 $IPV6PREFIXLENGTH_0
+ fi
+
+ # Shutdown additional (2) IPv6 address on specified interface
+ if ! [ -z "$IPV6ADDR_1" -o -z "$IPV6PREFIXLENGTH_1" ]; then
+ ifdown_ipv6_real $DEVICE $IPV6ADDR_1 $IPV6PREFIXLENGTH_1
+ fi
+
+ # Shutdown IPv6 address on specified interface
+ if ! [ -z "$IPV6ADDR" -o -z "$IPV6PREFIXLENGTH" ]; then
+ ifdown_ipv6_real $DEVICE $IPV6ADDR $IPV6PREFIXLENGTH
+ fi
+fi
diff --git a/sysconfig/network-scripts/ifdown-sit b/sysconfig/network-scripts/ifdown-sit
new file mode 100755
index 00000000..fb345359
--- /dev/null
+++ b/sysconfig/network-scripts/ifdown-sit
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# ifdown-sit
+#
+# Taken from:
+#
+# (P) & (C) 2000 Peter Bieringer <pb@bieringer.de>
+# some hints taken from RedHat scripts
+
+. /etc/sysconfig/network
+
+cd /etc/sysconfig/network-scripts
+. network-functions
+
+CONFIG=$1
+[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
+source_config
+
+# Test if IPv6 configuration is enabled
+if [ ! "$IPV6INIT" = "yes" ]; then
+ # not enabled, stop here
+ exit 0
+fi
+
+# Test if IPv6 is up
+if [ "${NETWORKING_IPV6}" = "yes" ]; then
+ . /etc/sysconfig/network-scripts/network-functions-ipv6
+
+ # Delete additional static IPv6 routes on specified interface
+ if [ -f /etc/sysconfig/static-routes-ipv6 ]; then
+ grep "^$DEVICE" /etc/sysconfig/static-routes-ipv6 | while read device ipv6route args; do
+ if [ "$device" = "$DEVICE" ]; then
+ ifdown_ipv6_tunnel $DEVICE $IPV6TUNNELIPV4 $ipv6route
+ fi
+ done
+ fi
+
+ # Delete tunnel
+ if ! [ -z "$IPV6TUNNELIPV4" -o -z "$IPV6TUNNELROUTE" ]; then
+ ifdown_ipv6_tunnel $DEVICE $IPV6TUNNELIPV4 $IPV6TUNNELROUTE
+ fi
+fi
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index 0e5ee116..e70eea30 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -163,6 +163,12 @@ fi
. /etc/sysconfig/network
+# IPv6 initialisation?
+if [ "${NETWORKING_IPV6}" = "yes" ]; then
+ /etc/sysconfig/network-scripts/ifup-ipv6 $DEVICE
+fi
+
+
if [ "${IPX}" = yes ]; then
/etc/sysconfig/network-scripts/ifup-ipx ${DEVICE}
fi
diff --git a/sysconfig/network-scripts/ifup-ipv6 b/sysconfig/network-scripts/ifup-ipv6
new file mode 100755
index 00000000..23d02eb8
--- /dev/null
+++ b/sysconfig/network-scripts/ifup-ipv6
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# ifup-ipv6
+#
+# Taken from:
+#
+# (P) & (C) 2000 Peter Bieringer <pb@bieringer.de>
+
+. /etc/sysconfig/network
+
+cd /etc/sysconfig/network-scripts
+. network-functions
+
+CONFIG=$1
+[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
+source_config
+
+# Test if IPv6 configuration is enabled
+if [ ! "$IPV6INIT" = "yes" ]; then
+ # not enabled, stop here
+ exit 0
+fi
+
+# Test if IPv6 is up
+if [ "${NETWORKING_IPV6}" = "yes" ]; then
+ . /etc/sysconfig/network-scripts/network-functions-ipv6
+
+ # Setup IPv6 address on specified interface
+ if ! [ -z "$IPV6ADDR" -o -z "$IPV6PREFIXLENGTH" ]; then
+ ifup_ipv6_real $DEVICE $IPV6ADDR $IPV6PREFIXLENGTH
+ fi
+
+ # Setup additional (1) IPv6 address on specified interface
+ if ! [ -z "$IPV6ADDR_0" -o -z "$IPV6PREFIXLENGTH_0" ]; then
+ ifup_ipv6_real $DEVICE $IPV6ADDR_0 $IPV6PREFIXLENGTH_0
+ fi
+
+ # Setup additional (2) IPv6 address on specified interface
+ if ! [ -z "$IPV6ADDR_1" -o -z "$IPV6PREFIXLENGTH_1" ]; then
+ ifup_ipv6_real $DEVICE $IPV6ADDR_1 $IPV6PREFIXLENGTH_1
+ fi
+
+ # Setup additional static IPv6 routes on specified interface
+ [ -f /etc/sysconfig/static-routes-ipv6 ]; then
+ grep "^$DEVICE" /etc/sysconfig/static-routes-ipv6 | while read device args; do
+ if [ "$device" = "$DEVICE" ]; then
+ ifup_ipv6_route $args $DEVICE
+ fi
+ done
+ fi
+
+ # Setup tunnel
+ if ! [ -z "$IPV6TUNNELIPV4" -o -z "$IPV6TUNNELROUTE" ]; then
+ ifup_ipv6_tunnel $DEVICE $IPV6TUNNELIPV4 $IPV6TUNNELROUTE
+ fi
+fi
diff --git a/sysconfig/network-scripts/ifup-sit b/sysconfig/network-scripts/ifup-sit
new file mode 100755
index 00000000..a7c5a315
--- /dev/null
+++ b/sysconfig/network-scripts/ifup-sit
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# ifup-sit
+#
+# Taken from:
+# (P) & (C) 2000 Peter Bieringer <pb@bieringer.de>
+# some hints taken from RedHat scripts
+
+. /etc/sysconfig/network
+
+cd /etc/sysconfig/network-scripts
+. network-functions
+
+CONFIG=$1
+[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
+source_config
+
+# Test if IPv6 configuration is enabled
+if [ ! "$IPV6INIT" = "yes" ]; then
+ # not enabled, stop here
+ exit 0
+fi
+
+# Test if IPv6 is up
+if [ "${NETWORKING_IPV6}" = "yes" ]; then
+ . /etc/sysconfig/network-scripts/network-functions-ipv6
+
+ # Setup tunnel
+ if ! [ -z "$IPV6TUNNELIPV4" -o -z "$IPV6TUNNELROUTE" ]; then
+ ifup_ipv6_tunnel $DEVICE $IPV6TUNNELIPV4 $IPV6TUNNELROUTE
+ fi
+
+ # Add additional static IPv6 routes on specified interface
+ if [ -f /etc/sysconfig/static-routes-ipv6 ]; then
+ grep "^$DEVICE" /etc/sysconfig/static-routes-ipv6 | while read device ipv6route args; do
+ if [ "$device" = "$DEVICE" ]; then
+ ifup_ipv6_tunnel $DEVICE $IPV6TUNNELIPV4 $ipv6route
+ fi
+ done
+ fi
+fi
diff --git a/sysconfig/network-scripts/network-functions-ipv6 b/sysconfig/network-scripts/network-functions-ipv6
new file mode 100644
index 00000000..71c0f005
--- /dev/null
+++ b/sysconfig/network-scripts/network-functions-ipv6
@@ -0,0 +1,341 @@
+#!/bin/sh
+#
+# network-functions-ipv6
+#
+# Taken from:
+# (P) & (C) 1997-2000 Peter Bieringer <pb@bieringer.de>
+
+# DEBUG_IPV6 & 1 "set -x" mode
+# DEBUG_IPV6 & 2 prevents from executing any network configuration
+# DEBUG_IPV6 & 4 shows messages in the test section
+
+#DEBUG_IPV6=$[ 65535 - 1 -2 -4]
+DEBUG_IPV6=0
+
+# Return values
+# 0 = ok
+# 1 = error occurs
+# 2 = not enabled, i.e. no IPv6 kernel support or switched off by configuration
+
+##### Test for IPv6 capabilites
+
+function test_ipv6()
+{
+ if [ -z $DEBUG_IPV6 ] ; then DEBUG_IPV6=0; fi
+
+ if ! [ $[ $DEBUG_IPV6 & 4 ] = 0 ] ; then
+ echo " Tests for IPv6"
+ fi
+
+ # Test for IPv6 kernel
+ if ! [ $[ $DEBUG_IPV6 & 4 ] = 0 ] ; then
+ echo -n " Test kernel for IPv6..."
+ fi
+
+ if ! [ -f /proc/net/if_inet6 ]; then
+ echo "Do not found IPv6 in kernel, try to load module"
+ modprobe ipv6
+
+ if ! [ -f /proc/net/if_inet6 ]; then
+ if ! [ $[ $DEBUG_IPV6 & 4 ] = 0 ] ; then
+ echo "Not compiled for IPv6 - stop!"
+ else
+ echo "Kernel not compiled for IPv6 - stop!"
+ fi
+ return 2
+ fi
+ else
+ if ! [ $[ $DEBUG_IPV6 & 4 ] = 0 ] ; then
+ echo " Ok!"
+ fi
+ fi
+
+ # Test for IPv6 enabled needed binaries
+ if ! [ $[ $DEBUG_IPV6 & 4 ] = 0 ] ; then
+ echo n " Test binaries for IPv6 capability..."
+ fi
+
+ if ! ifconfig -? 2>&1 | grep -q "(IPv6)"; then
+ echo "'`which ifconfig`' (net-tools) not compiled for IPv6 - stop!"
+ return 2
+ fi
+
+ if ! route -? 2>&1 | grep -q "(IPv6)"; then
+ echo "'`which route`' (net-tools) not compiled for IPv6 - stop!"
+ return 2
+ fi
+
+ if ! [ $[ $DEBUG_IPV6 & 4 ] = 0 ] ; then
+ echo " Ok!"
+ fi
+
+ # Info about executing
+ if [ $[ $DEBUG_IPV6 > 0 ] = 1 ]; then
+ echo " Executing in DEBUG_IPV6 mode: $DEBUG_IPV6"
+ fi
+}
+
+##### Static route configuration
+
+# Display usage
+function ifup_ipv6_route_usage() {
+ echo $"Usage: $0 IPv6-network IPv6-gateway [device]"
+}
+
+# set route
+function ifup_ipv6_route() {
+ networkipv6=$1
+ gatewayipv6=$2
+ device=$3 # maybe empty
+
+ if [ -z $networkipv6 ]; then
+ echo $"Missing option IPv6-network'"
+ ifup_ipv6_route_usage
+ return 1
+ fi
+
+ if [ -z $gatewayipv6 ]; then
+ echo $"Missing option 'IPv6-gateway'"
+ ifup_ipv6_route_usage
+ return 1
+ fi
+
+ # Run IPv6 test
+ test_ipv6 || return
+
+ [ $[ $DEBUG_IPV6 & 1 ] = 0 ] || set -x
+
+ if [ -z $device ]; then
+ route -A inet6 add $networkipv6 gw $gatewayipv6
+ else
+ route -A inet6 add $networkipv6 gw $gatewayipv6 dev $device
+ fi
+
+ [ $[ $DEBUG_IPV6 & 1 ] = 0 ] || set +x
+}
+
+# delete route
+function ifdown_ipv6_route() {
+ networkipv6=$1
+ gatewayipv6=$2
+ device=$3 # maybe empty
+
+ if [ -z $networkipv6 ]; then
+ echo $"Missing option IPv6-network'"
+ ifup_ipv6_route_usage
+ return 1
+ fi
+
+ if [ -z $gatewayipv6 ]; then
+ echo $"Missing option 'IPv6-gateway'"
+ ifup_ipv6_route_usage
+ return 1
+ fi
+
+ # Run IPv6 test
+ test_ipv6 || return
+
+ [ $[ $DEBUG_IPV6 & 1 ] = 0 ] || set -x
+
+ if [ -z $device ]; then
+ route -A inet6 del $networkipv6 gw $gatewayipv6
+ else
+ route -A inet6 del $networkipv6 gw $gatewayipv6 dev $device
+ fi
+
+ [ $[ $DEBUG_IPV6 & 1 ] = 0 ] || set +x
+}
+
+
+##### tunnel configuration
+
+# Display usage
+function ifup_ipv6_tunnel_usage() {
+ echo $"Usage: $0 interfacename IPv4-tunneladdress IPv6-route"
+}
+
+## Configure tunnels up
+function ifup_ipv6_tunnel() {
+ device=$1
+ addressipv4tunnel=$2
+ routeipv6=$3
+
+ if [ -z $device ]; then
+ echo $"Missing option 'device'"
+ ifup_ipv6_tunnel_usage
+ return 1
+ fi
+
+ if [ -z $addressipv4tunnel ]; then
+ echo $"Missing option 'IPv4-tunneladdress'"
+ ifup_ipv6_tunnel_usage
+ return 1
+ fi
+
+ if [ -z $routeipv6 ]; then
+ echo $"Missing option 'IPv6-route'"
+ ifup_ipv6_tunnel_usage
+ return 1
+ fi
+
+ # Run IPv6 test
+ test_ipv6 || return
+
+ [ $[ $DEBUG_IPV6 & 1 ] = 0 ] || set -x
+
+ # enable IPv6-over-IPv4 tunnels
+ if ifconfig sit0 | grep -q "UP "; then
+ # already up, do nothing
+ true
+ else
+ # basic tunnel device to up
+ if [ $[ $DEBUG_IPV6 & 2 ] = 0 ] ; then
+ ifconfig sit0 up
+ fi
+ fi
+
+ if [ $[ $DEBUG_IPV6 & 2 ] = 0 ]; then
+ # Set up a tunnel
+ route -A inet6 add $routeipv6 gw ::$addressipv4tunnel dev sit0
+ fi
+
+ [ $[ $DEBUG_IPV6 & 1 ] = 0 ] || set +x
+}
+
+## Configure tunnels down
+
+function ifdown_ipv6_tunnel() {
+ device=$1
+ addressipv4tunnel=$2
+ routeipv6=$3
+
+ if [ -z $device ]; then
+ echo $"Missing option 'device'"
+ ifup_ipv6_tunnel_usage
+ return 1
+ fi
+
+ if [ -z $addressipv4tunnel ]; then
+ echo $"Missing option 'IPv4-tunneladdress'"
+ ifup_ipv6_tunnel_usage
+ return 1
+ fi
+
+ if [ -z $routeipv6 ]; then
+ echo $"Missing option 'IPv6-route'"
+ ifup_ipv6_tunnel_usage
+ return 1
+ fi
+
+ # Run IPv6 test
+ test_ipv6 || return
+
+ [ $[ $DEBUG_IPV6 & 1 ] = 0 ] || set -x
+
+ if [ $[ $DEBUG_IPV6 & 2 ] = 0 ]; then
+ # Set up a tunnel
+ route -A inet6 del $routeipv6 gw ::$addressipv4tunnel dev sit0
+ fi
+
+ # disable IPv6-over-IPv4 tunnels (if no longer a tunnel is up)
+ if route -A inet6 -n | grep sit0 | grep -v -q "^::"; then
+ # existing routes, do nothing
+ true
+ else
+ # basic tunnel device to down
+ if [ $[ $DEBUG_IPV6 & 2 ] = 0 ] ; then
+ ifconfig sit0 down
+ fi
+ fi
+
+ [ $[ $DEBUG_IPV6 & 1 ] = 0 ] || set +x
+}
+
+
+##### Interface configuration
+
+# Display usage
+function ifup_ipv6_usage() {
+ echo $"Usage: $0 interfacename IPv6-address IPv6-prefixlength"
+}
+
+## Configure interfaces up
+function ifup_ipv6_real() {
+ device=$1
+ address=$2
+ prefixlength=$3
+
+ if [ -z $device ]; then
+ echo $"Missing option 'device'"
+ ifup_ipv6_usage
+ return 1
+ fi
+
+ if [ -z $address ]; then
+ echo $"Missing option 'IPv6-address'"
+ ifup_ipv6_usage
+ return 1
+ fi
+
+ if [ -z $prefixlength ]; then
+ echo $"Missing option 'Prefixlength'"
+ ifup_ipv6_usage
+ return 1
+ fi
+
+ # Run IPv6 test
+ test_ipv6 || return
+
+ [ $[ $DEBUG_IPV6 & 1 ] = 0 ] || set -x
+
+ if [ $[ $DEBUG_IPV6 & 2 ] = 0 ]; then
+ ifconfig $device add $address/$length || return 2
+ fi
+
+ if [ $[ $DEBUG_IPV6 & 2 ] = 0 ]; then
+ route -A inet6 add $address/$prefixlength dev $device || return 2
+ fi
+
+ [ $[ $DEBUG_IPV6 & 1 ] = 0 ] || set +x
+}
+
+
+## Configure interfaces down
+function ifdown_ipv6_real() {
+ device=$1
+ address=$2
+ prefixlength=$3
+
+ if [ -z $device ]; then
+ echo $"Missing option 'device'"
+ ifup_ipv6_usage
+ return 1
+ fi
+
+ if [ -z $address ]; then
+ echo $"Missing option 'IPv6-address'"
+ ifup_ipv6_usage
+ return 1
+ fi
+
+ if [ -z $prefixlength ]; then
+ echo $"Missing option 'Prefixlength'"
+ ifup_ipv6_usage
+ return 1
+ fi
+
+ # Run IPv6 test
+ test_ipv6 || return
+
+ [ $[ $DEBUG_IPV6 & 1 ] = 0 ] || set -x
+
+
+ if [ $[ $DEBUG_IPV6 & 2 ] = 0 ]; then
+ route -A inet6 del $address/$prefixlength dev $device || return 2
+ fi
+ if [ $[ $DEBUG_IPV6 & 2 ] = 0 ]; then
+ ifconfig $device del $address/$length || return 2
+ fi
+
+ [ $[ $DEBUG_IPV6 & 1 ] = 0 ] || set +x
+}
diff --git a/sysconfig/static-routes-ipv6 b/sysconfig/static-routes-ipv6
new file mode 100644
index 00000000..c47e7079
--- /dev/null
+++ b/sysconfig/static-routes-ipv6
@@ -0,0 +1,14 @@
+# file: static-routes-ipv6
+#
+# description: this file contains all static IPv6 routes
+# description: Here you can specify several routes to specified gateways
+#
+# (P) & (C) 2000 Peter Bieringer <pb@bieringer.de>
+#
+# Changes to
+# 20000704: initial taken from my network-ip6.conf
+
+#Device IPv6 network to route IPv6 gateway address
+#eth0 fec0:0:0:2::/64 fec0:0:0:1:0:0:0:20
+#eth0 3ffe::/16 3ffe:0400:0100:f102:0:0:0:1
+sit1 2001::/16