Two Lunix servers : storm (debian etch) and momo (OpenSBD) on 10.0.0.1 and 192.168.9.14
eric is running in qemu on storm, storm is behind n NATs (where n > 1)
storm gets its external ip via DHCP from the first NAT on the subnet 192.168.52.0
storm runs VDE on the 192.168.254.0 subnet, eric sees storm as 192.168.254.254
storm is not internet facing
< here lies the internet >
plum is behind a NAT but is port forwarded, plum's ip is 192.168.9.9
momo is on the same subnet
eric think's plum's IP is the external one
eric import(4)s storm's file system at boot, its path is /n/storm_root
eric union bind(1)s /n/storm_root/home/plan9/bin to /bin, effectively putting that directory in the path
then eric executes srv_eric
which redirects to the file located at /n/storm/bin/srv_eric
which redirects to the file located at /n/storm_root/home/plan9/bin/srv_eric
which is really on the machine storm as /home/plan9/bin/srv_eric
it contains :
#!/bin/rc
rm -f /srv/ericnet # in case it's run again after boot
srvfs ericnet /net # export eric's network
cpu -h plum -c /mnt/term/bin/eric_arrived
the cpu command logs into plum's IP via port forwarding and when it gets a shell it executes /mnt/term/bin/eric_arrived
eric_arrived is also in /home/plan9/bin on storm, cpu takes its namespace with it into /mnt/term
#!/bin/rc
rm -f /srv/ericnet # in case this is a reconnect
mount /mnt/term/srv/ericnet /n/ericnet # mount eric's srv entry for this script to use
srvfs ericnet /n/ericnet # export it again so everyone can see it in /srv
chmod 666 /srv/ericnet # make it available for r/w
read # keep it alive
I log into into plum (with cpu or drawterm or whatever)
in my lib/profile I have
get_eric
which is actually at /n/momo/home/plab9/bin/get_eric and contains :
#!/bin/rc
mount /srv/ericnet /net.alt
srv /net.alt/tcp!storm!9fs /n/storm_root
which mount's eric's network on /net.alt
and then uses that network connection to mount storm's file system on plum
We can use eric's network for all the usual stuff i.e.
plum% ip/ping -n 1 /net.alt/icmp!10.0.0.2
sending 1 64 byte messages 1000 ms apart to /net.alt/icmp!10.0.0.1!1
0: rtt 148045 µs, avg rtt 148045 µs, ttl = 64
plum%
The only problem I have at the moment is that eric doesn't notice when plum goes away, both LANs are unreliable.
I think there might be a better way of doing all this, I'm hoping this blog post will help me reveal it, after all, I only just worked all this out for the first time. I've not had a remote Plan 9 box before. I looked an aan but I can't quite see how to use it for this.
No comments:
Post a Comment