1 / 36

Network Layer

Network Layer. MẠNG MÁY TÍNH Tháng 09/2011. Mục tiêu. Application. Presentation. Session. Transport. Network. Data link. Physical. Thiết lập kết nối giữa 2 host để truyền dữ liệu từ host - host. Tầng mạng vs tầng vận chuyển. Ví dụ : A gởi B 1 bức thư qua đường bưu điện

talmai
Télécharger la présentation

Network Layer

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. Network Layer MẠNG MÁY TÍNH Tháng 09/2011

  2. Mục tiêu Application Presentation Session Transport Network Data link Physical Thiếtlậpkếtnốigiữa 2 host đểtruyềndữliệutừ host - host Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  3. Tầngmạngvstầngvậnchuyển Vídụ: A gởi B 1 bứcthư qua đườngbưuđiện • processes = A, B • app messages = bứcthư • hosts = nhàcủa A, nhàcủa B • transport protocol ??? • network-layer protocol??? • Tầng mạng: cung cấp kết nối logic giữa các host • Tầng vận chuyển: cung cấp kết nối logic giữa các tiến trình • Dựa trên, mở rộng dịch vụ của tầng mạng Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  4. Nội dung Giớithiệu Địnhtuyến – chuyểntiếp Giaothức IP Giaothức ICMP Giaothức NAT Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  5. network link physical link physical M M M Ht M Hn Hn Hn Hn Ht Ht Ht Ht M M M M Hn Ht Ht Hl Hl Hn Hn Ht Ht M M Nhắclại source message application transport network link physical segment packet frame switch destination application transport network link physical router Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  6. giớithiệu - 1 • Thựchiệnchuyểncác segment từ host gởiđến host nhận • Tại host gởi: • Nhậncác segment từ transport layer • Đónggóithànhcác packet • Tại host nhận: • Nhậncác packet từ data link layer • Chuyểncác segment lên transport layer • Tạicác router: • Dựavàothông tin đíchđếnđểchuyểncác packet đến host nhận • Địnhtuyến: quyếtđịnhgói tin điđườngnào • Chuyểntiếp: chuyểngói tin từ interface nhậnra interface gởi Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  7. giớithiệu - 2 • Tầngmạngcungcấp 2 loạidịchvụ • Hướngkếtnối (Connection) • Virtual Circuit • Trướckhitruyềndữliệu, 2 host phảithiếtlậpkếtnối • Hướngkhôngkếtnối (Connectionless) • Datagram Network • Khôngcầnthiếtlậpkếtnốitrướckhigởi • Trong 1 kiếntrúcmạng: chỉhỗtrợduynhất 1 loạidịchvụ Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  8. Datagram network - 1 • Khôngthiếtlậpkếtnốitrướckhitruyềndữliệu • Router khôngcầnquảnlýtrạngtháikếtnối • Thông tin địnhtuyến: địachỉđíchđến • Mỗi router duytrìmộtbảngđịnhtuyến • Dùngtrong Internet Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  9. Datagram network - 2 200.245.60.45/24 210.245.10.5/24 3 1 2 interface number Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  10. Nội dung Giớithiệu Địnhtuyến – chuyểntiếp Giaothức IP Giaothức ICMP Giaothức NAT Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  11. Địnhtuyến - Chuyểntiếp - 1 • Địnhtuyến: • Quyếtđịnh “lộtrình” màgói tin dichuyểntừ host nguồnđến host đíchđến • Sửdụngthông tin toàncục • Chuyểntiếp: • Di chuyểngói tin từcổngvàođếncổngra • Sửdụngthông tin cụcbộ Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  12. Địnhtuyến - Chuyểntiếp - 2 NS NTMK ? NS NVCừ ĐH KHTN ĐH KHTN Vạch ra lộ trình đi: NVCừ  NTMKhai Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  13. Địnhtuyến - 1 • Đượcthựchiệnbởicácbộđịnhtuyến. • VD: router • Dùngbảngđịnhtuyến (routing/forwarding table) • destination/subnetmask • Out interface • next hop • chi phí • Hop count • Delay • Bandwidth • … Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  14. Vídụ - địnhtuyến 200.245.60.45/24 210.245.10.5/24 3 1 2 interface number Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  15. Địnhtuyến - 2 • Router địnhtuyếnmộtgói tin nhưthếnào? • Dùngđịachỉđíchđếnvàbảngđịnhtuyến • Thựchiện: • Tìm record thíchhợptrongbảngđịnhtuyến • Tínhđịachỉđườngmạnggiữađịachỉđíchđếnvớisubnetmaskcủatừng record • So sánh destination network vớiđịachỉđườngmạngvừatính • Gởigói tin theothông tin của record tìmđược • VD: R1 nhậngói tin có destination 210.245.10.5 • 255.255.255.192 • Net: 210.245.10.0  khôngcó record thoả • 255.255.255.0 • Net: 210.245.10.0  record số 1 thoả  gói tin chuyểnra interface số 3 vànơinhậngói tin tiếptheolà 192.168.3.2 Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  16. Bảngđịnhtuyến • Xâydựngbảngđịnhtuyến: • Tĩnh (static): con ngườitựthiếtlập • Động (dynamic): học • Distance Vector: • Gởitheođịnhkỳ • Gởitoànbộbảngđịnhtuyến • VD: RIP, IGRP, … • Link State: • Gởikhicóthayđổi • Gởitìnhtrạngkếtnối • VD: OSPF, ISIS, … Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  17. Nội dung Giớithiệu Địnhtuyến – chuyểntiếp Giaothức IP Giaothức ICMP Giaothức NAT Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  18. Routed protocol - 1 • Giaothứcđượcđịnhtuyến (routed protocol): • qui địnhcáchthứcđónggóidữliệutruyềntrênđườngtruyền • VD: IP (IPv4, IPv6), IPSec,… Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  19. Routed protocol - 2 IP protocol version number 32 bits total datagram length (bytes) header length (bytes) type of service head. len ver Total length for fragmentation/ reassembly fragment offset “type” of data flgs Identifier max number remaining hops (decremented at each router) time to live Internet checksum Protocol 32 bit source IP address 32 bit destination IP address upper layer protocol to deliver payload to E.g. timestamp, record route taken, pecify list of routers to visit. Options (if any) data (variable length, typically a TCP or UDP segment) Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  20. Routed protocol - 3 • Version (4) • version của IP • Header Length (4): • Chiềudài IP header (byte) • Type of service (8) • Chứađịnhthông tin ưutiên • Ítsửdụng • Total length (16) • Tổngchiềudàicủa datagram (tínhcả header) (byte) • Identifier (16): • Khimộtgói tin IP bịchianhỏrathànhnhiềuđoạn, thìmỗiđoạnđượcgáncùngsố ID • Dùngkhitổnghợp Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  21. Routed protocol - 4 • Flag (3) • DF • Don’t fragment, khôngchianhỏ • MF • More fragment, còngói tin nhỏtiếp • Khi 1 gói tin bịchianhỏ, tấtcảcácgóinhỏ (trừgói tin cuốicùng), bit nàyđượcbậtlên • Fragment offset (13) • Vịtrígóinhỏtronggói tin ban đầu • Time to live – TTL (8) • Thờigiansốngcủagói tin (hop count) • Giảmmỗikhigói tin đến 1 router mới • Khi hop count =0 thìgói tin bịloạibỏ Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  22. Routed protocol - 5 • Protocol (8) • Chỉranghithứcnào ở tầng transport màgói tin đangsửdụng • VD: TCP = 6, UDP =17 • Internet (Header) checksum (16) • Kiểmtratínhđúngđắnnội dung của IP header • Khôngtheocáchkiểmtratuầntự • Source and destination addr (32) • Địachỉ IP củabêngửivàbênnhận • Options (32) • Cóthểdàiđến 40 bytes • Dùngchocáctínhnăngmởrộngcủa IP • Vd: source routing, security, record route, … • Data: • Dữliệu ở tầng transport gởixuống Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  23. Nội dung Giớithiệu Địnhtuyến – chuyểntiếp Giaothức IP Giaothức ICMP NAT Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  24. Giaothức ICMP • ICMP (Internet Control Message Protocol) • Đượcsửdụngbởicác host và router đểtraođổithông tin ở tầngmạng • Báolỗi: • Mạng, host, protocol, port … khôngvươnđếnđược • Báomạngbịtắtnghẽn • Báo timeout • Echo request/reply (ping) Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  25. IP header Source, Destination Address, TTL, ... ICMP MSG Message type, Code, Checksum, Data Gói tin ICMP • Thôngđiệp ICMP đượcđónggóitronggói tin IP Protocol = 1 Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  26. Cấutrúcthôngđiệpicmp - 1 0 8 16 32 Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  27. Cấu trúc thông điệp icmp - 2 • ICMP error messages include the complete IP header and the first 8 bytes of the payload (typically: UDP, TCP) Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  28. Cấu trúc thông điệp icmp - 3 Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  29. Cấutrúcthôngđiệpicmp- 4 • Khôngđếnđượcđích: • Nguyênnhân: liênkếtmạngbịđứt, đíchđếnkhôngtìmthấy, … • Type = 3 • Code: • 0: unreachable network • 1: unreachable host • 2: unreachable protocol • 3: unreachable port • 4: khôngđượcphép fragment • 5:source route bịsai Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  30. ICMP Source Quench - 1 Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  31. ICMP Source Quench - 2 • Congestion can also occur for various reasons including when traffic from a high speed LAN reaches a slower WAN connection. • Dropped packets occur when there is too much congestion on a network. • ICMP source-quench messages are used to reduce the amount of data lost. • The source-quench message asks senders to reduce the rate at which they are transmitting packets. • In most cases, congestion will subside after a short period of time, and the source will slowly increase the transmission rate as long as no other source-quench messages are received. • Most Cisco routers do not send source-quench messages by default, because the source-quench message may itself add to the network congestion. (See TCP) Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  32. ICMP Source Quench - 3 • IP has no mechanism for flow control • Some issues with ICMP Source Quench: • A router or destination host (buffers full) will send one source-quench message for each discarded packet. • No mechanism to tell the source that the congestion has been relieved and source can resume sending at previous rate. • Remember, TCP/IP uses TCP mechanisms for flow control and reliability including sliding windows. Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  33. ICMP Redirect - 1 3 2 1 2 4 Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  34. ICMP Redirect - 2 • ICMP Redirect messages can only be sent by routers • Host H sends a packet to Host 10.1.1.1 on network 10.0.0.0/8. • Since Host H is not directly connected to the same network, it forwards the packet to its default gateway, Router R1 at 172.16.1.100. • Router R1 finds the correct route to network 10.0.0.0/8 by looking in its route table. • It determines that the path to the network is back out the same interface the request to forward the packet came from to Router R2 at 172.16.1.200. • R1 forwards the packet to R2 and sends an ICMP redirect/change request to Host H telling it to use Router R2 at 172.16.1.200 as the gateway to forward all future requests to network 10.0.0.0/8. Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  35. ICMP Redirect - 3 • Default gateways only send ICMP redirect/change request messages if the following conditions are met: • The interface on which the packet comes into the router is the same interface on which the packet gets routed out. • The subnet/network of the source IP address is the same subnet/network of the next-hop IP address of the routed packet. • The datagram is not source-routed. • The route for the redirect is not another ICMP redirect or a default route. • The router is configured to send redirects. (By default, Cisco routers send ICMP redirects. The interface subcommand no ip redirects will disable ICMP redirects.) Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

  36. Giaothức ICMP • Cáctrườnghợp GỞI ICMP msg: • Datagram khôngđạtđếnđích • Time out • Error xuấthiệntrong header • Router/host bịtắtnghẽn • Cáctrườnghợp KHÔNG gởi ICMP msg: • Bảnthân ICMP msgcólỗi • Broadcast, multicast (gói DL địnhtuyến) • Những fragment khácvới fragment đầutiên Khoa Công nghệ thông tin - Đại học Khoa học tự nhiên TP Hồ Chí Minh

More Related