plan9fox/rc/bin/inst/configether
cinap_lenrek cd752a39f8 ipv6 autoconfiguration on ethernet
for ip autoconfiguration, setup ipv6 link local addresses
and do SLAAC in parallel to DHCP.
2018-08-15 21:39:30 +02:00

41 lines
985 B
Bash
Executable file

#!/bin/rc
# desc: configure your internet connection via an ethernet card
switch($1) {
case go
echo
echo 'Please choose a method for configuring your ethernet connection.'
echo
echo ' manual - specify IP address, network mask, gateway IP address'
echo ' automatic - use DHCP and SLAAC to automatically configure'
echo
prompt -d automatic 'Configuration method' manual automatic
ethermethod=$rd
gwaddr=xxx
ipaddr=xxx
ipmask=xxx
if(~ $ethermethod manual){
prompt 'ip address'; ipaddr=$rd
prompt 'network mask'; ipmask=$rd
prompt 'gateway address'; gwaddr=$rd
export ipaddr ipmask gwaddr
if(~ $#DNSSERVER 0){
prompt -d $gwaddr 'dns server'; DNSSERVER=$rd
export DNSSERVER
}
}
export ethermethod gwaddr ipaddr ipmask
exec ./startether go
case checkdone
if(! ~ $ethermethod manual automatic) {
configether=notdone
export configether
}
if(~ $ethermethod manual && ~ 0 $#ipaddr $#ipmask $#gwaddr) {
configether=notdone
export configether
}
}