ipv6 autoconfiguration on ethernet
for ip autoconfiguration, setup ipv6 link local addresses and do SLAAC in parallel to DHCP.
This commit is contained in:
parent
ab4c0a012f
commit
cd752a39f8
6 changed files with 44 additions and 22 deletions
10
rc/bin/cpurc
10
rc/bin/cpurc
|
@ -62,9 +62,13 @@ if(test -r /net/ipselftab){
|
||||||
addr=`{cat $ether/addr}
|
addr=`{cat $ether/addr}
|
||||||
switch($addr){
|
switch($addr){
|
||||||
case $addrs
|
case $addrs
|
||||||
# try /lib/ndb first, then do dhcp
|
# try /lib/ndb first, then do dhcp/slaac
|
||||||
ip/ipconfig -N ether $ether >[2]/dev/null \
|
ip/ipconfig -6 ether $ether
|
||||||
|| ip/ipconfig -h $sysname ether $ether
|
ip/ipconfig -N ether $ether >[2]/dev/null || @{
|
||||||
|
ip/ipconfig ether $ether ra6 recvra 1 &
|
||||||
|
ip/ipconfig -h $sysname ether $ether &
|
||||||
|
wait
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,10 @@ case go
|
||||||
echo 'Please choose a method for configuring your ethernet connection.'
|
echo 'Please choose a method for configuring your ethernet connection.'
|
||||||
echo
|
echo
|
||||||
echo ' manual - specify IP address, network mask, gateway IP address'
|
echo ' manual - specify IP address, network mask, gateway IP address'
|
||||||
echo ' dhcp - use DHCP to automatically configure'
|
echo ' automatic - use DHCP and SLAAC to automatically configure'
|
||||||
echo
|
echo
|
||||||
|
|
||||||
prompt -d dhcp 'Configuration method' manual dhcp
|
prompt -d automatic 'Configuration method' manual automatic
|
||||||
ethermethod=$rd
|
ethermethod=$rd
|
||||||
gwaddr=xxx
|
gwaddr=xxx
|
||||||
ipaddr=xxx
|
ipaddr=xxx
|
||||||
|
@ -26,11 +26,11 @@ case go
|
||||||
export DNSSERVER
|
export DNSSERVER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export ethermethod gwaddr ipaddr ipmask dhcphost
|
export ethermethod gwaddr ipaddr ipmask
|
||||||
exec ./startether go
|
exec ./startether go
|
||||||
|
|
||||||
case checkdone
|
case checkdone
|
||||||
if(! ~ $ethermethod manual dhcp) {
|
if(! ~ $ethermethod manual automatic) {
|
||||||
configether=notdone
|
configether=notdone
|
||||||
export configether
|
export configether
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ etheraddr=`{cat $netdev/addr >[2]/dev/null}
|
||||||
|
|
||||||
switch($1){
|
switch($1){
|
||||||
case checkready checkdone
|
case checkready checkdone
|
||||||
if(~ $#etheraddr 1 && ~ $netisfrom ether && ~ $ethermethod dhcp manual && \
|
if(~ $#etheraddr 1 && ~ $netisfrom ether && ~ $ethermethod automatic manual && \
|
||||||
! grep -s $etheraddr /n/newfs/lib/ndb/local)
|
! grep -s $etheraddr /n/newfs/lib/ndb/local)
|
||||||
ndbsetup=ready
|
ndbsetup=ready
|
||||||
if not
|
if not
|
||||||
|
@ -33,7 +33,7 @@ case go
|
||||||
|
|
||||||
echo
|
echo
|
||||||
switch($ethermethod){
|
switch($ethermethod){
|
||||||
case dhcp
|
case automatic
|
||||||
echo $se
|
echo $se
|
||||||
case manual
|
case manual
|
||||||
echo $se 'ip='^$ipaddr 'ipmask='^$ipmask 'ipgw='^$gwaddr
|
echo $se 'ip='^$ipaddr 'ipmask='^$ipmask 'ipgw='^$gwaddr
|
||||||
|
|
|
@ -15,11 +15,16 @@ case go
|
||||||
exit
|
exit
|
||||||
|
|
||||||
log starting ethernet $ethermethod config
|
log starting ethernet $ethermethod config
|
||||||
|
ip/ipconfig -6
|
||||||
switch($ethermethod) {
|
switch($ethermethod) {
|
||||||
case manual
|
case manual
|
||||||
ip/ipconfig -g $gwaddr ether $netdev $ipaddr $ipmask >>[2]/srv/log
|
ip/ipconfig -g $gwaddr ether $netdev $ipaddr $ipmask >>[2]/srv/log
|
||||||
case dhcp
|
case automatic
|
||||||
ip/ipconfig >>[2]/srv/log
|
>>[2]/srv/log @{
|
||||||
|
ip/ipconfig ra6 recva 1 &
|
||||||
|
ip/ipconfig &
|
||||||
|
wait
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case checkdone
|
case checkdone
|
||||||
|
|
|
@ -63,9 +63,13 @@ if(test -r /net/ipselftab){
|
||||||
addr=`{cat $ether/addr}
|
addr=`{cat $ether/addr}
|
||||||
switch($addr){
|
switch($addr){
|
||||||
case $addrs
|
case $addrs
|
||||||
# try /lib/ndb first, then do dhcp
|
# try /lib/ndb first, then do dhcp/slaac
|
||||||
ip/ipconfig -N ether $ether >[2]/dev/null \
|
ip/ipconfig -6 ether $ether
|
||||||
|| ip/ipconfig -h $sysname ether $ether
|
ip/ipconfig -N ether $ether >[2]/dev/null || @{
|
||||||
|
ip/ipconfig ether $ether ra6 recvra 1 &
|
||||||
|
ip/ipconfig -h $sysname ether $ether &
|
||||||
|
wait
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,16 @@ fn confignet{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
must ip/ipconfig -p $*
|
if(~ $1 ether && ~ $#* 2) @{
|
||||||
|
ip/ipconfig -6 $*
|
||||||
|
ip/ipconfig $* ra6 recvra 1 &
|
||||||
|
ip/ipconfig -p $* &
|
||||||
|
wait
|
||||||
|
}
|
||||||
|
if not {
|
||||||
|
ip/ipconfig -p $*
|
||||||
|
}
|
||||||
|
|
||||||
if(~ $#fs 0)
|
if(~ $#fs 0)
|
||||||
fs=`{awk -F'=' '/^[ ]*fs=/{print $2}' /net/ndb}
|
fs=`{awk -F'=' '/^[ ]*fs=/{print $2}' /net/ndb}
|
||||||
if(~ $#auth 0)
|
if(~ $#auth 0)
|
||||||
|
@ -33,13 +42,13 @@ fn confignet{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# set bootstrap authservers for factotum
|
# publish info in /net/ndb for factotum
|
||||||
if(! ~ $#auth 0){
|
>> /net/ndb {
|
||||||
grep -v '^[ ]*auth=' /net/ndb >/env/x
|
echo
|
||||||
cat /env/x <{echo ' auth='^$auth^'
|
echo 'ipbootinfo='
|
||||||
'} >/net/ndb
|
for(i in $fs) echo ' fs='^$i
|
||||||
rm /env/x
|
for(i in $auth) echo ' auth='^$i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn connecttcp{
|
fn connecttcp{
|
||||||
|
|
Loading…
Reference in a new issue