Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ch.5 Network layer.

Similar presentations


Presentation on theme: "Ch.5 Network layer."— Presentation transcript:

1 Ch.5 Network layer

2 Network Layer (Functions)
Routing Flow control End to end packet delivery Addressing

3 Network Layer Services provided to the transport layer :
Services should be independent of router technology Transport layer should be shielded from the No. of routers present Type of routers present Topology of routers present Network addresses should use a uniform numbering plan even across LAN’s & WAN’s

4 Network Layer Transport layer: TCP, UDP NETWORK LAYER Network layer
IP protocol addressing conventions datagram format packet handling conventions Routing protocols path selection RIP, OSPF, BGP Network layer routing table ICMP protocol error reporting router “signaling” Link layer physical layer

5 Network Taxonomy Telecommunication networks Circuit-switched networks FDM TDM Packet-switched networks Networks with VCs Datagram Datagram network is not either connection-oriented or connectionless. Internet provides both connection-oriented (TCP) and connectionless services (UDP) to apps.

6 Simple Switched Network

7 Use of Packets

8 Advantages Line efficiency Data rate conversion
Single node to node link can be shared by many packets over time Packets queued and transmitted as fast as possible Data rate conversion Each station connects to the local node at its own speed Nodes buffer data if required to equalize rates Packets are accepted even when network is busy Delivery may slow down Priorities can be used

9 Station breaks long message into packets
Switching Technique Station breaks long message into packets Packets sent one at a time to the network Packets handled in two ways Datagram Virtual circuit

10 Connection oriented Virtual circuits

11 Timing in Connection oriented switching
Host 1 Host 2 Switch 1 Switch 2 Information Transmission delay propagation delay between Host 1 and Switch1 Circuit Establishment propagation delay between Host 1 and Host 2 Transfer time Circuit Teardown

12 Virtual Circuit Identifier (VC ID)
Source set-up: establish path for the VC Switch: mapping VC ID to an outgoing link Packet: fixed length label in the header 1: 7 2: 7 link 7 1: 14 2: 8 1 link 14 2 link 8

13 Example virtual-circuit routing table
Identifier Output port Next identifier 12 13 44 Entry for packets with identifier 15 15 15 23 27 13 16 58 7 34

14 Switch and tables in a virtual-circuit network

15 Setup request in a virtual-circuit network

16 Setup acknowledgment in a virtual-circuit network

17 Source-to-destination data transfer in a virtual-circuit network

18 TP, VPs, and VCs TP : transmission path (physical connection)

19 Example of VPs and VCs

20 Note: Note that a virtual connection is defined by a pair of numbers: the VPI and the VCI.

21 Connection identifiers

22 Virtual connection identifiers in UNIs and NNIs

23 Example: An ATM cell

24 Routing with a switch

25 Delay in a circuit-switched network

26 Delay in a virtual-circuit network

27 Packet switching

28 Routing table in a datagram network

29 Packet Switching – necessity
Network should support multiple applications Transfer arbitrary message size Low delay for interactive applications But in store-and-forward operation, long messages induce high delay on interactive messages Packet switching introduced Network transfers packets using store-and-forward Packets have maximum length Break long messages into multiple packets

30 Packet-Based Switching
Once the scheduler starts transmitting the first cell of a packet, it continues until the whole packet is received at output port

31 Packet-Based Switching
Once the scheduler starts transmitting the first cell of a packet, it continues until the whole packet is received at output port

32 Packet-Based Switching
Once the scheduler starts transmitting the first cell of a packet, it continues until the whole packet is received at output port.

33 ARPANET Packet Switching
Host generates message Source packet switch converts message to packet(s) Packets transferred independently across network Destination packet switch re-assembles message Destination packet switch delivers message Packet Switch Packet 2 Message Message Packet 2 Packet Switch Packet Switch Packet 1 Packet Switch Packet 1 Packet Switch Packet 1

34 ARPANET Routing Routing is highly nontrivial in mesh networks
No connection setup prior to packet transmission Packets header includes source & destination addresses Packet switches have table with next hop per destination Routing tables calculated by packet switches using distributed algorithm Packet Switch Packet Hdr Packet Switch Packet Switch Dest: Next Hop: xyz abc wvr edf Packet Switch Packet Switch

35 Other ARPANET Protocols
Error control between adjacent packet switches Congestion control between source & destination packet switches limit number of packets in transit Flow control between host computers prevents buffer overflow Packet Switch Error Control Packet Switch Congestion Control Packet Switch Packet Switch Packet Switch Flow Control

