2 # ipv6on [netdir ndbfile [gwv4]] - configure an interface for ipv6,
3 # once ipv4 is configured.
5 echo usage: $0 '[netdir ndbfile [gw-v4-name]]' >[1=2]
12 gw=`{ndb/ipquery sys $sysname ipgw | sed 's/ipgw=//'}
19 gw=`{ndb/ipquery sys $sysname ipgw | sed 's/ipgw=//'}
28 xsfx=(-x `{echo $netdir | sed 's;^/net;;'})
32 fn nonnil { # variable
38 echo multiple ips for $1
44 # configure v6 for link-local addresses (fe80::) & multicast (ff02::)
46 if (! ip/ipconfig -6 $xdir ether $netdir/ether?)
47 exit 'ipconfig -6 failed'
48 ip/ipconfig $xdir ether $netdir/ether? ra6 recvra 1
50 mev6=`{ndb/query -f $ndbf sys $sysname ipv6}
51 if (~ $#mev6 0 || ~ $mev6 '')
52 mev6=`{ndb/query -mf $ndbf sys $sysname ip | grep :}
53 # mev4=`{ndb/query -f $ndbf sys $sysname ip | grep -v :}
56 mylnk=`{ip/linklocal `{cat $netdir/ether?/addr}}
60 if (~ $gw [0-9]*.[0-9]*.[0-9]*.[0-9]*)
62 if (~ $#gwv4 0 || ~ $gwv4 '') # assume namev6 and name
63 gwv4=`{ndb/query -f $ndbf sys $gw ip}
64 gwv6=`{ndb/query -f $ndbf sys $gw ipv6}
67 # echo ping gw $gwv4...
68 # load arp cache with gw mac
69 ip/ping -qn 3 $netdir/icmp!$gwv4 >/dev/null >[2=1] &
70 sleep 1 # wait for ping
72 gweth=`{grep '* '^$gwv4^' ' $netdir/arp | awk '{print $4}' }
74 gwlnk=`{ip/linklocal $gweth}
80 # configure my global v6 addresses
82 ip/ipconfig $xdir ether $netdir/ether? add $mev6 /64
83 ip/ipconfig $xdir loopback /dev/null add $mev6 /128
86 if (~ $#gwv6 0 || ~ $gwv6 '')
87 gwv6=`{ip/linklocal $gweth}
90 # add default v6 route to v6 addr of v4 gw
92 echo add :: /0 $gwv6 >$netdir/iproute # need not be link-local