New

Duane Attaway dattaway at dattaway.org
Fri Feb 21 22:22:54 CST 2003


I'm cc'ing this to the list in hopes someone else may find it useful or 
has comments, critism, etc...

On Fri, 21 Feb 2003, Gene Dascher wrote:

> Thanks for the info.  I have 2 more Gentoo questions for you, if you
> don't mind.  I am going to set up a P5-200 as a
> firewall/webserver/gateway at home using Gentoo.  First of all, I have
> heard about being able to export your Gentoo drives via NFS and use
> another computer to compile all of the sources, but I can't find any
> information online on how exactly to do this.

You can mount its root directory and chroot to it from the fast machine at 
any time you get NFS up and serving.  If the kernel you booted from has 
NFS, you can go ahead and export the root directory.

I'm going from memory, but nfsd needs three files from the /etc directory 
to give it permissions on what to export:

/etc/hosts.deny
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL

/etc/hosts.allow
cat /etc/hosts.allow 
ALL: 24.166.190.52   <--my fast computer

/etc/exports
/ 24.166.190.52(rw,no_root_squash)

This is exporting the root directory with read and write access.  As you
can see, do not do this on a sniffable segment of your network!  Anyone
who can see packets through your route can sniff or spoof one of your
privileged computers only to have it owned and quickly become a menace to
others.  It is safe to have it connected to the internet, just be sure
these packets are not routed anywhere *through* the internet.  Remember,
these are powerful ports you are opening.  Gentoo defaults to no open
ports.

To export NFS, you need to have portmapper running and the nfsd daemon
running.  You might have to "emerge nfs-utils" after you emerge the
system.  Then you can run the nfs start script.  That will automatically
start portmapper and the nfs daemon for you:

/etc/init.d/nfs start

>From your fast computer, simply mount that root directory.  Make a 
directory to mount to somewhere:

mkdir mnt

and mount it:

mount 24.166.189.124:/ mnt

Those addresses are from my setup, so yours will be different.  You can 
use machine names in place of those numbers if they are defined in the 
/etc/hosts file or from a nameserver listed in /etc/resolv.conf.

Past this point, you can pretty much follow what is in the x86 install 
instructions:

you will need to mount the proc directory in there too.  Many programs 
need to access environment variables within programs and /proc is a 
directory structure favored by many programmers:

mount -o bind /proc mnt/proc

Give the new environment you will be switching to the nameserver for your 
network:

cp /etc/resolv.conf mnt/etc/resolv.conf

and chroot into it:

chroot mnt /bin/bash

And update your shell with gentoo's new environment scripts in /etc just 
as if you had logged into the system from scratch:

env-update
source /etc/profile

You have now taken control of the slow computer and can emerge the world.  
If you want to run X applications, you will have to export the DISPLAY
variable to the machine you are sitting at:

export DISPLAY=satellite.dattaway.org:0

also, don't do this over the internet unless you tunnel the X forwarding 
through ssh packets.

I hope this gets you started.  Let me know if you hit a snag somewhere.  
This could be a good howto.

--
"It is the duty of a patriot to protect his country from its government"
-Thomas Paine
http://dattaway.org    




More information about the Kclug mailing list