nfs
nfs
Introduction to NFS
Introduction to File Systems
The NFS Protocol
RPC
NFS Server Configuration
Using the NFS Client
Security Considerations
Major differences between Versions 2 & 3
Introduction to NFS
Ethernet
tigger.ecl.udel.edu
DISK
NFS Server
Introduction to NFS
tigger:/
local local
NFS NFS
file file
client server
access access
port 2049
RPC RPC
TCP/UDP TCP/UDP
IP IP
client kernel server kernel
local local
disk disk
File Handles
How does a server know which file/directory the
client needs to access?
At first, client obtains a file handle for root of the
file system
File handle is opaque to the client
Client sends file handle to server when referencing a
file/directory
No need to use the full path names
“The file handle can contain whatever information the
server needs to distinguish an individual file”
File Handles
NFS Client NFS Server
machine machine
Mount : When
Please let me mount
NFS client starts
up and mounts your/home directory.
home directory These are attributes
of 3625360
NFS : What is FH of "srisatha"
When a user login
in 3625360 ?
FH of srisatha is
9925949
.
.
.
Example of File Handles
NFS Client NFS Server
FH of 856 is 7656838
What is FH of "myname.txt"
in 7656838 ?
¡ FH of myname.txt
is 7657235
What is the attribute of
¢
7657235 ?
.
.
.
Statelessness
What is statelessness ?
Server does not need to maintain protocol state about
it’s client
Server does not keep previous request information
Client keeps track of all information required to send
requests to the server
Advantage :
If server crashes, no state information lost
Client needs only retransmit a request until the server
responds
Why is idempotent important ?
NFS Client NFS Server
Remove OK
Suppose : (tcpdump-D)
client needs to remove
the file sub2/myname.txt
Idempotent procedures
Can be executed more than once by the server and
still return the same result
Stateless protocol requires idempotent operation
How to makes all NFS requests idempotent:
Server records recently performed operations in cache
Server checks in cache for duplicate requests
Server returns the previous result if it is a duplicate
Should NFS use TCP or UDP ?
From the beginning, NFS used UDP
Most NFS systems were on LAN
High overhead if using TCP
Currently, NFS across WAN needs TCP
Reliability and congestion control
Both sides set TCP’s keep alive option
If server crashes, client opens new TCP connection
If client crashes, server will terminate the connection
after the next keep alive probe
The NFS Protocol
Each relies on Remote Procedure Calls (RPC)
and Portmap (also called rpc.portmap).
An RPC server tells portmap which port will be
used and the managed RPC number
A client contacts portmap to get port number of
desired server program
RPC packets are addressed to the corresponding
port
Use the rpcinfo -p command to obtain
details on services
How does RPC works ?
Client Server
executes RPC waits
message
Server starts
Procedure call
Client Server executes
waits procedure
Procedure return
RPC return
message Call terminates
Client
continues
RPC versus local procedure call
Error handling:
failures of the server or network must be handled
Global variables:
arguments cannot be passed as global variables
Performance:
slower than local procedure calls
Authentication:
RPC can be transported over insecure networks
List of RPC Programs
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100005 1 udp 32890 mountd
100005 2 udp 32890 mountd
100005 3 udp 32890 mountd
100005 1 tcp 32870 mountd
100005 2 tcp 32870 mountd
100005 3 tcp 32870 mountd
Port Mapper : Analogy
Airport Entrance
Terminal A Terminal F
US109 to Akron
Terminal B Terminal E
Terminal D
Terminal C
Port Mapper : Analogy
Airport Entrance
UDP header 8
Transaction ID (XID) 4
Send direction (0) 4
RPC version (2) 4
Program number 4
common for all Version number 4
Sun RPC Procedure number 4
procedure call
Credentials up to 408 bytes
depends on specific
procedure being Procedure call parameters N
called
Format of RPC reply
IP header 20 bytes
UDP header 8
Transaction ID (XID) 4
Send direction (1) 4
common for all Status (0=accepted) 4
Sun RPC
procedure Verifier up to 400 bytes