
Bài giảng Chương 4: Internet
lượt xem 2
download

"Bài giảng Chương 4: Internet" giới thiệu về internet, họ giao thức TCP/IP, một số dịch vụ trên internet, các dạng hoạt động của socket. Mời các bạn cùng tham khảo bài giảng để nắm chi tiết hơn nội dung kiến thức.
Bình luận(0) Đăng nhập để gửi bình luận!
Nội dung Text: Bài giảng Chương 4: Internet
- CHƢƠNG IV. INTERNET NỘI DUNG CỦA CHƢƠNG I. Giới thiệu Internet I.1. Giới thiệu Internet I.2. Họ giao thức TCP/IP II. Một số dịch vụ trên Internet II.1. Mô hình Client/ Server. II.2. Dịch vụ giao thức : HTTP. II.3. Dịch vụ truyền File : Ftp II.4. Dịch vụ: Electronic Mail II.5. Dịch vụ đặt tên mềm DNS III. Các dạng hoạt động của Socket III.1.TCP Sockets. III.2. UDP Sockets. iV. Thảo Luận I.1. GIỚI THIỆU INTERNET Tháng 6/1968 cục các dự án tiên tiến của bộ Quốc phòng Mỹ đã xây dựng án liên kết 4 trung nghiên cứu lớn trong toàn liên bang là : Viện nghiên cứu Stanford, Đaị học California Los Angeles, Đại học California Santa Barbara và Đại học Utah thành một hệ thống thống nhất để trao đổi các thông tin. Đến giữa năm 1969, 4 trạm đầu tiên đã kết nối thành công, đánh dấu sự ra đời của mạng ARPANET – tiền thân của INTERNET. Giao thức truyền thông dùng trong ARPANET đƣợc gọi là NCP (Network Control Protocol). Tuy nhiên xuất phát từ nhu cầu thực tế, các nhà thiết kế ARPANET đã nhận thức đƣợc xây dựng một mạng của các mạng máy tính “Mạng của các mạng- INTERNET”, vì vậy giữa những năm 70, họ giao thức TCP/IP đƣợc Vint Cerf và Robert Kahn đề xuất và phát triển, ban đầu cùng tồn tại với NCP trong mạng ARPANET và đến năm 1983 thì hoàn toàn thay thế NCP. Thuật ngữ INTERNET đƣợc xuất hiện lần đầu tiên vào năm 2 1974. Nhƣng tên gọi ARPANET vẫn tồn tại cho đầu những năm 80, đến 11/1986 đã có 1
- So sánh thời gian đạt đƣợc 50 triệu ngƣời dùng trên thế giới: • Telephone sau 74 năm • Radio sau 38 năm • PC sau 16 năm • TV sau 13 năm • WWW sau 4 năm 3 • Cấu trúc mạng và kết nối Internet • Internet là một mạng GAN dựa trên kết nối liên mạng WAN, sử dụng mô hình TCP/IP. Việc kết nối và truy cập Internet của ngƣời dùng đƣợc cung cấp bởi các nhà cung cấp dịch vụ Internet ISP (Internet Service Provider). Các Các ISP phải thuê đƣờng và cổng của một IAP. 4 2
- 5 I.2. HỌ GIAO THỨC TCP/IP TCP/IP là một giao thức cùng làm việc với nhau để cung cấp phƣơng tiện truyền thông liên mạng. So sánh với mô hình tham chiếu SoOSI ta thấy: sánh các mô hình giao thức trên INTERNET TCP/IP Model TCP/IP Protocols OSI Ref Model Application Application FTP Telnet HTTP Presentation Session Transport TCP UDP Transport Internetwork IP Network Host to EtherPacketPoint-to- Datalink Network net Radio Point Physical 6 3
- 1. Hoạt động của giao thức IP-Internet Protocol application •Application: Truyền thông và transport network data link các quá trình phân tán physical – Thực hiện giao dịch giữa các Hosts theo địa chỉ ngƣời dùng – Thay đổi các thông báo theo yêu cầu ứng dụng – Thực hiện các dịch vụ E-mail, truyền file (FTP), WWW,... application application transport transport network network data link data link physical physical 7 Phân tích quá trình hoạt động của mô hình giao thức IP trên INTERNET ta có thấy việc giao dịch đƣợc tiến hành: 8 4
- HOST 1 ROUTER A ROUTER B HOST 2 Application Application TCP TCP IP IP IP IP DLa DLa DLa DLa PHYa PHYa PHYa PHYa LAN A WAN LAN B IP là giao thức kiểu không liên kết có nghĩa là không cần gian đoạn thiết lập liên kết trƣớc khi truyền dữ liệu. Đơn vị dùng trong IP đƣợc gọi là Datagram có khuôn dạng tổng quát giống nhƣ các PDU đã biết. Hoạt động của giao thức ở tầng IP đƣợc mô tả nhƣ 9 sau: Đối với thực thể IP ở trạm nguồn: 1. Tạo một IP Datagram để gửi đi 2. Tính Checksum và ghép vào Header của Datagra 3. Ra quyết định chọn đƣờng: hoặc trạm đích thuộc cùng một mạng hoặc khác mạng chuyển tới Router hoặc Gateway tiếp theo. 4. Chuyển Datagram xuống tầng dƣới để truyền qua Đối với Gateway hoặc Router: mạng. 1. Tính lại Checksum nếu có lỗi thì loại bỏ. 2. Giảm giá trị tham số Time to Live. Nếu bằng 0 thì loại bỏ. 3. Ra quyết định chọn đƣờng. 4. Phân đoạn Datagram nếu cần. 5. Kiến tạo lại IP Header, bao gồm giá trị mới của tham số Time to Live, phân đoạn và Checksum. 6. Chuyển Datagram xuống tầng dƣới để truyền qua mạng. 10 5
- Đối với thực thể IP ở trạm đích: 1. Tính Checksum nếu có lỗi thi loại bỏ 2. Tập hợp các Datagram nếu dữ liệu bị phân đoạn. 3. Chuyển Datagram và các tham số điều khiển lên tầng 2. Giao trên.thức TCP – Transfer Control Protocol TCP là giao thức có liên kết, tức là cần phải thiết lập liên kết (logic) giữa hai thực thể trƣớc khi tiến hành trao đổi dữ liệu. Đơn vị dữ liệu sử dụng trong TCP gọi là Segment (đoạn dữ liệu). Khuôn dạng tổng quát nhƣ sau: 11 Source Port Destination Port Sequence Number Acknowledgment Number Data Reser- U A P R S F Offset ved R C S S Y I Window G K H T N N Checksum Urgent Pointer Option Padding TCP data Source Destination Port Số hiệu cổng. Optiont Khai báo các thay đổi. URG Con trỏ khẩn có hiệu lực. ACK Tín hiệu báo nhận. PSH Chức năng đẩy. RST Reset. SYN Đồng bộ hoá. FIN Không còn dữ liệu từ trạm nguồn. 12 6
- Một cổng kết hợp với một địa chỉ IP tạo thành một Socket duy nhất trong liên mạng. Dịch vụ TCP đƣợc cung cấp nhờ một liên kết logic giữa một cặp Socket. Một Socket có thể tham gia với nhiều Socket ở xa. Trƣớc khi truyền dữ liệu giữa 2 trạm cần phải thiết lập liên kết TCP giữa chúng và khi không còn nhu cầu truyền dữ liệu thì liên kết đó sẽ đƣợc giải phóng. 3. Giao thức UDP – User Datagram Protocol UDP là giao thức không liên kết đƣợc sử dụng thay thế cho TCP theo yêu cầu của ứng dụng. Nó thƣờng đƣợc dùng cho các ứng dụng không đòi hỏi độ tin cậy cao trong giao vận. Đơn vị dữ liệu đƣợc gọi là UDP datagram. Có khuôn dạng nhƣ sau: Source Port Destination Port Message Length Checksum Data 13 II. MỘT SỐ DỊCH VỤ TRÊN INTERNET TCP/IP là một giao thức cùng làm việc với nhau để cung cấp phương tiện truyền thông liên mạng. So sánh với mô hình tham chiếu OSI ta thấy: 1. Dịch vụ WWW 2. Dịch vụ Telnet 3. Dịch vụ Email 4. Dịch vụ FTP 5. Dịch vụ tên miền DNS 14 7
- II.1. Mô hình Client-server Một trao đổi điển hình giữa: application transport network client và server data link physical Client: request • Khëi t¹o kÕt nèi víi server (“speaks first”) • Yªu cÇu requests dÞch vô reply tõ server, application transport • C¸c dÞch vô nh- Web, network data link physical client lµ c«ng cô duyÖt browser; nh- e-mail lµ ®äc th- 15 II.2. Dịch vụ: giao thức http http: hypertext transfer protocol Dịch vụ Web thuộc giao thức tầng ứng dụng Mô hinh client/server PC running Explorer client: duyệt và tiếp nhận các yêu cầu, “displays” Web objects Server server: Web server running chuyển các đối tƣợng để Apache Web đáp ứng các yêu cầu server http1.0: RFC 1945 Mac running http1.1: RFC 2068 Navigator 16 8
- Ví dụ về http Giả sử ngƣời sử dụng đƣa vào địa chỉ URL sau www. School.edu/Department/home.index (contains text, references to 10 jpeg images) 1a. http client initiates TCP connection to http server 1b. http server at host www. (process) at www. School.edu waiting for TCP School.edu. Port 80 is connection at port 80. default for http server. “accepts” connection, notifying client 2. http client sends http request message 3. http server receives request (containing URL) into TCP message, forms response connection socket message containing requested object (Department/home.index), time sends message into socket 17 http example (cont.) 4. http server closes 5. http client receives TCP connection. response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg time objects 6. Steps 1-5 repeated for each of 10 jpeg objects 18 9
- Dạng tổng quát của http request message 19 Khuôn dạng của http message: response status line (protocol status code HTTP/1.0 200 OK status phrase) Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) header Last-Modified: Mon, 22 Jun 1998 …... Content-Length: 6821 lines Content-Type: text/html data data data data data ... data, e.g., requested html file 20 10
- User-server interaction: authentication Authentication goal: control access to server client server • stateless: client presents usual http request msg authorization in each 401: authorization req. request WWW authenticate: • authorization: typically name, password usual http request msg – authorization: + Authorization:line header line in request usual http response msg – Sends header line WWW authenticate: usual http request msg if unauthorized + Authorization:line Browser caches name & password so usual http response msg time that user does not have to repeatedly enter it. 21 User-server interaction: cookies • server sends “cookie” to client in server client response msg Set-cookie: 1678453 usual http request msg • client presents usual http response + cookie in later Set-cookie: # requests cookie: 1678453 usual http request msg cookie: # cookie- • server matches spectific presented-cookie usual http response msg action with server-stored info usual http request msg cookie- – authentication cookie: # spectific – remembering user usual http response msg action preferences 22 11
- User-server interaction: conditional GET • Goal: don’t send object if client has up- client server to-date stored (cached) version http request msg If-modified-since: object • client: specify date of not cached copy in http http response modified request HTTP/1.0 304 Not Modified If-modified-since: • server: response http request msg contains no object if If-modified-since: cached copy up-to- object modified date: http response HTTP/1.0 304 Not HTTP/1.1 200 OK Modified … 23 Web Caches (proxy server) Goal: satisfy client request without involving origin server • user sets browser: Web accesses via web cache origin server • client sends all http requests to web cache Proxy server – if object at web client cache, web cache immediately returns object in http response – else requests object from origin server, client origin then returns http server response to client 24 12
- Why Web Caching? Assume: cache is origin “close” to client servers (e.g., in same public Internet network) • smaller response time: cache 1.5 Mbps “closer” to client institutional access link network • decrease traffic to distant servers 10 Mbps LAN – link out of institutional/local institutional ISP network often cache bottleneck 25 Mô hình phân phối nội dung Networks Browsers Web Server 26 13
- Xảy ra tắc nghẽn trên đƣờng truyền Networks Browsers Routers Web Servers 27 II.3. Dịch vụ truyền File ftp FTP file transfer FTP FTP user client server interface user at host local file remote file system system • transfer file to/from remote host • client/server model – client: side that initiates transfer (either to/from remote) – server: remote host • ftp: RFC 959 • ftp server: port 21 28 14
- ftp: separate control, data connections • ftp client contacts ftp server at port 21, specifying TCP as transport protocol • two parallel TCP TCP control connection port 21 connections opened: – control: exchange commands, responses TCP data connection FTP port 20 FTP between client, server. client server “out of band control” – data: file data to/from server • ftp server maintains “state”: current directory, earlier authentication 29 ftp commands, responses Sample commands: Sample return codes • sent as ASCII text over • status code and control channel phrase (as in http) • USER username • 331 Username OK, • PASS password password required • LIST returns list of file • 125 data in current directory connection • RETR filename already open; retrieves (gets) file transfer starting • STOR filename stores • 425 Can’t open (puts) file onto remote data connection host • 452 Error writing file 30 15
- II.4. Dịch vụ: Electronic Mail outgoing Three major components: message queue • user agents user mailbox user • mail servers agent • simple mail transfer mail user protocol: smtp server agent SMTP mail User Agent server user • a.k.a. “mail reader” SMTP agent • composing, editing, reading mail messages SMTP mail user • e.g., Eudora, Outlook, server agent elm, Netscape user Messenger agent • outgoing, incoming user messages stored on agent server 31 Electronic Mail: mail servers Mail Servers user • mailbox contains agent incoming messages mail user (yet to be read) for user server agent • message queue of SMTP mail outgoing (to be sent) server user mail messages SMTP agent • smtp protocol between mail servers to send SMTP mail user email messages server agent – client: sending mail user server agent – “server”: receiving user agent mail server 32 16
- Mail message format smtp: protocol for exchanging email msgs RFC 822: standard for header blank text message format: line • header lines, e.g., – To: – From: body – Subject: different from smtp commands! • body – the “message”, ASCII characters only 33 Message format: multimedia extensions • MIME: multimedia mail extension, RFC 2045, 2056 • additional lines in msg header declare MIME content type From: alice@crepes.fr MIME version To: bob@hamburger.edu Subject: Picture of yummy crepe. method used MIME-Version: 1.0 to encode data Content-Transfer-Encoding: base64 Content-Type: image/jpeg multimedia data type, subtype, base64 encoded data ..... parameter declaration ......................... ......base64 encoded data encoded data 34 17
- Mail access protocols SMTP SMTP POP3 or user user agent IMAP agent sender’s mail receiver’s mail server server • SMTP: delivery/storage to receiver’s server • Mail access protocol: retrieval from server – POP: Post Office Protocol [RFC 1939] • authorization (agent server) and download – IMAP: Internet Mail Access Protocol [RFC 1730] • more features (more complex) • manipulation of stored msgs on server – HTTP: Hotmail , Yahoo! Mail, etc. 35 POP3 protocol authorization phase S: +OK POP3 server ready • client commands: C: user alice S: +OK – user: declare C: pass hungry username S: +OK user successfully logged on – pass: password C: list • server responses S: 1 498 – +OK S: 2 912 S: . – -ERR C: retr 1 transaction phase, client: S: S: . • list: list message C: dele 1 numbers C: retr 2 S: • retr: retrieve S: . message by number C: dele 2 • dele: delete C: quit S: +OK POP3 server signing off • quit 36 18
- II.5. Dịch vụ đặt tên mềm DNS root name server host surf.eurecom.fr wants IP address of gaia.cs.umass.edu 2 4 1. Contacts its local DNS 3 5 server, dns.eurecom.fr 2. dns.eurecom.fr contacts root name local name server authorititive name server server, if necessary dns.eurecom.fr dns.umass.edu 3. root name server 1 6 contacts authoritative name server, dns.umass.edu, if requesting host gaia.cs.umass.edu necessary surf.eurecom.fr 37 III. Các dạng hoạt động của Socket. III.1. TCP sockets Socket: Là cửa kết nối giữa một quá trình ứng dụng và đâu cuôi giao thức tầng transport (UCP or TCP) TCP service: dịch vụ vận chuyển tin cậy các byte từ một quá trình này sang một quá trình khác controlled by controlled by process application application process developer developer socket socket controlled by TCP with TCP with controlled by operating buffers, buffers, operating internet variables system system variables host or host or server server 38 19
- TCP sockets Client must contact server • When client creates socket: client TCP establishes • server process must connection to server TCP first be running • When contacted by client, • server must have server TCP creates new created socket (door) socket for server process that welcomes client’s to communicate with client contact – allows server to talk with Client contacts server by: multiple clients • creating client-local TCP socket application viewpoint • specifying IP address, TCP provides reliable, in-order port number of server transfer of bytes (“pipe”) process between client and server 39 TCP Sockets Example client-server app: Input stream: sequence • client reads line from of bytes into process standard input Output stream: (inFromUser stream) , sequence of bytes sends to server via out of process socket (outToServer stream) • server reads line from socket • server converts line to uppercase, sends back to client • client reads, prints modified line from socket client socket (inFromServer stream) 40 20

