N ETWORK L AYER د. عـــادل يوسف أبو القاسم
Network Layer 4-2 N ETWORK LAYER تقوم ال Network Layer بنقل ال segments من الجهاز المرسل (sending host ) الى الجهاز المستقبل (receiving host ). حيث تقوم بكبسلة ال segments الى datagram في الجهاز المرسل. وتقوم بتسليم ال segments الى ال Transport layer في الجهاز المستقبل. توجد برتكولات ال Network Layer في كل جهاز host وفي كل موجه router. application transport network data link physical application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical
N ETWORK LAYER في المحاضرات السابقة علمنا ان ال transport layer تقوم بتوفير communication بين two processes running on two different hosts. من اجل توفير هذه الخدمة فإن ال transport layer تعتمد على network layer والتي تقوم بتوفير communication بين ال hosts. بالتحديد فإن ال network-layer تنقل ال transport- layer segments من جهاز (host ) الى آخر. في الجهاز المرسل فان ال transport layer segment تمرر الى ال network layer. تقوم ال network layer عندئذ بتمرير ال segments الى الجهاز المستقبل (destination ) والذي تقوم ال network layer بتسليم ال segments الى ال transport layer
T HE NETWORK LAYER
Network Layer 4-5 T WO KEY NETWORK - LAYER FUNCTIONS أهم وظيفتين لطبقة الشبكة forwarding: نقل ال packet من input router الى output router المناسب. routing: تحديد مسار (route ) لل packet من المرسل (source ) الى المستقبل (destination ).
Network Layer value in arriving packet’s header routing algorithm local forwarding table header value output link Interplay between routing and forwarding routing algorithm determines end-end-path through network forwarding table determines local forwarding at this router
Network Layer 4-7 C ONNECTION SETUP إنشاء الاتصال ال Connection setup هي الوظيفة الثالثة لطبقة الشبكة. قبل تمرير ال datagrams فإنه يتم انشاء قناة اتصال افتراضية virtual connection بين جهاز المرسل وجهاز المستقبل وال routers الوسيطة. network vs transport layer connection service: network: between two hosts (may also involve intervening routers in case of VCs) transport: between two processes
Network Layer 4-8 C ONNECTION, CONNECTION - LESS SERVICE datagram network provides network-layer connectionless service virtual-circuit network provides network-layer connection service analogous ( مماثل )to TCP/UDP connection-oriented / connectionless transport-layer services, but : service: host-to-host no choice: network provides one or the other implementation: in network core
V IRTUAL CIRCUIT الدوائر الافتراضية virtual-circuit في طبقة الشبكة تشبه في سلوكها شبكات التلفونات والتي تستخدم دوائر حقيقية real circuits عكس ال virtual-circuit والتي تستخدم دوائر افتراضية. هنالك ثلاثة مراحل عند استخدام virtual-circuit : 1. call setup أنشاء الاتصال 2. Data transfer ارسال البيانات 3. Virtual circuit teardown انهاء الاتصال
Network Layer 4-10 application transport network data link physical V IRTUAL CIRCUITS : SIGNALING PROTOCOLS used to setup, maintain teardown VC used in ATM, frame-relay, X.25 not used in today’s Internet 1. initiate call 2. incoming call 3. accept call 4. call connected 5. data flow begins 6. receive data application transport network data link physical
Network Layer 4-11 D ATAGRAM NETWORKS لا يوجد إعداد لل call على مستوى طبقة الشبكة call setup). لا يوجد في ال router معلومات عن ال end-to-end connections حيث لا يوجد مفهوم connection على مستوى طبقة الشبكة ارسال ال packets يعتمد على عنوان ال destination host 1. send datagrams application transport network data link physical application transport network data link physical 2. receive datagrams
Network Layer D ATAGRAM FORWARDING TABLE IP destination address in arriving packet’s header routing algorithm local forwarding table dest address output link address-range 1 address-range 2 address-range 3 address-range billion IP addresses, so rather than list individual destination address list range of addresses (aggregate table entries)
Network Layer 4-13 T HE I NTERNET NETWORK LAYER forwarding table host, router network layer functions: routing protocols path selection RIP, OSPF, BGP IP protocol addressing conventions datagram format packet handling conventions ICMP protocol error reporting router “signaling” transport layer: TCP, UDP link layer physical layer network layer
Net wor k Laye r 4-14 ver length 32 bits data (variable length, typically a TCP or UDP segment) 16-bit identifier header checksum time to live 32 bit source IP address head. len type of service flgs fragment offset upper layer 32 bit destination IP address options (if any) IP DATAGRAM FORMAT IP protocol version number header length (bytes) upper layer protocol to deliver payload to total datagram length (bytes) “type” of data for fragmentation/ reassembly max number remaining hops (decremented at each router) e.g. timestamp, record route taken, specify list of routers to visit. how much overhead? 20 bytes of TCP 20 bytes of IP = 40 bytes + app layer overhead
IP FRAGMENTATION, REASSEMBLY اقصى حجم frame يمكن ارساله خلال ال network links يختلف من network links الى اخرى. لذلك ال IP datagram الكبيرة يتم تقسيمها (“fragmented”) خلال الشبكة ويتم تجميعها فقط عند الجهاز المستلم IP header bits used to identify, order related fragments fragmentation: in: one large datagram out: 3 smaller datagrams reassembly … …
Network Layer 4-16 IP ADDRESSING : INTRODUCTION IP address: 32-bit identifier for host, router interface interface: connection between host/router and physical link router’s typically have multiple interfaces host typically has one or two interfaces (e.g., wired Ethernet, wireless ) IP addresses associated with each interface =
Network Layer 4-17 IP ADDRESSING : INTRODUCTION Q: how are interfaces actually connected? A: we’ll learn about that later A: wired Ethernet interfaces connected by Ethernet switches A: wireless WiFi interfaces connected by WiFi base station For now: don’t need to worry about how one interface is connected to another (with no intervening router)
Network Layer 4-18 S UBNETS IP address: subnet part - high order bits host part - low order bits what’s a subnet ? device interfaces with same subnet part of IP address can physically reach each other without intervening router network consisting of 3 subnets subnet
Network Layer 4-19 Each isolated network is called a subnet subnet mask: /24 S UBNETS / / / subnet
Network Layer 4-20 IP ADDRESSING : CIDR CIDR: Classless InterDomain Routing subnet portion of address of arbitrary length address format: a.b.c.d/x, where x is # bits in subnet portion of address subnet part host part /23
Network Layer 4-21 IP ADDRESSES : HOW TO GET ONE ? Q: How does a host get IP address? hard-coded by system admin in a file Windows: control-panel->network->configuration->tcp/ip->properties UNIX: /etc/rc.config DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server “plug-and-play ”
Network Layer 4-22 DHCP CLIENT - SERVER SCENARIO / / / DHCP server arriving DHCP client needs address in this network يسمح لل host بالحصول على IP address من الشبكة آلياً مباشرة عندما يتصل بالشبكة يسمح باعادة استخدام ال IP address عندما يغادر الجهاز الشبكة
Network Layer 4-23 IP ADDRESSING : Q: how does an ISP get block of addresses? A: ICANN: Internet Corporation for Assigned Names and Numbers allocates addresses manages DNS assigns domain names, resolves disputes
Network Layer 4-24 NAT: NETWORK ADDRESS TRANSLATION local network (e.g., home network) /24 rest of Internet datagrams with source or destination in this network have /24 address for source, destination (as usual) all datagrams leaving local network have same single source NAT IP address: ,different source port numbers
Network Layer 4-25 وفيه يكون للشبكة المحلية عنوان واحد تستخدمه للاتصال بالعالم الخارجي لا نحتاج عدد من العناوين من ISP فقط نحتاج لعنوان IP واحد. يمكن تغيير عنوان جهاز في الشبكة المحلية دون اخطار الشبكة الخارجية يمكن تغيير ال ISP دون الحوجة لتغيير عنواين الاجهزة في الشبكة المحلية. الاجهزة داخل الشبكة غير مرئية مباشرة من الشبكة الخارجية ( سرية ) NAT: NETWORK ADDRESS TRANSLATION
Network Layer S: , 3345 D: , : host sends datagram to , 80 NAT translation table WAN side addr LAN side addr , , 3345 …… S: , 80 D: , S: , 5001 D: , : NAT router changes datagram source addr from , 3345 to , 5001, updates table S: , 80 D: , : reply arrives dest. address: , : NAT router changes datagram dest addr from , 5001 to , 3345 NAT: NETWORK ADDRESS TRANSLATION
Network Layer 4-27 IP V 6: MOTIVATION initial motivation: 32-bit address space soon to be completely allocated. additional motivation: header format helps speed processing/forwarding header changes to facilitate QoS IPv6 datagram format: fixed-length 40 byte header no fragmentation allowed
Q UESTIONS These slides are adapted from Computer Networking: A Top Down Approach Jim Kurose, Keith Ross Addison-Wesley March 2012