[1108] | 1 | #!/bin/sh |
---|
| 2 | # |
---|
| 3 | # ifup-sit |
---|
| 4 | # |
---|
| 5 | # |
---|
| 6 | # Taken from: |
---|
| 7 | # (P) & (C) 2000-2003 by Peter Bieringer <pb@bieringer.de> |
---|
| 8 | # |
---|
| 9 | # You will find more information on the initscripts-ipv6 homepage at |
---|
| 10 | # http://www.deepspace6.net/projects/initscripts-ipv6.html |
---|
| 11 | # |
---|
| 12 | # RHL integration assistance by Pekka Savola <pekkas@netcore.fi> |
---|
| 13 | # |
---|
| 14 | # Version: 2003-09-08 |
---|
| 15 | # |
---|
| 16 | # Uses following information from /etc/sysconfig/network: |
---|
| 17 | # IPV6_DEFAULTDEV=<device>: controls default route (optional) |
---|
| 18 | # IPV6_DEFAULTGW=<address>: controls default route (optional) |
---|
| 19 | # |
---|
| 20 | # Uses following information from /etc/sysconfig/network-scripts/ifcfg-$1: |
---|
| 21 | # DEVICE=<device> |
---|
| 22 | # IPV6INIT=yes|no: controls IPv6 configuration for this interface |
---|
| 23 | # IPV6_MTU=<MTU for IPv6>: controls IPv6 MTU for this link (optional) |
---|
| 24 | # |
---|
| 25 | # For static tunnels |
---|
| 26 | # IPV6TUNNELIPV4=<IPv4 address>: IPv4 address of remote tunnel endpoint |
---|
| 27 | # IPV6TUNNELIPV4LOCAL=<IPv4 address>: (optional) local IPv4 address of tunnel |
---|
| 28 | # IPV6ADDR=<IPv6 address>[/<prefix length>]: (optional) local IPv6 address of a numbered tunnel |
---|
| 29 | # IPV6ADDR_SECONDARIES="<IPv6 address>[/<prefix length>] ..." (optional) additional local IPv6 addresses |
---|
| 30 | # |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | . /etc/sysconfig/network |
---|
| 34 | |
---|
| 35 | cd /etc/sysconfig/network-scripts |
---|
[2573] | 36 | . /etc/sysconfig/network-scripts/network-functions |
---|
[1108] | 37 | |
---|
| 38 | CONFIG=$1 |
---|
| 39 | [ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG |
---|
| 40 | source_config |
---|
| 41 | |
---|
| 42 | # IPv6 don't need aliases anymore, config is skipped |
---|
| 43 | REALDEVICE=`echo ${DEVICE} | sed 's/:.*//g'` |
---|
| 44 | [ "$DEVICE" != "$REALDEVICE" ] && exit 0 |
---|
| 45 | |
---|
| 46 | # Test whether IPv6 configuration is enabled for this interface, else stop |
---|
| 47 | [ "$IPV6INIT" = "yes" ] || exit 0 |
---|
| 48 | |
---|
| 49 | [ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1 |
---|
| 50 | . /etc/sysconfig/network-scripts/network-functions-ipv6 |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | # IPv6 test, module loaded, exit if system is not IPv6-ready |
---|
| 54 | ipv6_test || exit 1 |
---|
| 55 | |
---|
| 56 | # Generic tunnel device sit0 is not supported here |
---|
| 57 | if [ "$DEVICE" = "sit0" ]; then |
---|
| 58 | echo $"Device '$DEVICE' isn't supported here, use IPV6_AUTOTUNNEL setting and restart (IPv6) networking" |
---|
| 59 | exit 1 |
---|
| 60 | fi |
---|
| 61 | |
---|
| 62 | if [ -z "$IPV6TUNNELIPV4" ]; then |
---|
| 63 | echo $"Missing remote IPv4 address of tunnel, configuration is not valid" |
---|
| 64 | exit 1 |
---|
| 65 | fi |
---|
| 66 | |
---|
| 67 | # Test device status |
---|
| 68 | ipv6_test_device_status $DEVICE |
---|
| 69 | if [ $? = 0 ]; then |
---|
| 70 | # device is already up |
---|
| 71 | echo $"Device '$DEVICE' is already up, please shutdown first" |
---|
| 72 | exit 1 |
---|
| 73 | fi |
---|
| 74 | |
---|
| 75 | # Create tunnel |
---|
| 76 | ipv6_add_tunnel_device $DEVICE $IPV6TUNNELIPV4 "" $IPV6TUNNELIPV4LOCAL || exit 1 |
---|
| 77 | |
---|
| 78 | # Set IPv6 MTU, if given |
---|
| 79 | if [ -n "$IPV6_MTU" ]; then |
---|
| 80 | ipv6_set_mtu $DEVICE $IPV6_MTU |
---|
| 81 | fi |
---|
| 82 | |
---|
| 83 | # Apply local IPv6 address, if given (numbered tunnel) |
---|
| 84 | if [ -n "$IPV6ADDR" ]; then |
---|
| 85 | ipv6_add_addr_on_device $DEVICE $IPV6ADDR |
---|
| 86 | fi |
---|
| 87 | |
---|
| 88 | # Setup additional IPv6 addresses from list, if given |
---|
| 89 | if [ -n "$IPV6ADDR_SECONDARIES" ]; then |
---|
| 90 | for ipv6addr in $IPV6ADDR_SECONDARIES; do |
---|
| 91 | ipv6_add_addr_on_device $DEVICE $ipv6addr |
---|
| 92 | done |
---|
| 93 | fi |
---|
| 94 | |
---|
| 95 | # Setup default IPv6 route, check are done by function |
---|
| 96 | if [ -n "$IPV6_DEFAULTDEV" -o -n "$IPV6_DEFAULTGW" ]; then |
---|
| 97 | ipv6_set_default_route "$IPV6_DEFAULTGW" "$IPV6_DEFAULTDEV" "$DEVICE" |
---|
| 98 | fi |
---|
| 99 | |
---|
| 100 | # Setup additional static IPv6 routes on specified interface, if given |
---|
| 101 | if [ -f /etc/sysconfig/static-routes-ipv6 ]; then |
---|
| 102 | LC_ALL=C grep -w "^$DEVICE" /etc/sysconfig/static-routes-ipv6 | while read device ipv6route args; do |
---|
| 103 | ipv6_add_route $ipv6route :: $DEVICE |
---|
| 104 | done |
---|
| 105 | fi |
---|
| 106 | |
---|
| 107 | # Setup additional static IPv6 routes (newer config style) |
---|
| 108 | if [ -f "/etc/sysconfig/network-scripts/route6-$REALDEVICE" ]; then |
---|
| 109 | cat "/etc/sysconfig/network-scripts/route6-$REALDEVICE" | sed 's/#.*//g' | grep -v '^[[:space:]]*$' | while read line; do |
---|
| 110 | ipv6_exec_ip -6 route add $line |
---|
| 111 | done |
---|
| 112 | fi |
---|