* [9fans] Roaming Plan9 terminal (laptop) network configuration
@ 2000-06-19 6:41 tad
0 siblings, 0 replies; only message in thread
From: tad @ 2000-06-19 6:41 UTC (permalink / raw)
To: 9fans
I just threw the attached little script together
to make network configuration easy for any number of
roaming ethernet (non-dhcp and dhcp) configurations.
1) edit /rc/bin/termrc, comment out the 'ip/ipconfig'
line, and replace it with an invocation of
'/rc/bin/netconfig'.
2) netconfig will prompt you to enter a system name,
If you just hit return, it will default to DHCP.
the system name you enter must exist in your ndb
database (/lib/ndb/local, probably) looking
something like this:
ipnet=home-net ip=192.168.100.0 ipmask=255.255.255.0
dnsdomain=cs.bell-labs.com
dnsdomain=research.bell-labs.com
dns=135.1.1.150
ipgw=192.168.100.105
dns=135.1.1.150
#
# ipgw and ipmask set here so /rc/bin/netconfig can
# find them. (I don't currently know a better way
# to get from the sysname to the network record above)
#
ip=192.168.100.103 sys=think ether=0060973ff2ae
ipgw=192.168.100.105
ipmask=255.255.255.0
dom=think.lackawanna.net
Note that you don't need the separate 'home-net' entry,
you could have put the dnsdomain and dns server entries
in the 'sys=think' entry.
--------------- /rc/bin/netconfig ------------------
#!/bin/rc
fn run {
echo $*
eval $*
}
fn try {
ip=`{ndb/query sys $1 ip}
if(~ $#ip 0) {
echo no ip address for $1
echo fail
}
ipgw=`{ndb/query sys $1 ipgw}
if(~ $#ipgw 0) {
echo warning: no ip gateway for $1 >[1=2]
gw=''
}
if not
gw='-g'$ipgw
ipmask=`{ndb/query sys $1 ipmask}
if(~ $#ipmask 0) {
echo no ip mask for $1 >[1=2]
echo fail
}
run ip/ipconfig $gw ether /net/ether0 add $ip $ipmask >[1=2]
echo ok
}
while() {
echo -n 'system name [dhcp]: '
x=`{read}
if(~ $#x 0) {
echo ip/ipconfig -dD
exit
}
ok=`{try $x}
if(~ $ok ok)
exit
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-06-19 6:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-19 6:41 [9fans] Roaming Plan9 terminal (laptop) network configuration tad
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).