|
Lines 1-840
Link Here
|
| 1 |
--- NFS-HOWTO.sgml.orig Thu Nov 18 06:51:14 1999 |
|
|
| 2 |
+++ NFS-HOWTO.sgml Thu Nov 18 06:52:16 1999 |
| 3 |
@@ -79,7 +79,7 @@ |
| 4 |
networking and the terms used. If you don't recognize the terms you |
| 5 |
can either go back and check the networking HOWTO, wing it, or get a |
| 6 |
book about TCP/IP network administration to familiarize yourself with |
| 7 |
-TCP/IP. That's a good idea anyway if you're administrating UNIX/Linux |
| 8 |
+TCP/IP. That's a good idea anyway if you're administrating UNIX |
| 9 |
machines. A very good book on the subject is <em>TCP/IP Network |
| 10 |
Administration</em> by Craig Hunt, published by O'Reilly & |
| 11 |
Associates, Inc. And after you've read it and understood it you'll |
| 12 |
@@ -89,14 +89,6 @@ |
| 13 |
<em/Mount Checklist/ and <em/FAQs/. Please refer to them if something |
| 14 |
dosen't work as advertized. |
| 15 |
|
| 16 |
-<p>The home-site for the Linux 2.0 nfsd is <htmlurl |
| 17 |
-name="ftp.mathematik.th-darmstadt.de:/pub/linux/okir" |
| 18 |
-url="ftp://ftp.mathematik.th-darmstadt.de/pub/linux/okir/">, in case |
| 19 |
-you want/need to get it and compile it yourself. |
| 20 |
- |
| 21 |
-<p>For information about NFS under Linux 2.2 please see <ref |
| 22 |
-id="linuxtwotwo" name="the Linux 2.2 section">. |
| 23 |
- |
| 24 |
<sect>Setting up a NFS server<label id="nfs-server"> |
| 25 |
|
| 26 |
<sect1>Prerequisites |
| 27 |
@@ -116,7 +108,7 @@ |
| 28 |
skip ahead to <ref id="nfs-client" name="the section on setting up a |
| 29 |
NFS client"> |
| 30 |
|
| 31 |
-<p>If you need to set up a non-Linux box as server you will have to |
| 32 |
+<p>If you need to set up a non-FreeBSD box as server you will have to |
| 33 |
read the system manual(s) to discover how to enable NFS serving and |
| 34 |
export of file systems through NFS. There is a separate section in |
| 35 |
this HOWTO on how to do it on many different systems. After you have |
| 36 |
@@ -124,16 +116,13 @@ |
| 37 |
HOWTO. Or read more of this section since some of the things I will |
| 38 |
say are relevant no matter what kind of machine you use as server. |
| 39 |
|
| 40 |
-<p>If you're running please see <ref id="linuxtwotwo" name="the Linux |
| 41 |
-2.2 section"> before you continue reading this. |
| 42 |
- |
| 43 |
<p>Those of you still reading will need to set up a number of |
| 44 |
programs. |
| 45 |
|
| 46 |
<sect1>The portmapper<label id="portmapper"> |
| 47 |
|
| 48 |
-<p>The portmapper on Linux is called either <tt/portmap/ or |
| 49 |
-<tt/rpc.portmap/. The man page on my system says it is a "DARPA port |
| 50 |
+<p>The portmapper on FreeBSD is called <tt/portmap/. |
| 51 |
+The man page on my system says it is a "DARPA port |
| 52 |
to RPC program number mapper". It is the first security hole you'll |
| 53 |
open reading this HOWTO. Description of how to close one of the holes |
| 54 |
is in <ref id="nfs-security" name="the security section">. Which I, |
| 55 |
@@ -149,14 +138,7 @@ |
| 56 |
If there is a script called something like <tt/inet/ it's probably the |
| 57 |
right script to edit. But, what to write or do is outside the scope |
| 58 |
of this HOWTO. Start portmap, and check that it lives by running |
| 59 |
-<tt/ps aux/ and then <tt/rpcinfo -p/. It does? Good. |
| 60 |
- |
| 61 |
-<p>Oh, one thing. Remote access to your portmapper is regulated by |
| 62 |
-the contents of your <tt>/etc/hosts.allow</tt> and |
| 63 |
-<tt>/etc/hosts.deny</tt> files. If <tt/rpcinfo -p/ fails, but your |
| 64 |
-portmapper is running please examine these files. See <ref |
| 65 |
-id="nfs-security" name="the security section"> for details on these |
| 66 |
-files. |
| 67 |
+<tt/ps aux/. It does? Good. |
| 68 |
|
| 69 |
<sect1>Mountd and nfsd<label id="nfsd"> |
| 70 |
|
| 71 |
@@ -187,24 +169,23 @@ |
| 72 |
use./ There is a separate section in this HOWTO about other Unixes |
| 73 |
<tt/exports/ files. |
| 74 |
|
| 75 |
-<p>Now we're set to start mountd (or maybe it's called <tt/rpc.mountd/ |
| 76 |
-and then nfsd (which could be called <tt/rpc.nfsd/). They will both |
| 77 |
+<p>Now we're set to start mountd |
| 78 |
+and then nfsd. They will both |
| 79 |
read the exports file. |
| 80 |
|
| 81 |
<p>If you edit <tt>/etc/exports</tt> you will have to make sure nfsd |
| 82 |
and mountd knows that the files have changed. The traditonal way is |
| 83 |
-to run <tt/exportfs/. Many Linux distributions lack a exportfs |
| 84 |
-program. If you're exportfs-less you can install this script on your |
| 85 |
+to run <tt/exportfs/. FreeBSD lacks a exportfs |
| 86 |
+program. You can install this script on your |
| 87 |
machine: |
| 88 |
|
| 89 |
<code> |
| 90 |
#!/bin/sh |
| 91 |
-killall -HUP /usr/sbin/rpc.mountd |
| 92 |
-killall -HUP /usr/sbin/rpc.nfsd |
| 93 |
+/bin/kill -HUP `/bin/cat /var/run/mountd.pid` |
| 94 |
echo re-exported file systems |
| 95 |
</code> |
| 96 |
|
| 97 |
-<p>Save it in, say, <tt>/usr/sbin/exportfs</tt>, and don't forget to |
| 98 |
+<p>Save it in, say, <tt>/usr/local/sbin/exportfs</tt>, and don't forget to |
| 99 |
<tt/chmod a+rx/ it. Now, whenever you change your exports file, you |
| 100 |
run exportfs after, as root. |
| 101 |
|
| 102 |
@@ -225,12 +206,8 @@ |
| 103 |
mountd and nfsd. |
| 104 |
|
| 105 |
<p>If you get <tt>rpcinfo: can't contact portmapper: RPC: Remote |
| 106 |
-system error - Connection refused</tt>, |
| 107 |
-<tt>RPC_PROG_NOT_REGISTERED</tt> or something similar instead then the |
| 108 |
-portmapper isn't running. OR you might have something in |
| 109 |
-<tt>/etc/hosts.{allow,deny}</tt> that forbids the portmapper from |
| 110 |
-answering, please see <ref id="nfs-security" name="the security |
| 111 |
-section"> for details on these files. If you get <tt>No remote |
| 112 |
+system error - Connection refused</tt> or something similar instead |
| 113 |
+then the portmapper isn't running. Fix it. If you get <tt>No remote |
| 114 |
programs registered.</tt> then either the portmapper doesn't want to |
| 115 |
talk to you, or something is broken. Kill nfsd, mountd, and the |
| 116 |
portmapper and try the ignition sequence again. |
| 117 |
@@ -255,12 +232,8 @@ |
| 118 |
<sect>Setting up a NFS client<label id="nfs-client"> |
| 119 |
|
| 120 |
<p>First you will need a kernel with the NFS file system either |
| 121 |
-compiled in or available as a module. This is configured before you |
| 122 |
-compile the kernel. If you have never compiled a kernel before you |
| 123 |
-might need to check the kernel HOWTO and figure it out. If you're |
| 124 |
-using a very cool distribution (like Red Hat) and you've never fiddled |
| 125 |
-with the kernel or modules on it (and thus ruined it ;-), nfs is |
| 126 |
-likely automagicaly available to you. |
| 127 |
+compiled in or available as a module. This is configured in the GENERIC |
| 128 |
+FreeBSD kernel for you. |
| 129 |
|
| 130 |
<p>You can now, at a root prompt, enter a appropriate mount command |
| 131 |
and the file system will appear. Continuing the example in the |
| 132 |
@@ -280,8 +253,7 @@ |
| 133 |
by server: Permission denied</tt> then the exports file is wrong, or |
| 134 |
you forgot to run exportfs after editing the exports file. If it says |
| 135 |
<tt>mount clntudp_create: RPC: Program not registered</tt> it means |
| 136 |
-that nfsd or mountd is not running on the server. Or you have the |
| 137 |
-<tt/hosts.{allow,deny}/ problem mentioned earlier. |
| 138 |
+that nfsd or mountd is not running on the server. |
| 139 |
|
| 140 |
<p>To get rid of the file system you can say |
| 141 |
|
| 142 |
@@ -294,7 +266,7 @@ |
| 143 |
as this is required: |
| 144 |
|
| 145 |
<code> |
| 146 |
-# device mountpoint fs-type options dump fsckorder |
| 147 |
+# Device Mountpoint FStype Options Dump Pass# |
| 148 |
... |
| 149 |
eris:/mn/eris/local /mnt nfs rsize=1024,wsize=1024 0 0 |
| 150 |
... |
| 151 |
@@ -332,7 +304,7 @@ |
| 152 |
<p>Picking up the previous example, this is now your fstab entry: |
| 153 |
|
| 154 |
<code> |
| 155 |
-# device mountpoint fs-type options dump fsckorder |
| 156 |
+# Device Mountpoint FStype Options Dump Pass# |
| 157 |
... |
| 158 |
eris:/mn/eris/local /mnt nfs rsize=1024,wsize=1024,hard,intr 0 0 |
| 159 |
... |
| 160 |
@@ -342,8 +314,8 @@ |
| 161 |
<sect1>Optimizing NFS<label id="optimizing"> |
| 162 |
|
| 163 |
<p>Normally, if no rsize and wsize options are specified NFS will read |
| 164 |
-and write in chunks of 4096 or 8192 bytes. Some combinations of Linux |
| 165 |
-kernels and network cards cannot handle that large blocks, and it |
| 166 |
+and write in chunks of 4096 or 8192 bytes. Some |
| 167 |
+network cards cannot handle that large blocks, and it |
| 168 |
might not be optimal, anyway. So we'll want to experiment and find a |
| 169 |
rsize and wsize that works and is as fast as possible. You can test |
| 170 |
the speed of your options with some simple commands. Given the mount |
| 171 |
@@ -379,7 +351,7 @@ |
| 172 |
have different optimal sizes. SunOS and Solaris is reputedly a lot |
| 173 |
faster with 4096 byte blocks than with anything else. |
| 174 |
|
| 175 |
-<p>Newer Linux kernels (since 1.3 sometime) perform read-ahead for |
| 176 |
+<p>Newer FreeBSD kernels (since 3.0) perform read-ahead for |
| 177 |
rsizes larger or equal to the machine page size. On Intel CPUs the |
| 178 |
page size is 4096 bytes. Read ahead will <em/significantly/ increase |
| 179 |
the NFS read performance. So on a Intel machine you will want 4096 |
| 180 |
@@ -393,13 +365,13 @@ |
| 181 |
requests shall not be considered finished before the data written is |
| 182 |
on a non-volatile medium (normally the disk). This restricts the |
| 183 |
write performance somewhat, asynchronous writes will speed NFS writes |
| 184 |
-up. The Linux nfsd has never done synchronous writes since the Linux |
| 185 |
+up. The FreeBSD nfsd has never done synchronous writes since the FreeBSD |
| 186 |
file system implementation does not lend itself to this, but on |
| 187 |
-non-Linux servers you can increase the performance this way with this |
| 188 |
+non-FreeBSD servers you can increase the performance this way with this |
| 189 |
in your exports file: |
| 190 |
|
| 191 |
<code> |
| 192 |
-/dir -async,access=linuxbox |
| 193 |
+/dir -async,access=freebsdbox |
| 194 |
</code> |
| 195 |
|
| 196 |
<p>or something similar. Please refer to the exports man page on the |
| 197 |
@@ -413,7 +385,9 @@ |
| 198 |
distance connections. |
| 199 |
|
| 200 |
<p>This section is based on knowledge about the used protocols but no |
| 201 |
-actual experiments. Please let me hear from you if try this ;-) |
| 202 |
+actual experiments. My home computer has been down for 6 months (bad |
| 203 |
+HD, low on cash) and so I have had no modem connection to test this |
| 204 |
+with. Please let me hear from you if try this :-) |
| 205 |
|
| 206 |
<p>The first thing to remember is that NFS is a slow protocol. It has |
| 207 |
high overhead. Using NFS is almost like using kermit to transfer |
| 208 |
@@ -623,10 +597,10 @@ |
| 209 |
servers root account. In the NFSd man page there are several other |
| 210 |
squash options listed so that you can decide to mistrust whomever you |
| 211 |
(don't) like on the clients. You also have options to squash any UID |
| 212 |
-and GID range you want to. This is described in the Linux NFSd man |
| 213 |
+and GID range you want to. This is described in the FreeBSD NFSd man |
| 214 |
page. |
| 215 |
|
| 216 |
-<p>root_squash is in fact the default with the Linux NFSd, to grant |
| 217 |
+<p>root_squash is in fact the default with the FreeBSD NFSd, to grant |
| 218 |
root access to a filesystem use <tt/no_root_squash/. |
| 219 |
|
| 220 |
<p>Another important thing is to ensure that nfsd checks that all it's |
| 221 |
@@ -634,7 +608,7 @@ |
| 222 |
any old port on the client a user with no special privileges can run a |
| 223 |
program that's is easy to obtain over the Internet. It talks nfs |
| 224 |
protocol and will claim that the user is anyone the user wants to be. |
| 225 |
-Spooky. The Linux nfsd does this check by default, on other OSes you |
| 226 |
+Spooky. The FreeBSD nfsd does this check by default, on other OSes you |
| 227 |
have to enable this check yourself. This should be described in the |
| 228 |
nfsd man page for the OS. |
| 229 |
|
| 230 |
@@ -645,98 +619,9 @@ |
| 231 |
|
| 232 |
<p>The basic portmapper, in combination with nfsd has a design problem |
| 233 |
that makes it possible to get to files on NFS servers without any |
| 234 |
-privileges. Fortunately the portmapper that most Linux distributions |
| 235 |
-use is relatively secure against this attack, and can be made more |
| 236 |
-secure by configuring up access lists in two files. |
| 237 |
- |
| 238 |
-<p>Not all Linux distributions were created equal. Some seemingly |
| 239 |
-up-to-date distributions does <em/not/ include a securable portmapper, |
| 240 |
-even today, many years since the vulnerability became common |
| 241 |
-knowledge. At least one distribution even contains the manpage for a |
| 242 |
-securable portmapper but the actual portmapper is <em>not</em> |
| 243 |
-secureable. The easy way to check if your portmapper is good |
| 244 |
-or not is to run strings(1) and see if it reads the relevant files, |
| 245 |
-<tt>/etc/hosts.deny</tt> and <tt>/etc/hosts.allow</tt>. Assuming your |
| 246 |
-portmapper is <tt>/usr/sbin/portmap</tt> you can check it with this |
| 247 |
-command: <tt>strings /usr/sbin/portmap | grep hosts</tt>. On my |
| 248 |
-machine it comes up with this: |
| 249 |
- |
| 250 |
-<code> |
| 251 |
-/etc/hosts.allow |
| 252 |
-/etc/hosts.deny |
| 253 |
-@(#) hosts_ctl.c 1.4 94/12/28 17:42:27 |
| 254 |
-@(#) hosts_access.c 1.20 96/02/11 17:01:27 |
| 255 |
-</code> |
| 256 |
- |
| 257 |
-<p>First we edit <tt>/etc/hosts.deny</tt>. It should contain the line |
| 258 |
- |
| 259 |
-<code> |
| 260 |
-portmap: ALL |
| 261 |
-</code> |
| 262 |
- |
| 263 |
-which will deny access to <em/everyone/. While it is closed thus run |
| 264 |
-<tt>rpcinfo -p</tt> just to check that your portmapper really reads |
| 265 |
-and obeys this file. rpcinfo should give no output, or possebly a |
| 266 |
-errormessage. Restarting the portmapper should <em>not</em> be |
| 267 |
-necessary. |
| 268 |
- |
| 269 |
-<p>Closing the portmapper for everyone is a bit drastic, so we open it |
| 270 |
-again by editing <tt>/etc/hosts.allow</tt>. But first we need to |
| 271 |
-figure out what to put in it. It should basically list all machines |
| 272 |
-that should have access to your portmapper. On a run of the mill |
| 273 |
-Linux system there are very few machines that need any access for any |
| 274 |
-reason. The portmapper administrates nfsd, mountd, ypbind/ypserv, |
| 275 |
-pcnfsd, and 'r' services like ruptime and rusers. Of these only nfsd, |
| 276 |
-mountd, ypbind/ypserv and perhaps pcnfsd are of any consequence. All |
| 277 |
-machines that needs to access services on your machine should be |
| 278 |
-allowed to do that. Let's say that your machines address is |
| 279 |
-129.240.223.254 and that it lives on the subnet 129.240.223.0 should |
| 280 |
-have access to it (those are terms introduced by the networking HOWTO, |
| 281 |
-go back and refresh your memory if you need to). Then we write |
| 282 |
- |
| 283 |
-<code> |
| 284 |
-portmap: 129.240.223.0/255.255.255.0 |
| 285 |
-</code> |
| 286 |
- |
| 287 |
-in <tt/hosts.allow/. This is the same as the network address you give |
| 288 |
-to route and the subnet mask you give to ifconfig. For the device |
| 289 |
-<tt/eth0/ on this machine <tt/ifconfig/ should show |
| 290 |
- |
| 291 |
-<code> |
| 292 |
-... |
| 293 |
-eth0 Link encap:10Mbps Ethernet HWaddr 00:60:8C:96:D5:56 |
| 294 |
- inet addr:129.240.223.254 Bcast:129.240.223.255 Mask:255.255.255.0 |
| 295 |
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 |
| 296 |
- RX packets:360315 errors:0 dropped:0 overruns:0 |
| 297 |
- TX packets:179274 errors:0 dropped:0 overruns:0 |
| 298 |
- Interrupt:10 Base address:0x320 |
| 299 |
-... |
| 300 |
-</code> |
| 301 |
+privileges. Fortunately the portmapper FreeBSD uses is relatively |
| 302 |
+secure against this attack. |
| 303 |
|
| 304 |
-and <tt/netstat -rn/ should show |
| 305 |
- |
| 306 |
-<code> |
| 307 |
-Kernel routing table |
| 308 |
-Destination Gateway Genmask Flags Metric Ref Use Iface |
| 309 |
-... |
| 310 |
-129.240.223.0 0.0.0.0 255.255.255.0 U 0 0 174412 eth0 |
| 311 |
-... |
| 312 |
-</code> |
| 313 |
- |
| 314 |
-(Network address in first column). |
| 315 |
- |
| 316 |
-The <tt/hosts.deny/ and <tt/hosts.allow/ files are described in the |
| 317 |
-manual pages of the same names. |
| 318 |
- |
| 319 |
-<p><bf/IMPORTANT:/ Do <em/not/ put <em/anything/ but <em/IP NUMBERS/ in |
| 320 |
-the portmap lines of these files. Host name lookups can indirectly |
| 321 |
-cause portmap activity which will trigger host name lookups which can |
| 322 |
-indirectly cause portmap activity which will trigger... |
| 323 |
- |
| 324 |
-<p>The above things should make your server tighter. The only |
| 325 |
-remaining problem (Yeah, right!) is someone breaking root (or boot |
| 326 |
-MS-DOS) on a trusted machine and using that privilege to send requests |
| 327 |
-from a secure port as any user they want to be. |
| 328 |
|
| 329 |
<sect1>NFS and firewalls<label id="security-firewalls"> |
| 330 |
|
| 331 |
@@ -752,13 +637,13 @@ |
| 332 |
|
| 333 |
<sect1>Summary<label id="security-summary"> |
| 334 |
|
| 335 |
-<p>If you use the hosts.allow/deny, root_squash, nosuid and privileged |
| 336 |
+<p>If you use the nosuid and privileged |
| 337 |
port features in the portmapper/nfs software you avoid many of the |
| 338 |
presently known bugs in nfs and can almost feel secure about <em/that/ |
| 339 |
at least. But still, after all that: When an intruder has access to |
| 340 |
your network, s/he can make strange commands appear in your |
| 341 |
<tt/.forward/ or read your mail when <tt>/home</tt> or |
| 342 |
-<tt>/var/spool/mail</tt> is NFS exported. For the same reason, |
| 343 |
+<tt>/var/mail</tt> is NFS exported. For the same reason, |
| 344 |
you should never access your PGP private key over nfs. Or at least |
| 345 |
you should know the risk involved. And now you know a bit of it. |
| 346 |
|
| 347 |
@@ -766,10 +651,10 @@ |
| 348 |
it's not totally unlikely that new bugs will be discovered, either in |
| 349 |
the basic design or the implementation we use. There might even be |
| 350 |
holes known now, which someone is abusing. But that's life. To keep |
| 351 |
-abreast of things like this you should at least read the newsgroups |
| 352 |
-<htmlurl url="news:comp.os.linux.announce" |
| 353 |
-name="comp.os.linux.announce"> and <htmlurl |
| 354 |
-url="news:comp.security.announce" name="comp.security.announce"> at a |
| 355 |
+abreast of things like this you should at least read the mailing lists |
| 356 |
+<htmlurl url="mailto:freebsd-security@FreeBSD.org" |
| 357 |
+name="freebsd-security@FreeBSD.org"> |
| 358 |
+at a |
| 359 |
absolute minimum. |
| 360 |
|
| 361 |
<sect>Mount Checklist |
| 362 |
@@ -780,18 +665,7 @@ |
| 363 |
refer to this list before posting your problem. Each item describes a |
| 364 |
failure mode and the fix. |
| 365 |
|
| 366 |
-<enum>Mount keeps saying <tt/RPC: Program not registered/ |
| 367 |
- |
| 368 |
-<p>Is the portmapper running? |
| 369 |
-<p><bf/Fix:/ Start it. |
| 370 |
-<p>Is mountd running? |
| 371 |
-<p><bf/Fix:/ Start it. |
| 372 |
-<p>Is nfsd running? |
| 373 |
-<p><bf/Fix:/ Start it. |
| 374 |
-<p>Is the portmapper forbidden to answer by <tt>/etc/hosts.deny</tt>? |
| 375 |
-<p><bf/Fix:/ Either remove the rule in <tt/hosts.deny/ or add a rule |
| 376 |
- to <tt/hosts.allow/ such that the portmapper is allowed to talk to |
| 377 |
- you. |
| 378 |
+<enum> |
| 379 |
|
| 380 |
<item>File system not exported, or not exported to the client in |
| 381 |
question. |
| 382 |
@@ -832,10 +706,7 @@ |
| 383 |
|
| 384 |
<p><bf/Fix:/ Get the date set right. |
| 385 |
|
| 386 |
-<p>The HOWTO author recommends using NTP to synchronize clocks. Since |
| 387 |
-there are export restrictions on NTP in the US you have to get NTP for |
| 388 |
-Debian, Red Hat or Slackware from |
| 389 |
-<tt>ftp://ftp.hacktic.nl/pub/replay/pub/linux</tt> or a mirror. |
| 390 |
+<p>The HOWTO author recommends using NTP to synchronize clocks. |
| 391 |
|
| 392 |
<item>The server can not accept a mount from a user that is in more |
| 393 |
than 8 groups. |
| 394 |
@@ -845,153 +716,10 @@ |
| 395 |
|
| 396 |
</enum> |
| 397 |
|
| 398 |
-<sect>FAQs |
| 399 |
- |
| 400 |
-<p>This is the FAQ section. It is partly based on a old NFS FAQ by |
| 401 |
-Alan Cox. |
| 402 |
- |
| 403 |
-<p>If you have a problem mounting a filesystem please see if your |
| 404 |
-problem is described in the ``Mount Checklist'' section. |
| 405 |
- |
| 406 |
-<enum> |
| 407 |
- |
| 408 |
- <item>I get a lot of ``stale nfs handle'' errors when using Linux as |
| 409 |
- a nfs server. |
| 410 |
- |
| 411 |
- <p>This is caused by a bug in some old nfsd versions. It is fixed |
| 412 |
- in nfs-server2.2beta16 and later. |
| 413 |
- |
| 414 |
- <item>When I try to mount a file system I get |
| 415 |
- |
| 416 |
- <tscreen><verb> |
| 417 |
- can't register with portmap: system error on send |
| 418 |
- </verb></tscreen> |
| 419 |
- |
| 420 |
- <p>You are probably using a Caldera system. There is a bug in the |
| 421 |
- rc scripts. Please contact Caldera to obtain a fix. |
| 422 |
- |
| 423 |
- <item>Why can't I execute a file after copying it to the NFS server? |
| 424 |
- |
| 425 |
- <p>The reason is that nfsd caches open file handles for performance |
| 426 |
- reasons (remember, it runs in user space). While nfsd has a file |
| 427 |
- open (as is the case after writing to it), the kernel won't allow |
| 428 |
- you to execute it. Nfsds newer than ~spring 95 release open files |
| 429 |
- after a few seconds, older ones would cling to them for days. |
| 430 |
- |
| 431 |
- <item>My NFS files are all read only |
| 432 |
- |
| 433 |
- <p>The Linux NFS server defaults to read only. Please read the |
| 434 |
- section about ``Mountd and nfsd'' and ``Exporting filesystems'' in |
| 435 |
- this HOWTO, and refer to the ``exports'' and ``nfsd'' manual |
| 436 |
- pages. You will need to alter <tt>/etc/exports</tt>. |
| 437 |
- |
| 438 |
- <item>I mount from a Linux NFS server and while <tt>ls</tt> works I |
| 439 |
- can't read or write files. |
| 440 |
- |
| 441 |
- <p>On older versions of Linux you must mount a NFS servers with |
| 442 |
- <tt/rsize=1024,wsize=1024/. |
| 443 |
- |
| 444 |
- <item>I mount from a Linux NFS server with a block size of between |
| 445 |
- 3500-4000 and it crashes the Linux box regularly |
| 446 |
- |
| 447 |
- <p>Basically don't do it then. This does not happen with 2.0 and |
| 448 |
- 2.2 kernels. As far as I recall there is no problem with 1.2 |
| 449 |
- either. |
| 450 |
- |
| 451 |
- <item>Can Linux do NFS over TCP |
| 452 |
- |
| 453 |
- <p>No, not at present. |
| 454 |
- |
| 455 |
- <item>I get loads of strange errors trying to mount a machine from a |
| 456 |
- Linux box. |
| 457 |
- |
| 458 |
- <p>Make sure your users are in 8 groups or less. Older servers |
| 459 |
- require this. |
| 460 |
- |
| 461 |
- <item>When I reboot my machine it sometimes hangs when trying to |
| 462 |
- unmount a hung NFS server. |
| 463 |
- |
| 464 |
- <p>Do <bf/not/ unmount NFS servers when rebooting or halting, just |
| 465 |
- ignore them, it will not hurt anything if you don't unmount them. |
| 466 |
- The command is <tt/umount -avt nonfs/. |
| 467 |
- |
| 468 |
- <item>Linux NFS clients are very slow when writing to Sun and BSD |
| 469 |
- systems |
| 470 |
- |
| 471 |
- <p>NFS writes are normally synchronous (you can disable this if you |
| 472 |
- don't mind risking losing data). Worse still BSD derived kernels |
| 473 |
- tend to be unable to work in small blocks. Thus when you write 4K of |
| 474 |
- data from a Linux box in the 1K packets it uses BSD does this |
| 475 |
- |
| 476 |
- <tscreen><verb> |
| 477 |
- read 4K page |
| 478 |
- alter 1K |
| 479 |
- write 4K back to physical disk |
| 480 |
- read 4K page |
| 481 |
- alter 1K |
| 482 |
- write 4K page back to physical disk |
| 483 |
- etc.. |
| 484 |
- </verb></tscreen> |
| 485 |
- |
| 486 |
- <item>When I connect many clients to a Linux NFS server the |
| 487 |
- performance suddenly drops. |
| 488 |
- |
| 489 |
- <p>The NFS protocol uses fragmented UDP packets. The kernel has a |
| 490 |
- limit of how many fragments of incomplete packets it can have before |
| 491 |
- it starts throwing away packets. In 2.2 this is runtime tuneable |
| 492 |
- via the /proc filesystem: |
| 493 |
- <tt>/proc/sys/net/ipv4/ipfrag_high_thresh</tt> and |
| 494 |
- <tt>ipfrag_low_thresh</tt>. In 2.0 these are compile-time constants |
| 495 |
- defined in <tt>.../linux/net/ipv4/ip_fragment.c</tt>, |
| 496 |
- <tt>IPFRAG_HIGH_THRESH</tt> and <tt>IPFRAG_LOW_THRESH</tt>. The |
| 497 |
- meaning of these values is that once the memory consumption of |
| 498 |
- unassembled UDP fragments reaches the ``ipfrag_high_thresh'' in |
| 499 |
- bytes (256K by default in 2.2.3 and 2.0.36) it is cut down to |
| 500 |
- ``ipfrag_low_tresh'' at once. This is done by throwing away |
| 501 |
- fragments. This will look almost like packet loss, and if the |
| 502 |
- high threshold is reached your server performance drops a lot. |
| 503 |
- |
| 504 |
- <p>256K is enough for up to 30 clients. If you have 60, double it. |
| 505 |
- And double the low threshold also. |
| 506 |
- |
| 507 |
- <item>I'm using Linux 2.2 (or later) with knfsd and I can't get my |
| 508 |
- AIX, IRIX, Solaris, DEC-Unix, ... machine to mount it. |
| 509 |
- |
| 510 |
- <p>Knfsd announces that it implements NFS version 3. It does not. |
| 511 |
- There is an option to stop it from announcing it. Use it. Or you |
| 512 |
- can put "<tt/vers=2/" in the mount option list on the clients. |
| 513 |
- |
| 514 |
- <item>My AIX 4 machine cannot mount my Linux NFS server. It says |
| 515 |
- |
| 516 |
- <tscreen><verb> |
| 517 |
- mount: 1831-011 access denied for server:/dir |
| 518 |
- mount: 1831-008 giving up on: |
| 519 |
- server:/dir |
| 520 |
- The file access permissions do not allow the specified action. |
| 521 |
- </verb></tscreen> |
| 522 |
- |
| 523 |
- or something like that instead. |
| 524 |
- |
| 525 |
- <p>AIX 4.2 used reserved ports (<1024) for NFS. AIX 4.2.1 and 4.3 |
| 526 |
- are not constrained to reserved ports. Also, AIX 4.2.1 and 4.3 try |
| 527 |
- to mount using NFS3, then NFS/TCP, then fiannly NFS/UDP. |
| 528 |
- |
| 529 |
- <p>Adding |
| 530 |
- |
| 531 |
-<code> |
| 532 |
-nfso -o nfs_use_reserved_ports=1 |
| 533 |
-</code> |
| 534 |
- |
| 535 |
- <p>to the end of <tt/rc.tcpip/ will force it to use reserved ports |
| 536 |
- again. (This tip was supplied by Brian Gorka) |
| 537 |
- |
| 538 |
-</enum> |
| 539 |
- |
| 540 |
- |
| 541 |
<sect>Exporting filesystems |
| 542 |
|
| 543 |
<p>The way to export filesytems with NFS is not completely consistent |
| 544 |
-across platforms of course. In this case Linux and Solaris 2 are the |
| 545 |
+across platforms of course. In this case FreeBSD and Solaris 2 are the |
| 546 |
deviants. This section lists, superficially, the way to do it on most |
| 547 |
systems. If the kind of system you have is not covered you must check |
| 548 |
your OS man-pages. Keywords are: nfsd, system administration tool, rc |
| 549 |
@@ -1040,291 +768,6 @@ |
| 550 |
</code> |
| 551 |
|
| 552 |
After editing run the program <tt/shareall/ to export the filesystems. |
| 553 |
- |
| 554 |
-<sect>NFS under Linux 2.2 |
| 555 |
-<label id="linuxtwotwo"> |
| 556 |
- |
| 557 |
-<p>As I write this Linux 2.2.12 is the current kernel version and to |
| 558 |
-use NFS under it can be a bit of a chore. Or not. |
| 559 |
- |
| 560 |
-<p>What the status of NFS in Linux 2.4 will be i unknown. |
| 561 |
- |
| 562 |
-<p>The new big thing in Linux 2.2 is support for a in-kernel nfs |
| 563 |
-server demon, called knfsd in 2.2. This way of implementing nfsd has |
| 564 |
-some advantages, the main one is speed. A Linux 2.2 machine with |
| 565 |
-knfsd is a respectable nfs server. You can still use the old nfsd |
| 566 |
-with Linux 2.2 though, and there are some advantages to using this, |
| 567 |
-mainly simplicity. |
| 568 |
- |
| 569 |
-<p>If you use a kernel source or binary package made by someone like |
| 570 |
-RedHat (6.0 and later), SuSE (6.1 or later, I belive) or some other |
| 571 |
-professional system integrator they have likely integrated full |
| 572 |
-"knfsd" functionality in their kernel and you need not worry, it will |
| 573 |
-work. Mostly. Until you want to compile a kernel yourself. If you |
| 574 |
-use a stock Linux 2.2 kernel (up to 2.2.12 at least) knfsd will break. |
| 575 |
- |
| 576 |
-<p>To get this on the air yourself you need to get H.J. Lus knfsd |
| 577 |
-package. This is a collection of patches, and the needed utilities |
| 578 |
-for 2.2 that Lu is maintaining in his spare time. You can get it from |
| 579 |
-your local kernel mirror, the master site is <htmlurl |
| 580 |
-url="ftp://ftp.kernel.org/pub/linux/devel/gcc/" |
| 581 |
-name="ftp.kernel.org:/pub/linux/devel/gcc/">. <bf/This is not meant |
| 582 |
-for general consumption/. If you find this package confusing please |
| 583 |
-don't try to do this yourself. Wait until a kernel package from your |
| 584 |
-favourite system integrator (e.g., Red Hat, SuSE or ...) appears. |
| 585 |
- |
| 586 |
-<p>Also, please don't send me questions about this, I can't help you. |
| 587 |
-I do not have any knfsd based servers running. If you find errors or |
| 588 |
-omissions in this documentation, please write to me and I'll revise |
| 589 |
-this HOWTO and release it again. |
| 590 |
- |
| 591 |
-<p>Still reading? Ok. H.J.Lu posts about new versions of this |
| 592 |
-package on the linux-kernel mailing list. Other issues pertaining to |
| 593 |
-NFS in 2.2 is also posted about there. Read it. |
| 594 |
- |
| 595 |
-<p>There is one interesting thing to note about the knfsd package. It |
| 596 |
-announces that it supports NFS version 3. However it does not support |
| 597 |
-it. There is an option you can give to stop it from announcing NFS3, |
| 598 |
-or on the clients you can specify "<tt/vers=2/" in the mount option |
| 599 |
-list. |
| 600 |
- |
| 601 |
-<sect1>The client |
| 602 |
- |
| 603 |
-<p>The client is almost simple. To get propper locking you need to |
| 604 |
-get <tt/statd/ (from the knfsd package) compiled, installed and |
| 605 |
-started from your boot-scripts. Do that. Statd needs a directory |
| 606 |
-called <tt>/var/lib/nfs</tt> to function otherwise it will just abort |
| 607 |
-with no error message, so that directory needs to be created before it |
| 608 |
-will run. |
| 609 |
- |
| 610 |
-<p>Once statd is running you can use the <tt/testlk/ program (in |
| 611 |
-<tt>tools/locktest</tt> to test if locking of a file on a NFS mounted |
| 612 |
-filesystem works. It should. If it prints <em/No locks available/ |
| 613 |
-statd is not working. |
| 614 |
- |
| 615 |
-<p>Actually, you can also avoid locking entierly (not that I recomend |
| 616 |
-this), by giving "<tt/nolock/" in the mount option list. |
| 617 |
- |
| 618 |
-<p>As far as I know this is all that's needed to get the client |
| 619 |
-working. |
| 620 |
- |
| 621 |
-<p>Oh, if you have a Sparc or Alpha NFS server you will find that the |
| 622 |
-nfs client in Linux 2.2 absolutely sucks. The transfer rates to and |
| 623 |
-from the server is so bad that ... you can't imagine. It's far worse |
| 624 |
-than under Linux 2.0. Far. But there is a fix for this of course. |
| 625 |
-The Alan Cox series of 2.2 kernels (which are a bit more experimental |
| 626 |
-than the normal 2.2 kernels from Linus) include a patch to make Linux |
| 627 |
-2.2 perform when used with Alpha and Sparc servers. If you want to |
| 628 |
-use the Alan Cox 2.2 kernels you should be reading the linux-kernel |
| 629 |
-mailing list and if you do you know where the patch can be found. |
| 630 |
-There home site of this patch is <url |
| 631 |
-url="http://www.uio.no/~trondmy/src/">, in case you want to try to |
| 632 |
-apply it to a stock 2.2 kernel. This patch will probably not be in |
| 633 |
-Linux 2.4 either, because it requires too many changes in the kernel |
| 634 |
-to be accepted in the current development cycle. Wait for Linux 2.5. |
| 635 |
- |
| 636 |
-<p><tt/trondmy/ also has patches to make Linux use NFS version 3, this |
| 637 |
-will also enable you to use tcp as transport mechanism instead of UDP. |
| 638 |
-NFSv3 is is very good for long-haul networks and other networks where |
| 639 |
-the packet loss is non-zero or the latencies are high. |
| 640 |
- |
| 641 |
-<p>The reason you should read the linux-kernel mailing list to use |
| 642 |
-these patches is that sometimes there are bad bugs discovered in them. |
| 643 |
-Bugs that eat your files. So please <bf/beware/. |
| 644 |
- |
| 645 |
-<sect1>The server |
| 646 |
- |
| 647 |
-<p>The nfs server demon under Linux 2.2 and later is called |
| 648 |
-"<tt/knfsd/". It is tricky to set it up. You have to figure this out |
| 649 |
-all by yourself, or stick to what SuSE, Red Hat and others are |
| 650 |
-releasing in the way of 2.2 kernel packages. Sorry. You can still use |
| 651 |
-the old nfsd under Linux 2.2 though. It's slow but easy to set up. |
| 652 |
- |
| 653 |
-<sect>NFS server on a floppy |
| 654 |
- |
| 655 |
-<p>This section was written by Ron Peters, <htmlurl |
| 656 |
-url="mailto:rpeters@hevanet.com" name="rpeters@hevanet.com"> It |
| 657 |
-explains how to set up an NFS server when booting up from floppy. It |
| 658 |
-was originally devised to be able to NFS share a cdrom from another |
| 659 |
-non-Linux/UNIX machine to install Linux on a machine that does not |
| 660 |
-have a cdrom. |
| 661 |
- |
| 662 |
-<!-- S e c t i o n - - - - - - - - - - - - - - - B r e a k e r --> |
| 663 |
-<sect1> Introduction |
| 664 |
-<p> |
| 665 |
-This document is being created for those who will run into the same problem |
| 666 |
-I had recently. I was building a Linux server on a machine that didn't have |
| 667 |
-a cdrom and has no facility for adding one except for possibly an external |
| 668 |
-SCSI or the like. Now that it is getting less and less likely that you will |
| 669 |
-be installing on a machine like that, this document may not be that |
| 670 |
-valuable. However, I would have appreciated it when I was trying to build |
| 671 |
-my machine. |
| 672 |
-<p> |
| 673 |
-Since my machine didn't have a cdrom drive, I thought I would go find an NFS |
| 674 |
-server for Win95 and share the cdrom for long enough to install the box and |
| 675 |
-get it on my network. Of the two products I found, (I'm not mentioning names |
| 676 |
-but one was freeware and the other was a 14 day limited license), one didn't |
| 677 |
-work out of the box, and the other couldn't handle the Linux naming |
| 678 |
-convention well enough to complete the install. |
| 679 |
-<p> |
| 680 |
-I then settled on trying to boot my Win95 machine with the boot/root set of |
| 681 |
-disks and then use a suplimentary floppy to set up the NFS server. |
| 682 |
-<p> |
| 683 |
-This was remarkably simple, and the procedure is probably easier than reading |
| 684 |
-this introduction but I believe that putting the whole procedure in one |
| 685 |
-place will be value added. |
| 686 |
-<p> |
| 687 |
- |
| 688 |
-<!-- S e c t i o n - - - - - - - - - - - - - - - B r e a k e r --> |
| 689 |
-<sect1>Expectations |
| 690 |
-<p> |
| 691 |
-This document was derived using the boot/root disks from one of the current |
| 692 |
-InfoMagic developer distributions of Slackware. I used kernel version |
| 693 |
-2.0.34 for the boot/root disks, but the NFS server programs were taken from |
| 694 |
-a 2.0.30 server. I have always used the Slakware installation method, not |
| 695 |
-because it is any easier or better or worse, just that I am comfortable with |
| 696 |
-it and I haven't taken the time to try another method. |
| 697 |
-<p> |
| 698 |
-I don't believe that there will be many problems using this document in |
| 699 |
-relation to OS version. I would recommend using something relatively |
| 700 |
-current. Since it is likely that this will be used for installation, a |
| 701 |
-current boot/root set will likely be used. |
| 702 |
-<p> |
| 703 |
-Your mileage may vary. |
| 704 |
-<p> |
| 705 |
- |
| 706 |
-<!-- S e c t i o n - - - - - - - - - - - - - - - B r e a k e r --> |
| 707 |
-<sect1>Requirements |
| 708 |
-<p> |
| 709 |
-<itemize> |
| 710 |
-<item>Network capable system and boot disk. The system that is to be the |
| 711 |
-NFS server must have a network card and it must be recognized by the during |
| 712 |
-the boot process. More information on this can be found in the Networking |
| 713 |
-HOWTO. |
| 714 |
-<item>Secondary floppy that contains rpc.portmap, rpc.mountd and rpc.nfsd. |
| 715 |
-These files should be easily found from an ftpsearch off the web. |
| 716 |
-<item>Slackware (or other) source media (assumed to be cd). |
| 717 |
-</itemize> |
| 718 |
- |
| 719 |
-<!-- S e c t i o n - - - - - - - - - - - - - - - B r e a k e r --> |
| 720 |
-<sect1> Server Setup |
| 721 |
-<p> |
| 722 |
-<sect2> Boot the temporary NFS server |
| 723 |
-<p> |
| 724 |
-Boot the NFS server system from boot floppy and make sure the network card |
| 725 |
-is recognized. It is also necessary that the CDROM be recognized. I will |
| 726 |
-use eth0 as the example network card. |
| 727 |
-<p> |
| 728 |
-<sect2> Mount the floppy and cdrom |
| 729 |
-<p> |
| 730 |
-Once the system is booted up, the boot/root floppies are not needed. The |
| 731 |
-system is fully contained in RAM. |
| 732 |
-<p> |
| 733 |
-Replace the root floppy with the suplimentary disk. Mount the floppy: |
| 734 |
-<p> |
| 735 |
-<tt>mount /dev/fd0 /floppy</tt> |
| 736 |
-<p> |
| 737 |
-This assumes that the floppy is an ext2 file system type. I imaging that |
| 738 |
-the suplimentary disk could be a DOS floppy with the files on it, but I |
| 739 |
-haven't tried that yet. I imagine that this would be easier that a disk |
| 740 |
-image. In this case, it would be a <tt>mount -t msdos ...etc</tt>. This |
| 741 |
-should probably be put in the todo section. |
| 742 |
-<p> |
| 743 |
-Mount the cdrom: |
| 744 |
-<p> |
| 745 |
-<tt>mount -t iso9660 /dev/hdc /cdrom</tt> |
| 746 |
-<p> |
| 747 |
-The floppy and cdrom devices are the ones I used. These may be different |
| 748 |
-depending on application. The mount points /floppy and /cdrom exist on the |
| 749 |
-root floppy disk image so they can be used. If they don't, create them or |
| 750 |
-you could use any mount points you like. |
| 751 |
-<p> |
| 752 |
-<sect2> Set up networking on the temporary server. |
| 753 |
-<p> |
| 754 |
-This is where the temporary NFS server is set up to talk on the network. |
| 755 |
-There are only a few commands to run. There are a few items of information |
| 756 |
-that you will need before running the commands (values are examples): |
| 757 |
-<p> |
| 758 |
-IPADDR:172.16.5.100 #This is the address of the temporary server. |
| 759 |
-<p> |
| 760 |
-NETMASK:255.255.255.0 #This is the netmask. |
| 761 |
-<p> |
| 762 |
-BROADCAST:172.16.5.255 #The last number (255) is significant from IPADDR. |
| 763 |
-<p> |
| 764 |
-ETHNETWORK:172.16.5.0 #Once again, slightly different from IPADDR. |
| 765 |
-<p> |
| 766 |
-GATEWAY:172.16.5.251 #Only needed if you have a gateway. You will probably |
| 767 |
-know. Most home networks won't have a gateway. |
| 768 |
-<p> |
| 769 |
-The commands to get on the network. Insert values from above: |
| 770 |
-<p> |
| 771 |
-<tt>ifconfig eth0 inet IPADDR arp netmask NETMASK broadcast BROADCAST</tt> |
| 772 |
-<p> |
| 773 |
-<tt>route add -net ETHNETWORK netmask NETMASK eth0</tt> |
| 774 |
-<p> |
| 775 |
-Only use next command if you have a gateway and need to go through it: |
| 776 |
-<p> |
| 777 |
-<tt>route add default gw GATEWAY netmask 0.0.0.0 eth0</tt> |
| 778 |
-<p> |
| 779 |
-If all goes well, you are now on the network and should be able to ping other |
| 780 |
-nodes. |
| 781 |
-<p> |
| 782 |
-<sect2> Set up the NFS share. |
| 783 |
-<p> |
| 784 |
-Determine the directory that you want to NFS share. In the case of the my |
| 785 |
-example, I used the /cdrom/slakware directory. Put this directory in the |
| 786 |
-/etc/exports file: |
| 787 |
-<p> |
| 788 |
-<tt>echo "/cdrom/slakware" > /etc/exports</tt> |
| 789 |
-<p> |
| 790 |
-<sect1> Run the NFS server |
| 791 |
-<p> |
| 792 |
-Go to /floppy/usr/sbin and run: |
| 793 |
-<p> |
| 794 |
-<tt>./rpc.portmap</tt> |
| 795 |
-<p> |
| 796 |
-<tt>./rpc.mountd</tt> |
| 797 |
-<p> |
| 798 |
-<tt>./rpc.nfsd</tt> |
| 799 |
-<p> |
| 800 |
-<sect2> Complete, start the install. |
| 801 |
-<p> |
| 802 |
-This should share the "/cdrom/slakware" directory in the /etc/exports file. |
| 803 |
-Once this is done, you can now boot up the machine to be installed from |
| 804 |
-boot/root floppies (I used same ones that I booted NFS server with) and start |
| 805 |
-the installation. |
| 806 |
-<p> |
| 807 |
-Once you are ready to choose the media source location, choose the NFS |
| 808 |
-server option. It will ask about the ip address of the server. Give it the |
| 809 |
-IP address that you used as IPADDR for the server. It will also ask for the |
| 810 |
-directory to be mounted. This is the directory you put in the /etc/exports |
| 811 |
-on the NFS server. |
| 812 |
-<p> |
| 813 |
-The system will then NFS mount the server. Watch for any error messages. |
| 814 |
-All should be complete and you can continue the installation. |
| 815 |
-<p> |
| 816 |
-<!-- S e c t i o n - - - - - - - - - - - - - - - B r e a k e r --> |
| 817 |
-<sect1>Troubleshooting |
| 818 |
-<p> |
| 819 |
-<sect2> Nothing Here Yet. |
| 820 |
-<p> |
| 821 |
-I don't have any troubleshooting info yet. Perhaps as people use this |
| 822 |
-procedure, there will be more tips and hints available. |
| 823 |
-<p> |
| 824 |
-<!-- S e c t i o n - - - - - - - - - - - - - - - B r e a k e r --> |
| 825 |
-<sect1>To Do |
| 826 |
-<p> |
| 827 |
-<sect2>DOS Disk. |
| 828 |
-<p> |
| 829 |
-Check out a DOS disk for the suplimentary disk. |
| 830 |
-<p> |
| 831 |
-<sect2> rpc commands. |
| 832 |
-<p> |
| 833 |
-Check out specific order of running rpc.* commands and if all or just some |
| 834 |
-of the command needs to be run. |
| 835 |
-<p> |
| 836 |
- |
| 837 |
-<!-- S e c t i o n - - - - - - - - - - - - - - - B r e a k e r --> |
| 838 |
|
| 839 |
<sect>PC-NFS |
| 840 |
|