1 / 48

CMPE 151: Network Administration

CMPE 151: Network Administration. Servers II. Announcements. More services…. NFS and Samba. Network File System (NFS). File systems. Provide set of primitives that abstract users from details of storage access and management. Distributed file systems.

tender
Télécharger la présentation

CMPE 151: Network Administration

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CMPE 151: Network Administration Servers II Winter 2005

  2. Announcements Winter 2005

  3. More services… • NFS and Samba. Winter 2005

  4. Network File System (NFS) Winter 2005

  5. File systems • Provide set of primitives that abstract users from details of storage access and management. Winter 2005

  6. Distributed file systems • Promote sharing across machine boundaries. • Transparent access to files. • Make diskless machines viable. • Increase disk space availability by avoiding duplication. • Balance load among multiple servers. Winter 2005

  7. Sun Network File System • De facto standard: • Mid 80’s. • Widely adopted in academia and industry. • Provides transparent access to remote files. • Uses Sun RPC. • NFS protocol defined as set of procedures and corresponding arguments. • Synchronous RPC: • Client blocks until it gets results from server. Winter 2005

  8. Stateless server • Remote procedure calls are self-contained. • Servers don’t need to keep state about previous requests. • Flush all modified data to disk before returning from RPC call. • Robustness. • No state to recover. • Clients retry. Winter 2005

  9. Location transparency • Client’s file name space includes remote files. • Shared remote files are exported by server. • They need to be remotely mounted by client. Winter 2005

  10. File system hierarchy Server 2 /root Server 1 /root Client /root nfs export usr vmunix users staff users students ann eve joe bob Winter 2005

  11. Achieving transparency • Mount service. • Mount remote file systems in the client’s local file name space. • Mount service process runs on each node to provide RPC interface for mounting and unmounting file systems at client. • Runs at system boot time or user login time. Winter 2005

  12. Automounter • Dynamically mounts file systems. • Runs as user-level process on clients (daemon). • Resolves references to un-mounted pathnames by mounting them on demand. • Maintains a table of mount points and the corresponding server(s). • Primitive form of replication. Winter 2005

  13. Transparency? • Early binding. • Mount system call attaches remote file system to local mount point. • Client deals with host name once. • But, mount needs to happen before remote files become accessible. Winter 2005

  14. Other Functions • NFS file and directory operations: • read, write, create, delete, getattr, etc. • Access control: • File and directory access permissions. • Path name translation: • Lookup for each path component. • Caching. Winter 2005

  15. Implementation Client process Unix Kernel Unix Kernel VFS VFS RPC Unix FS NFS client NFS server Unix FS Client Server Winter 2005

  16. Observations • NFS didn’t change the file system API. • Users access remote files with the same operations used for local ones. • If access is to remote file, NFS client makes a remote procedure call to NSF server where file resides. Winter 2005

  17. Virtual File System (1) • VFS added to UNIX kernel. • Location-transparent file access. • Distinguishes between local and remote access. • @ client: • Processes file system system calls to determine whether access is local (passes it to UNIX FS) or remote (passes it to NFS client). • @ server: • NFS server receives request and passes it to local FS through VFS. Winter 2005

  18. VFS (2) • If local, translates file handle to internal file id’s (in UNIX i-nodes). • V-node: • If file local, reference to file’s i-node. • If file remote, reference to file handle. • File handle: uniquely distinguishes file. I-node # I-node generation # File system id Winter 2005

  19. Remote Procedure Call (RPC) • Builds on message passing. • Main idea: extend traditional (local) procedure call to perform transfer of control and data across network. • Easy to use: analogous to local calls. • But, procedure is executed by a different process, probably on a different machine. • Fits very well with client-server model. Winter 2005

  20. RPC Mechanism 1. Invoke RPC. 2. Calling process suspends. 3. Parameters passed across network to target machine. 4. Procedure executed remotely. 5. When done, results passed back to caller. 6. Caller resumes execution. Is this synchronous or asynchronous? Winter 2005

  21. RPC Advantages • Easy to use. • Well-known mechanism. • Abstract data type • Client-server model. • Server as collection of exported procedures on some shared resource. • Example: file server. • Reliable. Winter 2005

  22. RPC Semantics (1) • Delivery guarantees. • “Maybe call”: • Clients cannot tell for sure whether remote procedure was executed or not due to message loss, server crash, etc. • Usually not acceptable. Winter 2005

  23. RPC Semantics (2) • “At-least-once” call: • Remote procedure executed at least once, but maybe more than once. • Retransmissions but no duplicate filtering. • Idempotent operations OK; e.g., reading data that is read-only. Winter 2005

  24. RPC Semantics (3) • “At-most-once” call • Most appropriate for non-idempotent operations. • Remote procedure executed 0 or 1 time, ie, exactly once or not at all. • Use of retransmissions and duplicate filtering. • Example: Birrel et al. implementation. • Use of probes to check if server crashed. Winter 2005

  25. RPC Implementation (1) Caller Callee User stub RPC runtime RPC runtime Server stub Call packet User Server work rcv call unpk call xmit pck args Result pck result unpk result xmit return rcv return Winter 2005

  26. RPC Implementation (2) • RPC runtime mechanism responsible for retransmissions, acknowledgments. • Stubs responsible for data packaging and un-packaging; • AKA marshalling and un-marshalling: putting data in form suitable for transmission. Example: Sun’s XDR. Winter 2005

  27. Binding • How to determine where server is? Which procedure to call? • “Resource discovery” problem • Name service: advertises servers and services. • Example: Birrel et al. uses Grapevine. • Early versus late binding. • Early: server address and procedure name hard-coded in client. • Late: go to name service. Winter 2005

  28. Synchronous and Asynchronous RPC Synchronous Asynchronous Client Server Client Server Winter 2005

  29. RPC Performance • Sources of overhead • data copying • scheduling and context switch. • Light-Weight RPC • Shows that most invocations took place on a single machine. • LW-RPC: improve RPC performance for local case. • Optimizes data copying and thread scheduling for local case. Winter 2005

  30. Transport protocol • Originally used UDP. • Better performance in LANs. • NFS and RPC do their own reliability checks. • Most current implementations use TCP. • WANs: congestion control. • TCP officially integrated in NFS v.3. Winter 2005

  31. NFS caching • File contents and attributes. • Client versus server caching. Server Client $ $ Winter 2005

  32. Server caching • Read: • Same as UNIX FS. • Caching of file pages and attributes. • Cache replacement uses LRU. • Write: • Write through (as opposed to delayed writes of conventional UNIX FS). Why? • [Delayed writes: modified pages written to disk when buffer space needed, sync operation (every 30 sec), file close]. Winter 2005

  33. Client caching (1) • Timestamp-based cache invalidation. • Read: • Cached entries have TS with last-modified time. • Blocks assumed to be valid for TTL. • TTL specified at mount time. • Typically 3 sec for files. Winter 2005

  34. Client caching (2) • Write: • Modified pages marked and flushed to server at file close or sync (every 3 sec). • Consistency? • Not always guaranteed! • E.g., client modifies file; delay for modification to reach servers + 3-sec window for cache validation from clients sharing file. Winter 2005

  35. Cache validation • Validation check performed when: • First reference to file after TTL expires. • File open or new block fetched from server. • Done for all files (even if not being shared). • Expensive! • Potentially, every 3 sec get file attributes. • If needed invalidate all blocks. • Fetch fresh copy when file is next accessed. Winter 2005

  36. Network Information Service (NIS) Winter 2005

  37. NIS • Originally called Sun Yellow Pages. • NIS commands still start with “yp”. • Administrative database. • Spans server and its clients. • Server keeps authoritative copies of system files. • Server propagates database over network. • Maps in /var/yp. Winter 2005

  38. Data files and the NIS database • Data files edited with text editor. • Updated files are then converted into database format (hashing) using e.g., ypmake. • Example data file: /etc/passwd, /etc/group Winter 2005

  39. Replication • Slave servers can replicate network maps. • When master copy is updated, updated copy needs to be pushed out to slavs (yppush and ypxfr). Winter 2005

  40. NIS Operation • ypbind runs on every machine; detects a NIS server and returns its id to client. • Server used for all remaining queries. • ypserv runs on servers (master and slaves) accepting and answering queries by looking up NIS maps. Winter 2005

  41. Samba Winter 2005

  42. What is Samba? • Allows resource sharing between Unix-based and MS Windows-based systems. “Samba is a freely available SMB server for Unix… Samba runs on a great many Unix variants (Linux, Solaris, …, FreeBSD, …, etc.)…” [www.samba.org/cifs/docs/what-is-smb.html] Winter 2005

  43. How does it work? • Set of UNIX applications running the Server Message Block (SMB) protocol. • SMB is the protocol MS Windows use for client-server interactions over a network. • By running SMB, Unix systems appear as another MS Windows system. • smbd daemon. Winter 2005

  44. Samba services • File sharing. • Printer sharing. • Client authentication. Winter 2005

  45. SMB protocol • Request/response. • Runs atop TCP/IP. • E.g., file and print operations. • Open close, read, write, delete, etc. • Queuing/dequeing files in printer spool. Winter 2005

  46. SMB message • Header + command/response. • Header: protocol id, command code, etc. • Command: command parameters. Winter 2005

  47. Establishing a SMB connection • Establish TCP connection. • Negotiate protocol variant. • Client sends SMBnegprot. • Client sends lists of variants it can speak. • Server responds with index into client’s list. • Set session and login parameters. • Account name, passwd, workgroup name, etc. Winter 2005

  48. Security levels • “Share-wide”: authorized clients can access any file under that share. • “File-level”: before accessing any file, client needs to be authenticated; in fact, client authenticated once and uses UID for future accesses. Winter 2005

More Related