36 Delay in a datagram network

37 Datagram (summary) Each packet treated independently
Packets can take any practical route Packets may arrive out of order Packets may go missing It is up to the receiver to re-order packets and recover from missing packets

38 Virtual Circuit Diagram

39 Datagram Virtual circuits
No call setup phase call setup phase Each packet contains full source & destination address Each packet contains a short VCI Routers do not hold state info about connections Each VC requires router table space per connection Each packet is routed independently Each packet follows same path No effect of router failure Router failure affects the performance QoS & Congestion control – difficult QoS & Congestion control– easy Less table space required in routers More table space required in routers 39

40 Event Timing

41 Four sources of packet delay
1. nodal processing: check bit errors determine output link 2. queueing time waiting at output link for transmission depends on congestion level of router A B propagation transmission nodal processing queueing

42 Delay in packet-switched networks
3. Transmission delay: R=link bandwidth (bps) L=packet length (bits) time to send bits into link = L/R 4. Propagation delay: d = length of physical link s = propagation speed in medium (~2x108 m/sec) propagation delay = d/s Note: s and R are very different quantities! A B propagation transmission nodal processing queueing

43 Nodal delay dproc = processing delay dqueue = queuing delay
typically a few microsecs or less dqueue = queuing delay depends on congestion dtrans = transmission delay = L/R, significant for low-speed links dprop = propagation delay a few microsecs to hundreds of msecs

44 Network Layer Design Issues
Store-and-Forward Packet Switching

45 Services Provided to the Transport Layer
The services should be independent of the router technology. The transport layer should be shielded from the number, type, and topology of the routers present. The network addresses made available to the transport layer should use a uniform numbering plan, even across LANs and WANs.

46 Implementation of Connectionless Service

47 Implementation of Connection-Oriented Service

48 Comparison of datagram and virtual-circuit subnets.

49 Comparison of datagram and virtual-circuit subnets
several trade-offs exist between virtual circuits and datagrams memory space and bandwidth. setup time versus address parsing time the amount of table space required in router memory

50 Virtual circuits advantages
Guaranteeing quality of service Avoiding congestion within the subnet

51 Routing Algorithms Routing packets from the source machine to the destination machine. Packets will require multiple hops to make the journey. Exception is for broadcast networks The algorithms that choose the routes and the data structures that they use are a major area of network layer design.

52 Routing Algorithms The routing algorithm is that part of the network layer software responsible for deciding which output line an incoming packet should be transmitted on. If the subnet uses datagrams internally, this decision must be made a new for every arriving data packet since the best route may have changed since last time. If the subnet uses virtual circuits internally, routing decisions are made only when a new virtual circuit is being set up. (eg. session routing )

53 Routing Algorithms A router as having two processes inside it.
One of them handles each packet as it arrives, looking up the outgoing line to use for it in the routing tables called forwarding. The other process is responsible for filling in and updating the routing tables. Here the routing algorithm comes into play.

54 properties of routing algorithm:
Correctness Simplicity Robustness Stability Fairness Optimality

55 Classes of Routing algorithms
Nonadaptive algorithms do not base their routing decisions on measurements or estimates of the current traffic and topology. Choice of the route to use to get from I to J is computed in advance, off-line, and downloaded to the routers when the network is booted. This procedure is sometimes called static routing.

56 Classes of Routing algorithms
Adaptive algorithms, change their routing decisions to reflect changes in the topology, & usually the traffic. Differ in where they get their information (e.g., locally, from adjacent routers, or from all routers), When they change the routes (e.g., every ΔT sec, when the load changes or when the topology changes), What metric is used for optimization (e.g., distance, number of hops, or estimated transit time).

57 The Optimality Principle
one can make a general statement about optimal routes without regard to network topology or traffic. This statement is known as the optimality principle. It states that if router J is on the optimal path from router I to router K, then the optimal path from J to K also falls along the same route.

58 (a) A subnet. (b) A sink tree for router B.

59 Shortest Path Routing To build a graph of the subnet, with each node of the graph representing a router and each arc of the graph representing a communication line (often called a link). To choose a route between a given pair of routers, the algorithm just finds the shortest path between them on the graph.

60 Shortest Path Routing Shortest path decision depends on- Number of hops Geographic distance in kilometers Mean queueing and Transmission delay

61 Shortest Path Routing

