CS 4410 Operating Systems Networking: Network Layer Summer 2013 Cornell University 1 Today ● How packages are exchanged in a WAN? ● Network Layer ● IP ● Naming ● Subnetwork ● Forwarding ● Routing Algorithms 2 Protocol Stack Computer A Computer B Message M Application Application Segment Ht M Transport Transport Datagram Hn Ht M Network Network Frame Hl Hn Ht M Link Link Physical Physical 3 WAN ● Usually, thousands of computers need to be interconnected. ● The capabilities that LANs offer cannot support larger networks. ● We need more services than the Link Layer offers. ● Why? ● Clever Naming ● Efficient forwarding/routing of messages. 4 Network Layer ● Mission: Transfer messages from the source-computer to the destination- computer. ● Attention: this is different from the mission of the Link Layer. ● Services: ● Forwarding / Routing ● Guaranteed delivery, bandwidth, etc ● Security ● Not all the protocols support these services. ● The Network Layer protocol depends on the kind of network we want to built: ● Virtual-circuit networks ● Datagram networks ● Necessary network device: ● Router: It knows where to forward the message. 5 Network Layer ● Virtual-circuit networks ● 3 phases ● Establish a virtual circuit. – The Network Layer finds the path from the source to the destination. – Reserve resources for the virtual circuit. ● Transfer data – Packets pass through the virtual circuit. ● Destroy virtual circuit. – Release resources. ● Disadvantages? ● Datagram networks ● Every packet has the destination address and it is routed independently in the network. ● The router uses the destination address to forward the packet towards 6 the destination-computer. IP ● Network Layer Protocol for the Internet: ● Internet Protocol ● For Datagram networks. ● IPv4, IPv6 ● Datagram structure: Version Header Type of Length Length service Identification Flags Fragment Offset Time to live Protocol Header Checksum Source IP Address (32-bit) Destination IP Address Options Data 7 Naming ● All the computers in the Internet have one or more IP addresses. ● For IPv4: ● 32 bits ● Dotted-decimal notation (Ex: 147.76.89.4) ● Contain information about the subnetwork in which a host belongs. – Example: For the address 140.251.27.18 we know that: ● It belongs to a host in Cornell, as Cornell gives addresses of the form 140.251.xxx.xxx. → subnetwork address 140.251.0.0/16, mask 255.255.0.0 ● It belongs in host in Linguistics Department, as the addresses of this department is 140.251.27.xxx. → subnetwork address 140.251.27.0/24, mask 255.255.255.0 ● The number 18 distinguish this host from other hosts in the same subnetwork of Linguistics. ● Assigned by a DHCP server in the subnetwork. ● Dynamic Host Configuration Protocol ● Every computer that is inserted in the subnetwork, communicated with the DHCP 8 server to obtain an IP address. Subnetwork 223.1.1.1 223.1.2.1 223.1.1.4 223.1.2.9 223.1.3.27 223.1.1.2 223.1.2.2 223.1.1.3 What happens when 223.1.1.1 wants to send 223.1.3.1 223.1.3.2 a packet to 223.1.3.2 ? 9 Forwarding ● Each router has a routing table. ● The routing table is an array of triples (at least). ● Each tuple has: ● Subnetwork id, subnetwork mask, gateway ● So, the routing table of the previous example is: 223.1.1.0, 255.255.255.0, 0 223.1.3.0, 255.255.255.0, 1 223.1.2.0, 255.255.255.0, 2 ● When a datagram is received, all the subnetwork masks are applied to its IP address (binary AND operation) to find the subnetwork in which the destination belongs. ● So, a datagram with destination to 223.1.3.2 is forwarded to gateway 1. ● Even though we know the destination IP, we do not know the MAC address of 223.1.3.2, in order the packet to go from the gateway 1 to the destination. ● With the ARP protocol the router asks which node of one subnetwork has the needed IP. ● The destination replies with its MAC address. ● Finally, the packet can be sent to the destination. 10 Routing Algorithms ● How does the router construct its routing table? V2 ● The routing path should be the shortest path from the source to the destination. 1 2 ● General problem: 2 5 ● Graph (V, E) 3 1 3 ● V is the set of routers. 1 ● E is the set of links between the routers. ● Each edge has a cost related to 2 5 the distance. ● If the source is attached to the V1 router V1 and the destination to the router V2, what is the shortest path between V1 and V2? 11 Routing Algorithms ● Find shortest bath between all the possible pairs of nodes. ● Global routing algorithm ● The algorithm needs global knowledge (all links between routers and their costs) of the network as input. ● Dijkstra algorithm – Returns the shortest path between one node and all the other nodes. ● Decentralized routing algorithm ● No router has global knowledge about the cost of all links. ● Routers, iteratively, exchange information with their neighbors for shortest paths between nodes. ● Distance vector algorithm – Returns the shortest path from all nodes to all nodes. 12 Network Layer Computer A Computer B Application Application Transport Router Transport Network Network Network Switch Switch Link Link Link Link Link Physical Physical Physical Physical Physical 13 Network Layer Router Switch 14 Today ● How packages are exchanged in a WAN? ● Network Layer ● IP ● Naming ● Subnetwork ● Forwarding ● Routing Algorithms 15.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages15 Page
-
File Size-