Professional Web Applications Themes

IPv6 setup script ... doesn't work!! - FreeBSD

Hello! I just registered with BTExact, and they sent me ipv6.sh: #!/bin/sh case "$1" in start) # ifconfig gif create gifconfig gif0 inet 213.187.181.70 213.121.24.85 ifconfig gif0 inet6 2001:618:400::d5bb:b546 prefixlen 128 route add -inet6 default fe80::%gif0 ifconfig fxp0 inet6 2001:618:400:6ad9:: prefixlen 64 sysctl ?w net.inet6.ip6.forwarding=1 /usr/sbin/rtadvd fxp0 echo "IPv6 activation complete!" || { echo "IPv6 activation failed!" 1>&2; exit 1; } ;; stop) killall -m rtadvd sysctl -w net.inet6.ip6.forwarding=0 ifconfig fxp0 inet6 2001:618:400:6ad9:: prefixlen 64 delete route delete -inet6 default fe80::%gif0 ifconfig gif0 inet6 2001:618:400::d5bb:b546 prefixlen 128 delete gifconfig gif0 delete echo "IPv6 deactivation complete!" || { echo "IPv6 deactivation ...

  1. #1

    Default IPv6 setup script ... doesn't work!!

    Hello!

    I just registered with BTExact, and they sent me ipv6.sh:

    #!/bin/sh

    case "$1" in

    start)
    # ifconfig gif create
    gifconfig gif0 inet 213.187.181.70 213.121.24.85
    ifconfig gif0 inet6 2001:618:400::d5bb:b546 prefixlen 128
    route add -inet6 default fe80::%gif0
    ifconfig fxp0 inet6 2001:618:400:6ad9:: prefixlen 64
    sysctl ?w net.inet6.ip6.forwarding=1
    /usr/sbin/rtadvd fxp0
    echo "IPv6 activation complete!" ||
    { echo "IPv6 activation failed!" 1>&2; exit 1; }
    ;;

    stop)
    killall -m rtadvd
    sysctl -w net.inet6.ip6.forwarding=0
    ifconfig fxp0 inet6 2001:618:400:6ad9:: prefixlen 64 delete
    route delete -inet6 default fe80::%gif0
    ifconfig gif0 inet6 2001:618:400::d5bb:b546 prefixlen 128 delete
    gifconfig gif0 delete
    echo "IPv6 deactivation complete!" ||
    { echo "IPv6 deactivation failed!" 1>&2; exit 1; }
    ;;

    restart)
    $0 stop
    echo Pausing 5 seconds before restart ...
    sleep 5
    $0 start
    ;;

    *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1

    esac
    exit 0

    I get this when I run it:

    gifconfig: not found
    ifconfig: interface gif0 does not exist
    fe80::%gif0: bad value
    ifconfig: interface fxp0 does not exist
    sysctl: unknown oid '?w'
    IPv6 activation complete!

    I have this configuration in /etc/rc.conf:

    # *** IPv6 configuration
    #
    gif_interfaces="gif0"
    ipv6_enable="YES"
    ipv6_gateway_enable="YES"
    ipv6_defaultrouter="-interface gif0"
    ipv6_network_interfaces="gif0 lnc0 ep0"
    ipv6_firewall_enable="YES"
    ipv6_firewall_type="open"
    rtadvd_enable="YES"
    rtadvd_interfaces="ep0"

    Where did I go wrong?

    Thanks! And all the best,
    -- from Fafa!

    --
    __________________________________________________ _________
    Sign-up for Ads Free at Mail.com
    http://promo.mail.com/adsfreejump.htm

    Fafa Guest

  2. #2

    Default Re: IPv6 setup script ... doesn't work!!

    # Fafa Diliha Romanova: 

    Try uncommenting this (by removing the '#').
     

    Looks like a typo, this is probably just ifconfig.

     

    The shell will mangle this. Quote it, like 'fe80::%gif0'.

     

    Replace every occurence of fxp0 with your ethernet NIC (i.e. xl0).

     
    ^^
    Another typo, this is supposed to be -w.

     

    Eh? So if echo on stdout fails, we're moving to stderr?
    What am I missing here?

    I'd guess the actual intent was more like

    /usr/sbin/rtadvd fxp0
    if [ $? = "0" ]; then
    echo "IPv6 activated."
    else
    echo "IPv6 activation failed." 1>&2
    exit 1
    fi

     

    More junk code.

     

    echo "Usage: `basename $0` {start|stop|restart}" 1>&2

     

    You didn't. The script is rotten.

    Regards,
    Mario
    Mario Guest

  3. #3

    Default Re: IPv6 setup script ... doesn't work!!


    Mario,

    Thank you! I am beyond appreciation and respect to you!
    I feel I also learned a lot about shell scripting while doing this.
    You are truly a kind soul for letting your experience influence
    my life, man. Again, thank you.

    1) How would this setup look in rc.conf?
    Since FreeBSD 5 is all about centralizing, they say,
    I'd appreciate being able to move all my vital configuration
    into one place.

    2) Does this code look OK now then?

    case "$1" in

    start)
    ifconfig gif create
    ifconfig gif0 inet 213.187.181.70 213.121.24.85
    ifconfig gif0 inet6 2001:618:400::d5bb:b546 prefixlen 128
    route add -inet6 default 'fe80::%gif0'
    ifconfig lnc0 inet6 2001:618:400:6ad9:: prefixlen 64
    sysctl -w net.inet6.ip6.forwarding=1
    /usr/sbin/rtadvd lnc0
    if [ $? = "0" ]; then
    echo "IPv6 activated."
    else
    echo "IPv6 activation failed." 1>&2
    exit 1
    fi
    ;;

    stop)
    killall -m rtadvd
    sysctl -w net.inet6.ip6.forwarding=0
    ifconfig fxp0 inet6 2001:618:400:6ad9:: prefixlen 64 delete
    route delete -inet6 default fe80::%gif0
    ifconfig gif0 inet6 2001:618:400::d5bb:b546 prefixlen 128 delete
    ifconfig gif0 delete
    if [ $? = "0" ]; then
    echo "IPv6 deactivated."
    else
    echo "IPv6 deactivation failed" 1>&2
    exit 1
    fi
    ;;

    restart)
    $0 stop
    echo Pausing 5 seconds before restart ...
    sleep 5
    $0 start
    ;;

    *)
    echo "Usage: `basename $0` {start|stop|restart}" 1>&2
    exit 1

    esac
    exit 0

    3) By the way, are you up for hire?

    All the best,
    -- Fafa

    ----- Original Message -----
    From: "Mario Hoerich" <de>
    To: "Fafa Diliha Romanova" <com>
    Subject: Re: IPv6 setup script ... doesn't work!!
    Date: Thu, 10 Mar 2005 02:02:21 +0100
     
    >
    > Try uncommenting this (by removing the '#').

    >
    > Looks like a typo, this is probably just ifconfig.
    >

    >
    > The shell will mangle this. Quote it, like 'fe80::%gif0'.
    >

    >
    > Replace every occurence of fxp0 with your ethernet NIC (i.e. xl0).
    >

    > ^^
    > Another typo, this is supposed to be -w.
    >

    >
    > Eh? So if echo on stdout fails, we're moving to stderr?
    > What am I missing here?
    >
    > I'd guess the actual intent was more like
    >
    > /usr/sbin/rtadvd fxp0
    > if [ $? = "0" ]; then
    > echo "IPv6 activated."
    > else
    > echo "IPv6 activation failed." 1>&2
    > exit 1
    > fi
    >

    >
    > More junk code.
    >

    >
    > echo "Usage: `basename $0` {start|stop|restart}" 1>&2
    >

    >
    > You didn't. The script is rotten.
    >
    > Regards,
    > Mario[/ref]

    --
    __________________________________________________ _________
    Sign-up for Ads Free at Mail.com
    http://promo.mail.com/adsfreejump.htm

    Fafa Guest

Similar Threads

  1. Script doesn't work without Apache::Reload
    By Marko in forum PERL Modules
    Replies: 0
    Last Post: June 17th, 10:47 PM
  2. Replies: 3
    Last Post: October 1st, 08:15 PM
  3. passing parameters to a script doesn't work
    By Sol in forum PHP Development
    Replies: 1
    Last Post: September 23rd, 04:34 AM
  4. Can I setup IPv6 6to4 tunnel on Solaris 8?
    By Peter Bunclark in forum Sun Solaris
    Replies: 0
    Last Post: July 21st, 07:14 AM
  5. Replies: 3
    Last Post: July 3rd, 02:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139