62 Initially, no paths are known, so all nodes are labeled with infinity.
Dijkstra algorithm Each node is labeled (in parentheses) with its distance from the source node along the best known path. Initially, no paths are known, so all nodes are labeled with infinity. As the algorithm proceeds and paths are found, the labels may change, reflecting better paths. A label may be either tentative or permanent.

63 Flooding Static algorithm. Every incoming packet is sent out on every outgoing line except the one it arrived on. Obviously generates vast numbers of duplicate packets. A hop counter contained in the header of each packet Packet discarded when the counter reaches zero. Counter initialized to the length of the path.

64 Flooding Selective flooding Routers don’t send every incoming packet out on every line. Only on those lines that are going approximately in the right direction. Examples. Military applications Distributed database applications Wireless networks

65 Routing algorithms Modern computer networks generally use dynamic routing algorithms rather than the static. As static algorithms do not take the current network load into account. Two dynamic algorithms, Distance vector routing and Link state routing

66 Distance vector routing
Each router maintain a table (i.e, a vector) Gives best known distance to each destination. Which line to use to get there. Tables are updated by exchanging information with the neighbors. Also called as Bellman-Ford routing algorithm(1957) and the Ford-Fulkerson algorithm(1962).

67 Distance vector routing
Each router maintains a routing table indexed by, and containing one entry for, each router in the subnet. Preferred outgoing line to use for that destination and an estimate of the time or distance to that destination.

68 Distance vector routing

69 Link State Routing Distance vector routing was used in the ARPANET until 1979, when it was replaced by link state routing. Two primary problems Delay metric was queue length, it did not take line bandwidth into account when choosing routes. Algorithm often took too long to converge

70 Link State Routing Each router must follow five parts: Discover its neighbors and learn their network addresses. Measure the delay or cost to each of its neighbors. Construct a packet telling all it has just learned. Send this packet to all other routers. Compute the shortest path to every other router.

71 1) Learning about the Neighbors
When a router is booted, its first task is to learn who its neighbors are, sending a special HELLO packet on each point-to-point line.

72 2) Measuring Line Cost Each router to know, or estimate of, the delay to each of its neighbors. Send over the line a special ECHO packet that the other side is required to send back. By measuring the round-trip time and dividing it by two, the sending router can get a reasonable estimate of the delay. For even better results, the test can be conducted several times, and the average used.

73 4) Building Link State Packets
Once the information needed for the exchange has been collected. The next step is for each router to build a packet containing all the data. The packet starts with the identity of the sender, a sequence number and age and a list of neighbors. For each neighbor, the delay to that neighbor is given.

74 4)Building Link State Packets [contd…]

75 5) Distributing the Link State Packets
Packets are distributed and installed, Routers getting the first ones will change their routes. Different routers may be using different versions of the topology, Can lead to inconsistencies, loops, unreachable machines, and other problems.

76 Algorithm has a few problems
Sequence numbers wrap around. A router ever crashes, A sequence number is ever corrupted

77 Q.1: Find the minimum distance by Dijkstra algorithm

78 Q2: Find the minimum distance by distance vector algorithm.

79 Internet Control Message Protocol (ICMP)

80 need The IP protocol has no error-reporting or error-correcting mechanism. What happens if something goes wrong? If a router must discard a datagram because it cannot find a router to the final destination, or because the time-to-live field has a zero value. If the final destination host must discard all fragments of a datagram because it has not received all fragments within a predetermined time limit. These are examples of situations where an error has occurred.

81 need The IP protocol has no built-in mechanism to notify the original host. The IP protocol also lacks a mechanism for host and management queries. A host sometimes needs to determine if a router or another host is alive. And sometimes a network administrator needs information from another host or router.

82 Position of ICMP in the network layer

83 Encapsulation of ICMP packet

84 Types of Messages

85 Types of Messages Error-reporting messages report problems that a router or a host (destination) may encounter when it processes an IP packet. Query messages, which occur in pairs, help a host or a network manager get specific information from a router or another host. For example, 1. Nodes can discover their neighbors. 2.Hosts can discover and learn about routers on their network, and routers can help a node redirect its messages.

86 General format of ICMP messages

87 Message Format An ICMP message has an 8-byte header and a variable-size data section. The general format of the header is different for each message type. The first 4 bytes are common to all. ICMP type, defines the type of the message. Code field specifies the reason for the particular message type. Common field is the checksum field.

88 Message Format Rest of the header is specific for each message type. Data section in error messages carries information for finding the original packet that had the error. In query messages, the data section carries extra information based on the type of the query.

