630 likes | 813 Views
Network Layer. Funksioni kryesor i shtreses : rrugezimi I paketave Algoritmat qe zgjedhin pathin dhe strukturen e te dhenave quhen algoritma routing Eshte pjese e software te shtreses network qe merret me zgjedhjen e linjes se daljes ku rrugezohen paketat.
E N D
Network Layer Network Layer
Funksioni kryesor i shtreses : rrugezimi I paketave Algoritmat qe zgjedhin pathin dhe strukturen e te dhenave quhen algoritma routing Eshte pjese e software te shtreses network qe merret me zgjedhjen e linjes se daljes ku rrugezohen paketat. Ne rastin e qarqeve virtuale vendimi merret ne cdo lidhje te re Ne rastin e datagramave vendimi mund te merret per cdo pakete ne nje thirrje Algoritmat e rutimit? Network Layer
Forwarding: Menaxhon cdo pakete qe mberrin ne ruter duke kerkuar linjen me te pershtatshme Routing : Merret me mbushjen dhe azhornimin e tabelave forwarding. (ketu futen ne loje algoritmat e rutimit) 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 application transport network data link physical application transport network data link physical Proceset ne router Network Layer
Kerkesat ndaj algoritmave routing Pyetja : cfare kerkesash parashtron kjo shtrese ne zonen subnet? • Saktesi • Thjeshtesi • Qendrueshmeri • Stabilitet • Optimizim Network Layer
Algoritmat e routing : • Mund te grupohen ne dy klasa te medha: • Jo pershtates : • Nuk mbeshtesin vendimet e tyre mbi masat ose vleresimin e trafikut ose te topologjise prezente • Ky rutim quhet statik • Pathi llogaritet qysh me pare dhe shkarkohet ne router sapo vendoset lidhja. • pershtates: • Ndryshojne vendimet sipas modifikimeve te sjella nga topologjia ose trafiku • Informacioni merret nga routerat ose gjithe routerat per momentin qe ndrojne pathet Network Layer
Parimi I optimizimit: • Percaktimi: nese nje router J ndodhet ne pathin optimal qe lidh I dhe K, atehere pathi optimal midis J dhe K ndjek te njejten linje. • Sink tree : eshte nje peme nyjesh rrjeti ku distanca llogaritet ne baze numrit te kercimeve( nuk eshte e vetme) • Objektivi I algoritmave eshte gjetja e perdorimi I sink tree te mundshme Network Layer
Routing i bazuar ne pathin me te shkurter Pathi me I shkurter : pathi me I shpejte qe lidhet nga metrike te tjere: Banda e linkut Trafiku mesatar Vonesa Gjatesia e bishtit, etj Ideja: Ndertimi I nje grafi te subnetit ku cdo nyje tregon nje router dhe cdo hark tregon nje linje komunikimi. Nga nje router ne tjetrin algoritmi zgjedh rrugen me te shkurter qe lidh dy nyjet Marrja e biteve Diferencat: Rruga me e shkurter -ne Km Pathi me I shkurter Numri I nyjeve Network Layer
Global: Te gjithe routerat kane njohuri per topologjine komplete Algoritmat “link state” (Dijkstra) I decentralizuar : Router njohin fqinjet e lidhur fizikisht, kostot e linkeve tek fqinjet Proces iterativ kompjutimi, kembim informacioni me fqinjet Algoritmat “distance vector” (Bellman Ford) Klasifikimi I algoritmave te Routing Network Layer
Fooding : algoritem statik • Cdo pakete ne mberritje dergohet drejt linjave dalese pervec asaj hyrese: • Ka disa menyra per te kontrolluar dublikimin pafund te paketave: • duke vendosur nje timer per secilen dublikate. Ne linket e gjate kemi humbje • Ruterat burim mund te vendosin nje heder me numer sekuence duke shmangur marrjen serish te paketes dalese • Flooding selektiv: nisen paketa te dubluara vetem ato qe shkojne afersisht ne drejtimin e duhur. Network Layer
Routing bazuar ne vektorin e distancave • Algoritem routing dinamik • Ka dy algoritma te tille: • Algoritmi I bazuar ne vektorin e distancave • Algoritma bazuar ne gjendjen e linkeve • Sipas algoritmit te pare cdo router ka nje tabele ku mban informacion mbi largesine me te mire te njohur per destinacion si dhe linjen qe te con ne kete destinacion • Kjo tabele azhornohet duke kembyer informacion me routerat fqinje Network Layer
Routing bazuar ne gjendjen e linkeve • Idea : • Cdo ruter duhet te : • Zbuloje fqinjet dhe adresat relativete rrjetit • Te mase vonesen dhe koston e cdo fqinji • Te ndertoje nje pakete qe mban te gjitha informacionet e mbledhura • Te dergoje kete pakete tek gjithe ruterat e tjere • Te perpunoje pathin me te shkurter drejt ruterave te tjere Network Layer
Routing hierarkik • Nuk mund te ruhen te gjitha destinacinet ne tabela te routing ! Zgjidhje: Autonomi administrative • internet = network I f networkeve • Cdo admin network mund te kontrolloje routing ne networkun e vet. Network Layer
Routera speciale ne AS Ekzekutojne protokolle intra-AS routing me te gjithe routerat e tjere ne AS Gjithashtu also pergjegjes per routing tek destinacionet jashte AS Ekzekutojne protokolle inter-AS routing me gjithe routerat gateway te tjere. routera gateway Routing hierarkik • routera aggregate ne zona: • “autonomous systems” (AS) • Routera ne te njejtin AS ekzekutojne te njejtin protokoll routing • Protokolli “intra-AS” routing • Routera ne AS te ndryshme mund te ekzekutojne protokolle intra-AS routing te ndryshme Network Layer
C.b B.a A.a c A.c b a c b Intra-AS dhe Inter-AS routing Gateways: • Performojne inter-AS routing midis tyre • Performojne intra-AS routera me routerat e tjere ne AS e tyre b a a C B d A network layer inter-AS, intra-AS routing ne gateway A.c link layer physical layer Network Layer
Inter-AS routing midis A and B C.b B.a A.a b c A.c a a C b B a Host h1 d c b A Intra-AS dhe Inter-AS routing Host h2 Intra-AS routing Brenda AS B Intra-AS routing Brenda AS A Network Layer
History: Ipsilon’s IP Switching Network Layer
Ipsilon’s IP Switching ATM VCs setup when new IP “flows” seen, I.e., “data-driven” VC setup Network Layer
Issues with Ipsilon’s IP switching Network Layer
Tag Switching Key difference: tags setup in background using IP routing protocols (I.e. control-driven VC setup) Network Layer
Alphabet Soup! • CSR Cell Switched Router • ISR Integrated Switch and Router • LSR Label Switching Router • TSR Tag Switching Router • Multi layer switches • Direct IP • FastIP • PowerIP MPLS - IETF standard Network Layer
IP #L1 IP #L2 IP #L3 MPLS Concept: Route at Edge, Switch in Core IP IP IP Forwarding IP Forwarding LABEL SWITCHING Network Layer
MPLS Terminology • LDP: Label Distribution Protocol • LSP: Label Switched Path • FEC: Forwarding Equivalence Class • LSR: Label Switching Router • LER: Label Edge Router (Useful term not in standards) • MPLS “multi-protocol” both in terms of protocols it supports ABOVE and BELOW in protocol stack! Network Layer
MPLS Header • IP packet encapsulated in MPLS header and sent down LSP • IP packet restored at end of LSP by egress router • TTL adjusted by default … IP Packet 32-bit MPLS Header Network Layer
MPLS Header • label • used to match packet to LSP • experimental bits • carries packet queuing priority (CoS) • stacking bit: can build “stacks” of labels • qoal: nested tunnels! • time to live • copied from IP TTL Label EXP S TTL Network Layer
IP MPLS Forwarding: Example • IP packet destined to 134.112.1.5/32 arrives to SF • San Francisco has route for 134.112/16 • next hop is LSP to New York 134.112/16 New York 134.112.1.5 0 San Francisco 1965 1026 Santa Fe Network Layer
IP 1965 MPLS Forwarding Example • San Francisco pre-pends MPLS header onto IP packet, sends packet to first transit router on path 134.112/16 New York San Francisco Santa Fe Network Layer
IP 1026 MPLS Forwarding Example • because packet arrived to Santa Fe with MPLS header, Santa Fe forwards it using MPLS forwarding table 134.112/16 New York San Francisco Santa Fe Network Layer
IP 0 IP MPLS Forwarding Example • packet arrives from penultimate router with label 0 • egress router sees label 0, strips MPLS header • egress router performs standard IP forwarding 134.112/16 New York San Francisco Santa Fe Network Layer
IP 47.1.1.1 Regular IP Forwarding 47.1 1 IP 47.1.1.1 2 IP 47.1.1.1 1 3 2 IP 47.1.1.1 1 47.2 3 47.3 2 IP destination address unchanged in packet header! Network Layer
Request: 47.1 Request: 47.1 Mapping: 0.40 Mapping: 0.50 MPLS Label Distribution 1 47.1 3 3 2 1 1 2 47.3 3 47.2 2 Network Layer
IP 47.1.1.1 IP 47.1.1.1 Label Switched Path (LSP) 1 47.1 3 3 2 1 1 2 47.3 3 47.2 2 Network Layer
A General Vanilla LSP #14 #311 #216 #99 #311 #963 #311 #963 #14 #612 #462 #311 #99 #5 - Vanilla LSP actually part of tree from every source to destination (unidirectional) - Vanilla LDP builds tree using existing IP forwarding tables to route control messages Network Layer
Forwarding Equivalence Classes • FEC - group of IP packets • forwarded over same path, with same forwarding treatment • FEC may correspond to • destination IP subnet • source, destination IP subnet • QoS class Network Layer
Example Network Layer
Label Distribution Protocol (LDP) • label distribution always done from downstream to upstream • downstream-unsolicited: new route => send new label • downstream-on-demand: upstream LSR asks for label Network Layer
Traffic Engineering • configuring routes to traffic demands so as to • improve user performance • use network resources more efficiently • operates at coarse timescales • not for failures, sudden traffic changes • uses shortest path computations • OSPF, MPLS Q: how to set link weights? Network Layer
Effect of link weights • unit link weights • local change to congested link • global optimization • to balance link utilizations Network Layer
Traffic Engineering Framework • knowledge of topology • traffic matrix • K – set of origin destination flows • k K, dk – demand, sk – source, tk – destination • how to get traffic matrix? • SNMP • edge measurements + routing tables • network tomography • packet sampling • optimization criteria • minimize maximum utilization • keep utilizations below 60% Network Layer
Perse kemi humbje paketash? • Rradhet jane te nevojshme per te rregulluar flukset • Head-of-the-Line (HOL) blocking: rradhet mund te kongjestionojne njera tjetren • Humbjet I takojne rradheve qe mbushen totalisht! Perdite Network Layer
Host, router network layer functions: • ICMP protocol • Sinjalizon gabimet • Dialog midis routerave • IP protocol • adresa • Format I datagramave • Subnetwork dhe maska • Protokolle te rruges • path selection • RIP, OSPF, BGP forwarding table Protokolli IP niveli transport: TCP, UDP Network layer niveli Data Link niveli Fizik Network Layer
Numri I versionit 32 bits Gjatesia totale E datagrames (bytes) Gjatesia e headerit (bytes) type of service head. len ver length Menaxho fragmentimin fragment offset “tipi” i te dhenave flgs 16-bit identifier Numri maks i kercimeve (zvogelohet me 1 ne cdo kercim) upper layer time to live Internet checksum 32 bit source IP address 32 bit destination IP address Kodi I protokollitte niv. superior p.sh. lista e routerave. Options (if any) DATI (gjatesia variab., Ne nje pakete TCP ose UDP) Format i nje datagrame Sa overhead me TCP/IP? • 20 bytes di TCP • 20 bytes di IP • = 40 bytes + overhead apl. Network Layer
Cdo link ka nje MTU (max.transfer unit) te veten. tipe te linkeve te ndryshem, kane MTU te ndryshem Datagramat copetohen nga nje link tek nje tjeter 1 datagrame e ndare ne shume datagrama Riasemblohen vetem tek destinacioni Bitet e kontrollit te headerit tregojne menyren e ribashkimit te datagrame Fragmentimi fragmentimi: in: 1 datagrame e madhe out: 3 datagrama te vogla reassembly Network Layer
length =1500 length =1040 length =1500 length =4000 ID =x ID =x ID =x ID =x fragflag =0 fragflag =0 fragflag =1 fragflag =1 offset =0 offset =185 offset =0 offset =370 E copetuar! Ribashkimi Shembull • datagrama prej 4000 byte • MTU = 1500 bytes 1480 bytes in data field offset = 1480/8 Network Layer
IP address: nje adrese me 32 bit per cdo nderfaqe inderfaqja: koneksion drejt nje hosti tjeter , ose ruteri. Routerat kane zakonisht me teper se nje nderfaqe Hostet kane zakonisht nje aktive por mund te kene me shume se nje 223.1.1.2 223.1.2.2 223.1.2.1 223.1.3.2 223.1.3.1 223.1.3.27 Adresimi 223.1.1.1 223.1.2.9 223.1.1.4 223.1.1.3 223.1.1.1 = 11011111 00000001 00000001 00000001 223 1 1 1 Network Layer
Adresa IP Pjesa subnet (high order bits) Pjesa numri I (low order bits) Cfare eshte nje subnet ? Nje bashkesi host/nderfaqe qe kane te njejten identifikim te subnet Normalisht mund te nderfaqesohen midis tyre pa perdorur nje ruter duke perdorur nje link direkt ose protokollin e nivelit te dyte Subnet 223.1.1.1 223.1.2.1 223.1.1.2 223.1.2.9 223.1.1.4 223.1.2.2 223.1.1.3 223.1.3.27 subnet 223.1.3.2 223.1.3.1 network consisting of 3 subnets Network Layer
Kerkesa Per te percaktuar subnets, cdo nderfaqe vecohet nga ruteri. Krijohen qeliza te subneteve te izoluar cdo sunet I izoluar merr kete emer:“subnet”. 223.1.1.0/24 223.1.2.0/24 223.1.3.0/24 Subnet Maska e subnetit: /24 Network Layer
Sa ? Subnet 223.1.1.2 223.1.1.1 223.1.1.4 223.1.1.3 223.1.7.0 223.1.9.2 223.1.9.1 223.1.7.1 223.1.8.1 223.1.8.0 223.1.2.6 223.1.3.27 223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2 Network Layer
Numri ihostit ID esubnet 11001000 0001011100010000 00000000 200.23.16.0/23 Menyra te shoqerimit CIDR:Classless InterDomain Routing • Identifikuesi I subnetit mund te jeteme gjatesi te ndryshme(nga 1 ne 31 bit) • Formati I adreses: a.b.c.d/x, ku x eshte numri i biteve qe perbejne identifikuesin e subnetit Network Layer
Si te mundesosh marrjen e nje adrese IP? • I fiksuar ne menyre statike • Windows: network connections->Properties->TCP/IP -> Properties. • ipconfig • Linux: /etc/network... • ifconfig • DHCP:Dynamic Host Configuration Protocol: • Merr nje adrese “perdor dhe hidhe” (e vlefshme me kufizim ne kohe ) nga nje server. • Eshte e qarte duke mos patur hosti akoma nje adrese IP te vlefshme , DHCP nuk mund te bazohet mbiTCP/IP, por mbeshtetet mbi protokollet direkt te nivelit te 2 Network Layer
Marrja e IP Normalisht ka nje ISP (Internet Service Provider) qe merret me shperndarjen e numrave tek subnetet e vet Shembull : UNIVlora 10100000 01100001 00000000 00000000 160.97.0.0/16 FShT 10100000 01100001 00011000 00000000 160.97.24.0/24 Matematika 10100000 01100001 00101111 00000000 160.97.47.0/25 Informatika 10100000 01100001 0011100100000000 160.97.57.0/25 Navale 10100000 01100001 00111001 10000000 160.97.57.128/25 …. ... Network Layer