From: tad@plan9.bell-labs.com
To: 9fans@cse.psu.edu
Subject: [9fans] Roaming Plan9 terminal (laptop) network configuration
Date: Mon, 19 Jun 2000 02:41:14 -0400 [thread overview]
Message-ID: <200006190641.CAA14768@cse.psu.edu> (raw)
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
}
reply other threads:[~2000-06-19 6:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200006190641.CAA14768@cse.psu.edu \
--to=tad@plan9.bell-labs.com \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).