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

Fafa Diliha Romanova fteg at london.com
Thu Mar 10 03:35:45 PST 2005


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" <lists at MHoerich.de>
To: "Fafa Diliha Romanova" <fteg at london.com>
Subject: Re: IPv6 setup script ... doesn't work!!
Date: Thu, 10 Mar 2005 02:02:21 +0100

> 
> # Fafa Diliha Romanova:
> > #     ifconfig gif create
> 
> Try uncommenting this (by removing the '#').
> 
> >      gifconfig gif0 inet 213.187.181.70 213.121.24.85
> 
> Looks like a typo, this is probably just ifconfig.
> 
> 
> >      route add -inet6 default fe80::%gif0
> 
> The shell will mangle this.  Quote it, like 'fe80::%gif0'.
> 
> 
> >      ifconfig fxp0 inet6 2001:618:400:6ad9:: prefixlen 64
> 
> Replace every occurence of fxp0 with your ethernet NIC (i.e. xl0).
> 
> 
> >      sysctl ?w net.inet6.ip6.forwarding=1
>                ^^
> Another typo, this is supposed to be -w.
> 
> 
> >      echo "IPv6 activation complete!" ||
> >      { echo "IPv6 activation failed!" 1>&2; exit 1; }
> >      ;;
> 
> 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
> 
> 
> >      gifconfig gif0 delete
> >      echo "IPv6 deactivation complete!" ||
> >      { echo "IPv6 deactivation failed!" 1>&2; exit 1; }
> >      ;;
> 
> More junk code.
> 
> 
> >   echo "Usage: $0 {start|stop|restart}"
> 
>      echo "Usage: `basename $0` {start|stop|restart}"  1>&2
> 
> 
> > Where did I go wrong?
> 
> You didn't.  The script is rotten.
> 
> Regards,
> Mario

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



More information about the freebsd-questions mailing list