CÓ THỂ BẠN MUỐN DOWNLOAD
-
Bài giảng mạng máy tính (ĐH FPT) - Chương 4 Kết nối mạng và Internet
21 p |
303 |
90
-
Bài giảng Tin học đại cương: Chương 4 - ĐH Nông nghiệp Hà Nội
13 p |
173 |
15
-
Bài giảng Mạng máy tính và Internet: Chương 4 - Trần Quang Hải Bằng
39 p |
135 |
13
-
Bài giảng Chương 4: Hệ điều hành Windows
77 p |
98 |
11
-
Bài giảng Tin học đại cương - Chương 4: Mạng máy tính và internet
51 p |
68 |
10
-
Bài giảng Mạng máy tính và truyền thông - Chương 4: Mạng Internet và truyền thông thương mại điện tử
9 p |
65 |
9
-
Bài giảng Mạng máy tính: Chương 4 - PGS. TS. Nguyễn Hữu Thanh
60 p |
122 |
6
-
Bài giảng Tin học đại cương: Chương 4 - Lê Minh Thủy
51 p |
68 |
6
-
Bài giảng học phần Tin học đại cương: Chương 4 - Học viện Nông nghiệp Việt Nam
15 p |
57 |
6
-
Bài giảng Tin học đại cương (Introduction to Informatics) - Chương 4
15 p |
13 |
5
-
Bài giảng Mạng máy tính: Chương 4 - ThS. Nguyễn Trung Dũng
34 p |
8 |
5
-
Tập bài giảng Lập trình mạng
209 p |
48 |
5
-
Bài giảng Mạng máy tính (Computer Network): Chương 10 - Lưu Đức Trung
48 p |
33 |
4
-
Bài giảng học phần Tin học cơ sở - Chương 4: Mạng máy tính và Internet
7 p |
15 |
4
-
Bài giảng Tin học đại cương: Chương 4 - Đặng Xuân Hà
7 p |
75 |
3
-
Bài giảng Internet và giao thức: Chương 4 - TS. Nguyễn Chiến Trinh
17 p |
11 |
1
-
Bài giảng Nhập môn mạng máy tính: Chương 4 - Trường ĐH Công nghệ thông tin
172 p |
1 |
1


Chịu trách nhiệm nội dung:
Nguyễn Công Hà - Giám đốc Công ty TNHH TÀI LIỆU TRỰC TUYẾN VI NA
LIÊN HỆ
Địa chỉ: P402, 54A Nơ Trang Long, Phường 14, Q.Bình Thạnh, TP.HCM
Hotline: 093 303 0098
Email: support@tailieu.vn
