660 likes | 788 Views
CMPE 151: Network Administration. Lecture 4. Project 3: Basic Servers. Telnet/Finger FTP Web NNTP SSH. The Web and HTTP (Cont’d). Uniform Resource Locator. Way to identify objects (pages). What is page called? Where is it located? How to access page? URL has 3 parts:
E N D
CMPE 151: Network Administration Lecture 4 Spring 2004
Project 3: Basic Servers • Telnet/Finger • FTP • Web • NNTP • SSH Spring 2004
The Web and HTTP (Cont’d) Spring 2004
Uniform Resource Locator • Way to identify objects (pages). • What is page called? • Where is it located? • How to access page? • URL has 3 parts: • Protocol (or scheme). • Machine’s name/address. • Local name (file name). Spring 2004
URL • Ability to handle other protocols. • HTTP, FTP, news, gopher, mail, telnet. Spring 2004
HyperText Markup Language • Allows users to produce Web pages including text, graphics, pointers, etc. • Application of the ISO SGML (Standard Generalized Markup Language) standard. • Markup language: describe how objects are to be formatted. • Contains explicit commands for formatting. • Example: <B> and </B>. • Advantages: easy to parse. Spring 2004
Dynamic Pages • A dynamic document is generated by the server at each new connection. • That’s why sometimes, when downloading from the same URL, we obtain different pages. • Common Gateway Interface (CGI) standard defines server-application interaction. • CGI programs can be as simple as adding the time or date to the page. • Browser may supply parameters to CGI program. • Browser extends URL with additional parameters separated by ? Spring 2004
Forms • Forms permit a web page to have blank areas in which the user must enter information. • Makes it possible to enter data directly. • Name, address, credit card info… • Allows information to be sent to the server directly. Spring 2004
Forms • HTML 1.0: one-way exchange. • Enable users to get information from servers. • Users could not send information back. • Example: on-line order forms. • HTML 2.0 allows forms. • INPUT, SUBMIT. • <FORM> and </FORM>. Spring 2004
CGI • Common Gateway Interface. • CGI scripts: programs that read input, process it, and generate output. • Example: after completing a form, user clicks on SUBMIT; this causes browser to invoke associated CGI script (given by URL). CGI script can generate output in the form of a HTML page that is returned to browser, which interprets and displays it. • Commercial use of the Web. Spring 2004
What is a Cookie? Spring 2004
What is a Cookie? • A server invokes a CGI program each time a request arrives for the associated URL. • The server does not maintain any history of requests. • But a history is useful to allow CGI program to participate in dialog (e.g., to avoid having a user answer questions repeatedly). • Information saved between invocations is called state information. • State information is kept at the client’s side! Spring 2004
What is a Cookie (cont’d) • State information is passed by browser in the form of a cookie. • The cookie is kept in the client’s computer. • When it contacts the Web server again, the browser inserts the cookie in the request. Spring 2004
A More Interactive Web • HTML used to write static Web pages. • With CGI, some “activation” possible. • Java makes the Web more interactive. • Java program is executed directly on the client’s machine. • Allows to add animation, sound, etc. to Web pages efficiently • Remote execution model. • Instead of buying software, installing it, etc., just click on the appropriate applet from vendor’s Web page and get applet downloaded, executed, etc. Spring 2004
Proxy servers • What are proxy servers? • Close to client. • Close to server. Spring 2004
Client-side proxies Proxy Clients Servers Spring 2004
Server-side proxies Clients Proxy Proxy Servers Spring 2004
Caching • What’s caching? • What are its benefits? • What are its problems? Spring 2004
HTTP support for caching • Servers can control caching. • Cachable/non-cacheable object. • Cacheable at proxy. • Cached object expiration time. • Operations performed on cached copy. • Browsers can force request to go to server. • Specifies maximum age not to be > 0. Spring 2004
Internet caches • Peers. • Hierarchical caches. Spring 2004
Network News Spring 2004
NNTP • Network News Transfer Protocol. • RFC 977 (1986) • Distribution of news articles. • Inquire, retrieve, and post articles. Spring 2004
Alternative • Mailing lists. • Scalability issues. • Maintenance issues. Spring 2004
(Usenet) News • Client/server model. • News server maintains news database. • Client connects to server and reads, posts, etc. articles. Spring 2004
News Distribution • News database distributed among several news servers. • How to distribute news among servers? • One alternative is flooding (UUCP)! Spring 2004
NNTP • NNTP is “pull” based. • Server connects to its “neighbor”. • Asks whether there any new newsgorups. • Asks whether there are any new news articles in the relevant newsgroups. • Uses TCP. Spring 2004
NNTP Logical Topology UCB UCSC UofArizona Stanford Spring 2004
Some NNTP Commands • ARTICLE. • Displays header and body of specified article. • HEAD and BODY. • GROUP. • Returns article numbers of first and last articles in the group. • IHAVE. • Informs that client has articles specified. Spring 2004
More NNTP Commands • LIST. • Returns list of valid newsgroups. • NEWGROUPS. • Returns list of new groups created. • NEWNEWS. • Returns list of new articles posted. • POST. Spring 2004
Secure Shell (SSH) Spring 2004
What’s SSH? • Secure alternative to remote access services (e.g., rlogin, telnet, etc.). • Provides authentication and secure communication. • ssh client and ssh server. Spring 2004
SSH in operation • Client authentication: • Several methods: host-based, asymmetric keys, password-based. • Host-based authentication: e.g., if client machine is in /etc/hosts.equiv or /etc/shosts.equiv. • Asymmetric keys:set of allowed public/private key pairs; user selects one pair; informs server; server checks if key is allowed; replies with a “challenge”, i.e., a random number encrypted with client pulic key. • Password-based authentication (all communication encrypted) Spring 2004
SSH operation (cont’d) • After the authentication phase, the user can login to the machine, execute commands remotely, etc. • SSH database keeps id information about all hosts it has ever communicated with. • For RSA authentication, user generates public-private key pair and stores it locally; the user should then copy the public key to specific directory in the user’s home directory in the remote machine. After this, login is automatic. Spring 2004
More services… • NFS and Samba. Spring 2004
Network File System (NFS) Spring 2004
File Systems • Provide set of primitives that abstract users from details of storage access and management. Spring 2004
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. Spring 2004
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 and XDR. • NFS protocol defined as set of procedures and corresponding arguments. • Synchronous RPC: • Client blocks until it gets results from server. Spring 2004
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. Spring 2004
Location Transparency • Client’s file name space includes remote files. • Shared remote files are exported by server. • They need to be remote-mounted by client. Spring 2004
File system hierarchy Server 2 /root Server 1 /root Client /root nfs export usr vmunix users staff users students ann eve joe bob Spring 2004
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. Spring 2004
Automounter • Dynamically mounts file systems. • Runs as user-level process on clients (daemon). • Resolves references to unmounted pathnames by mounting them on demand. • Maintains a table of mount points and the corresponding server(s); sends probes to server(s). • Primitive form of replication. Spring 2004
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. Spring 2004
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. Spring 2004
Implementation Client process Unix Kernel Unix Kernel VFS VFS RPC Unix FS NFS client NFS server Unix FS Client Server Spring 2004
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. Spring 2004
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. Spring 2004
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? Spring 2004
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. Spring 2004