89 Error Reporting The main responsibilities of ICMP is to report errors.
Although technology has produced increasingly reliable transmission media, errors still exist and must be handled. IP, as discussed, is an unreliable protocol. Error checking and error control are not a concern of IP.

90 Error Reporting ICMP was designed, to compensate for this shortcoming.
ICMP does not correct errors-it simply reports them. Error correction is left to the higher-level protocols. Error messages are always sent to the original source because the only information available in the datagram about the route is the source and destination IP addresses. ICMP uses the source IP address to send the error message to the source (originator) of the datagram

91 ICMP always reports error messages to the original source.

92 Types of error message

93 Types of error message Five types of errors are handled:
Destination unreachable, Source quench, Time exceeded, Parameter problems, and Redirection

94 Important points about ICMP error messages: 1
Important points about ICMP error messages: 1. No ICMP error message for a datagram carrying an ICMP error message No ICMP error message for a fragmented datagram that is not the first fragment No ICMP error message for a datagram having a multicast address No ICMP error message for a datagram with a special address such as or

95 Contents of data field for error messages

96 Contents of data field for error messages
All error messages contain a data section that includes the IP header of the original datagram plus the first 8 bytes of data in that datagram. The original datagram header is added to give the original source, which receives the error message. First 8 bytes provide information about the port numbers and sequence number. ICMP forms an error packet, which is then encapsulated in an IP datagram

97 1. Destination Unreachable
When a router cannot route a datagram or a host cannot deliver a datagram, the datagram is discarded. The router or the host sends a destination-unreachable message back to the source host that initiated the datagram. Note that destination-unreachable messages can be created by either a router or the destination host.

98 Destination-unreachable format

99 Destination-unreachable messages with codes 2 or 3 can be created only by the destination host. Other destination-unreachable messages can be created only by routers.

100 A router cannot detect all problems that prevent the delivery of a packet.

101 There is no flow-control mechanism in the IP protocol.

102 2. Source Quench Absence of communication is the lack of flow control creates congestion. The source host never knows If the routers or the destination host has been overloaded with datagrams. If it is producing datagrams faster than can be forwarded by routers or processed by the destination host.

103 2. Source Quench The lack of flow control can create congestion in routers or the destination host. A router or a host has a limited-size queue (buffer) for incoming datagrams waiting to be forwarded (in the case of a router) or to be processed (in the case of a host). If the datagrams are received much faster than they can be forwarded or processed, the queue may overflow. In this case, the router or the host has no choice but to discard some of the datagrams.

104 2. Source Quench The source-quench message in ICMP was designed to add a kind of flow control to the IP. When a router or host discards a datagram due to congestion, it sends a source-quench message to the sender of the datagram. This message has two purposes. First, it informs the source that the datagram has been discarded. Second, it warns the source that there is congestion somewhere in the path and that the source should slow down (quench) the sending process.

105 3. Time Exceeded Time-exceeded message is generated in two cases
When the time-to-live value reaches 0, after decrementing, the router discards the datagram. A time-exceeded message must be sent by the router to the original source. When not all fragments that make up a message arrive at the destination host within a certain time limit.

106 Code 0: Time to live Code 1: Fragmentation
3. Time Exceeded format Code 0: Time to live Code 1: Fragmentation

107 3. Time Exceeded format Time-exceeded message is generated in two cases Routers use routing tables to find the next hop (next router) that must receive the packet. If there are errors in one or more routing tables, a packet can travel in a loop or a cycle, going from one router to the next or visiting a series of routers endlessly.

108 Each datagram contains a field called time to live that controls this situation.
When a datagram visits a router, the value of this field is decremented by 1. When the time-to-live value reaches 0, after decrementing, the router discards the datagram. when the datagram is discarded, a time-exceeded message must be sent by the router to the original source.

109 3. Time Exceeded format Second, a time-exceeded message is also generated when not all fragments that make up a message arrive at the destination host within a certain time limit.

110 4. Parameter Problem Any ambiguity in the header part of a datagram can Create serious problems as the datagram travels through the Internet. If a router or the destination host discovers an ambiguous or missing value in any field of the datagram, it discards the datagram . Sends a parameter-problem message back to the source.

111 Redirection Routing is dynamic.
Hosts usually use static routing. When a host comes up, its routing table has a limited number of entries. The host may send a datagram, which is destined for another network, to the wrong router. In this case, the router that receives the datagram will forward the datagram to the correct router. However, to update the routing table of the host, it sends a redirection message to the host

112 Query

113 Echo Request and Reply Designed for diagnostic purposes. The combination of echo-request and echo-reply messages determines whether two systems (hosts or routers) can communicate with each other.

114 Timestamp Request and Reply
To determine the round-trip time needed for an IP datagram to travel between them. It can also be used to synchronize the clocks in two machines.

115 Address-Mask Request and Reply
A host may know its IP address, but it may not know the corresponding mask. For example, a host may know its IP address as , but it may not know that the corresponding mask is /24. To obtain its mask, a host sends an address-mask-request message to a router on the LAN.

116 Router Solicitation and Advertisement
a host that wants to send data to a host on another network needs to know the address of routers connected to its own network. Also, the host must know if the routers are alive and functioning. The router-solicitation and router-advertisement messages can help in this situation.

117 Checksum ICMP the checksum is calculated over the entire message (header and data).

118 Address Resolution Protocol (ARP)

119 Overview

120 Why Two Addresses? 90:AF:F4:CA:BA:03

121 Why two addresses? Want to keep the link layer & network layer independent so that the link layer can work with other network layer besides IP. Want efficiency -- we want the adapter to be able to decide if a frame received is addressed to the adapter. To do this we need an address in the hardware. But if we use network address here, then the hardware need to be reconfigured every time the network address changes.

122 ARP and RARP Note: The Internet is based on IP addresses
Data link protocols (Ethernet, FDDI, ATM) may have different (MAC) addresses The ARP and RARP protocols perform the translation between IP addresses and MAC layer addresses We will discuss ARP for broadcast LANs, particularly Ethernet LANs

123 HEY! WHAT IS THE MAC ADDRESS OF ?

124 That’s me! not me not me

125 The MAC address of is FB:CA:73:8A:9C:DD

126 Address Translation with ARP
ARP Request: Argon broadcasts an ARP request to all stations on the network: “What is the hardware address of Router137?”

127 Address Translation with ARP
ARP Reply: Router 137 responds with an ARP Reply which contains the hardware address

128 ARP Packet Format

129 Example ARP Request from Argon:
Source hardware address: 00:a0:24:71:e4:44 Source protocol address: Target hardware address: 00:00:00:00:00:00 Target protocol address: ARP Reply from Router137: Source hardware address: 00:e0:f9:23:a8:20 Source protocol address: Target hardware address: 00:a0:24:71:e4:44 Target protocol address:

130 ARP Cache Since sending an ARP request/reply for each IP datagram is inefficient, hosts maintain a cache (ARP Cache) of current entries. The entries expire after 20 minutes. Contents of the ARP Cache: ( ) at 00:10:4B:C5:D1:15 [ether] on eth0 ( ) at 00:B0:D0:E1:17:D5 [ether] on eth0 ( ) at 00:B0:D0:DE:70:E6 [ether] on eth0 ( ) at 00:05:3C:06:27:35 [ether] on eth1 ( ) at 00:B0:D0:E1:17:DB [ether] on eth0 ( ) at 00:B0:D0:E1:17:DF [ether] on eth0

131 Proxy ARP Proxy ARP: Host or router responds to ARP Request that arrives from one of its connected networks for a host that is on another of its connected networks.

132 Things to know about ARP
What happens if an ARP Request is made for a non-existing host? Several ARP requests are made with increasing time intervals between requests. Eventually, ARP gives up. On some systems (including Linux) a host periodically sends ARP Requests for all addresses listed in the ARP cache. This refreshes the ARP cache content, but also introduces traffic. Gratuitous ARP Requests: A host sends an ARP request for its own IP address: Useful for detecting if an IP address has already been assigned.

133 Reverse ARP Usually, a machine’s IP address is kept on its secondary storage (OS finds it at start up) Issue : Diskless Workstations! files are stored on a remote server need IP address to use TCP/IP to obtain initial boot image Solution : Use physical address to identify machine Given a physical network address, find the corresponding Internet address Reverse Address Resolution Protocol (RARP), RFC903

134 RARP Mechanism Sender broadcasts a RARP request, supplying its physical network address in the Target HA field Only machines authorized to supply the RARP service (RARP servers) process the request and send a reply filling in the target internet address Mechanism allows a host to ask about an arbitrary target thus sender HA is separate from target HA address RARP server replies to sender’s HA Ethernet frame Protocol Type for RARP is 8035 hex


Download ppt "Ch.5 Network layer."

Similar presentations


Ads by Google