Introduction to Computer Networks Internetworking All rights reserved. No part of this publication and file may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without prior written permission of Professor Nen-Fu Huang (
Internetworking - 2 Outline n Introduction n IP and Routers n IP Subnetting n Classless Addressing n Routing protocols n Distance Vector protocol n Link State protocol
Internetworking - 3 n What is internetwork ? l An arbitrary collection of networks interconnected to provide some sort of host-host to packet delivery service Internetworking
Internetworking - 4 Internetworking n What is IP ? l IP stands for Internet Protocol l Key tool used today to build scalable, heterogeneous internetworks l It runs on all the nodes in a collection of networks l Defines the infrastructure that allows these nodes and networks to function as a single logical internetwork
Internetworking - 5 Internetworking IP TCP IP ETH IP ETH PPP IP PPP ETH TCP IP ETH H5 H8 R1 R2 R3 A simple internetwork showing the protocol layers
Internetworking - 6 IP Service Model n Packet Delivery Model l Connectionless model for data delivery l Best-effort delivery (unreliable service) packets are lost packets are delivered out of order duplicate copies of a packet are delivered packets can be delayed for a long time n Global Addressing Scheme l Provides a way to identify all hosts in the network
Internetworking - 7 n Layer 3 router uses store and forward scheme to forward incoming IP packets (datagrams). l IP Address Lookup (Forwarding Table constructed by routing protocols, such as RIP, OSPF, BGP, etc) l IP/MAC mapping table How Layer 3 Routers Work ? IP Next Directly Directly Router Z IP MAC IP(A) MAC(A) IP(B) MAC(B) IP(Y) MAC(Y) IP(X) MAC(X)
Internetworking - 8 n Forward IP packet into next hop if the destination IP is found in the Forwarding Table. Otherwise, forward to default port. n New router Architecture with L3 switching Fabric ASICs and IP address lookup ASICs (hardware lookup) n Wire-speed forwarding design Gbps, 10Gbps, 100Gbps, … n Not Plug-and-Play How Layer 3 Routers Work ?
Internetworking - 9 Outline n Introduction n IP and Routers n IP Subnetting n Classless Addressing n Routing protocols n Distance Vector protocol n Link State protocol
Internetworking - 10 IP Datagram Header Format version IHL Type of Service Total length Identification Flags Fragment Offset Time to Live Protocol Header Checksum Source IP Address Destination IP Address Options + Padding Data
Internetworking - 11 Type of Service (ToS) of IP Precedence D T R O O Precedence 111 Network Control 110 Internetwork Control 101 CRITIC/ECP 100 Flash Override 011 Flash 010 Immediate 001 Priority 000 Routine Delay 0 Normal 1 Low Throughput, Reliability 0 Normal 1 High 0 DF MF DF 0 May Fragment 1 Don't Fragment MF 0 Last Fragment 1 More Fragment Flags 0 1 2
Internetworking - 12 IP Addresses n Properties l Globally unique 32 bits address l Hierarchical: network + host l 4 Billion IP addresses l Class A type (1/2) l Class B type (¼) l Class C type (1/8) n Dot notation l l l Network Host 1 0 Network Host Network Host
Internetworking - 13 How datagrams are delivered in an Internet ? R H WAN LAN R R R R R B H H H A H H H H Datagram LAN
Internetworking - 14 Routers MAC PHY HOST X LAN 1 LAN 2 Higher Layer Protocols MAC PHY HOST Y A B MAC PHY Network ROUTER Network LAN n IP MAC IP = Mask= IP = Mask= IP(A) MAC(A) IP(B) MAC(B) IP(Y) MAC(Y) IP Next Directly Directly RouterZ A A B B ROUTER Z LAN m IP = Mask= IP(X) MAC(X) Higher Layer Protocols MAC PHY Network A A B B Y Y B B MAC(Y) MAC(B) IP(Y) IP(B) IP DatagramMAC(R) MAC(B) IP(A) IP(B) IP DatagramMAC(A) MAC(R) IP(A) IP(B) IP Datagram
Internetworking - 15 Intra-LAN and Inter-LAN Communications n B -> Y (Intra LAN): l Send the frame to the destination directly n B -> A (Inter-LAN): l Send the frame to attached Router first. l Router will forward to the destination. MAC(Y) MAC(B) IP(Y) IP(B) IP Datagram MAC(R) MAC(B) IP(A) IP(B) IP DatagramMAC(A) MAC(R) IP(A) IP(B) IP Datagram
Internetworking - 16 An Internet Routing Example Network F Network G Network H Network Deliver Direct Deliver Direct To reach hosts Route to on network this address Routing Table
Internetworking - 17 IP Datagram Forwarding n Strategy l every datagram contains destination's address l if directly connected to destination network, then forward to host l if not directly connected to destination network, then forward to some router l forwarding table maps network number into next hop l each host has a default router l each router maintains a forwarding table
Internetworking - 18 IP Datagram Forwarding n Example (router R2) NetworkNumNextHop 1R1 2Interface 1 3Interface 0 4R3
Internetworking - 19 IP Fragmentation and Reassembly n MTU (Maximum Transmission Unit) l Ethernet (1518 bytes), l IEEE Wireless (2312 bytes) l FDDI (4500 bytes) n Strategy l Fragmentation occurs in a router when it receives a datagram that it wants to forward over a network which has MTU < datagram l Reassembly is done at the receiving host l All the fragments carry the same identifier l Fragments are self-contained datagrams l IP does not recover from missing fragments
Internetworking - 20 IP Fragmentation and Reassembly IP TCP IP ETH IP PPP IP PPP ETH TCP IP ETH H5 H8 R1 R2 R IP 1400 ETH IP 1400 PPP IP 512 PPP IP 512 PPP IP 376 ETH IP 512 ETH IP 512 ETH IP 376 IP datagrams traversing the sequence of physical networks
Internetworking - 21 IP Fragmentation and Reassembly. start of header ID = x 0 offset =0 Rest of Header 1400 data bytes start of header ID = x 1 offset =0 Rest of Header 512 data bytes start of header ID = x 1 offset=64 Rest of Header 512 data bytes start of header ID = x 0 offset=128 Rest of Header 376 data bytes (a) Unfragmented packet (b) fragmented packets
Internetworking - 22 Router Characteristics n Network Layer Routing l Network layer protocol dependent l Filter MAC broadcast and multicast packets l Easy to support mixed media l Packet fragmentation and reassembly l Filtering on network (IP) addresses and information l Accounting n Direct Communication Between Endpoints and Routers l Highly configurable and hard to get right l Handle speed mismatch l Congestion control and avoidance
Internetworking - 23 Router Characteristics (Continued) n Routing Protocols l Interconnect layer 3 networks and exploit arbitrary topologies l Determine which route to take l Static routing l Dynamic routing protocol support RIP: Routing Information Protocol OSPF: Open Shortest Path First l Provides reliability with alternate routes n Router Management l Troubleshooting capabilities
Internetworking - 24 Differences Between Bridges and Routers Bridges Routers Operation at Layer 2 Operation at Layer 3 Protocol IndependentProtocol Dependent Automatic Address Learning/Filtering Administration Required for Address,Interface and Routes Pass MAC Multicast/Broadcast MAC M/B can be Filtered Lower CostHigher Cost No Flow/Congestion Control Flow/Congestion Control Limited SecurityComplex Security Transparent to End Systems Non-Transparency Well Suited for Simple/Small Networks For WAN, Larger Networks No Frames Segmentation/Reassembly Frames Segmentation/Reassembly Spanning Tree Based Routing Optimal Routing and Load Sharing Plug and PlayRequires Central Administrator
Internetworking - 25 Outline n Introduction n IP and Routers n IP Subnetting n Classless Addressing n Routing protocols n Distance Vector protocol n Link State protocol
Internetworking - 26 n Add another level to address/routing hierarchy: subnet n Subnet masks define variable partition of host part of class A and B addresses Subnetting Network number Host number Network number subnet ID Host ID Class B address Subnet Mask ( ) Subnetted address
Internetworking - 27 Subnetting SubnetNumberSubnetMaskNextHop Interface Interface R2 128 hosts 256 hosts Network 2 (Ethernet) Network 4 (Ethernet) H5 H2 H1 H4 H3 H6 Subnet number: Subnet mask: Subnet number: Subnet mask: Subnet number: Subnet mask: Forwarding Table at Router R1 1 0
Internetworking - 28 Subnetting Forwarding Algorithm D = destination IP address for each entry D1 = (SubnetMask) AND (D) if D1 = SubnetNum if NextHop is an interface deliver datagram directly to destination else deliver datagram to NextHop (a router) SubnetNumberSubnetMaskNextHop Interface Interface R2
Internetworking - 29 Subnetting Example 1 D = (H1) D1 = SubnetMask & D = D1 = SubnetNum Interface 0 SubnetNumberSubnetMaskNextHop Interface Interface R2 Forwarding Table at Router R1
Internetworking - 30 Subnetting Example2 D = (H5) D1 = SubnetMask & D = D1 = SubnetNum Interface 1 SubnetNumberSubnetMaskNextHop Interface Interface R2 Forwarding Table at Router R1
Internetworking - 31 Subnetting Example 3 D = (H3) D1 = SubnetMask & D = D1 = SubnetNum R2 SubnetNumberSubnetMaskNextHop Interface Interface R2 Forwarding Table at Router R1
Internetworking - 32 Subnetting Notes n A default router is used if nothing matches n Not necessary for all ones in subnet mask to be contiguous n Can put multiple subnets on one physical network n Subnets not visible from the rest of the Internet
Internetworking - 33 Outline n Introduction n IP and Routers n IP Subnetting n Classless Addressing n Routing protocols n Distance Vector protocol n Link State protocol
Internetworking - 34 Classless Addressing n Classless Inter-Domain Routing (CIDR) l A technique that addresses two scaling concerns in the Internet The growth of backbone routing table as more and more network numbers need to be stored in them Potential exhaustion of the 32-bit address space
Internetworking - 35 Classless Addressing l Address assignment efficiency Arises because of the IP address structure with class A, B, and C addresses Forces us to hand out network address space in fixed-size chunks of three very different sizes – A network with two hosts needs a class C address » Address assignment efficiency = 2/255 = 0.78 – A network with 256 hosts needs a class B address » Address assignment efficiency = 256/65535 = 0.39
Internetworking - 36 Classless Addressing n Exhaustion of IP address space centers on exhaustion of the class B network numbers n Solution l Say “NO” to any Autonomous System (AS) that requests a class B address unless they can show a need close to 64K addresses l Instead give them an appropriate number of class C addresses n What is the problem with this solution? l Large storage requirement for routing table at the routers.
Internetworking - 37 Classless Addressing n For example, if a single AS has 16 class C network numbers l Every Internet backbone router needs 16 entries in its routing tables for that AS even if the path to every one of these networks is the same n If we had assigned a class B address to the AS l The same routing information can be stored in one entry l But Efficiency = 16 × 255 / 65, 536 = 6.2%
Internetworking - 38 Classless Addressing n CIDR uses aggregate routes l Uses a single entry in the forwarding table to tell the router how to reach a lot of different networks l Breaks the rigid boundaries between address classes
Internetworking - 39 Classless Addressing n For example, an AS with 16 class C network numbers n Instead of handing out 16 addresses at random, hand out a block of contiguous class C addresses n Suppose we assign the class C network numbers from through n Observe that top 20 bits of all the addresses in this range are the same ( ) l We have created a 20-bit network number (which is in between class B network number and class C number) n Requires to hand out blocks of class C addresses that share a common prefix
Internetworking - 40 Classless Addressing n n n n n n n n n n n n n n n n /20
Internetworking - 41 Classless Addressing n The convention is to place a “/X” after the prefix where X is the prefix length in bits n For example, the 20-bit prefix for all the networks through is represented as /20 n By contrast, if we wanted to represent a single class C network number , which is 24 bits long, we would write it /24
Internetworking - 42 Classless Addressing n How do the routing protocols handle this classless addresses ? l It must understand that the network number may be of any length n Represent network number with a single pair n All routers must understand CIDR addressing n CIDR means that prefixes may be of any length, from 2 to 32 bits
Internetworking - 43 Classless Addressing Route aggregation with CIDR 8 Class C networks / / / /24 Advertise /21 ISP......
Internetworking - 44 Longest prefix matching n It is also possible to have prefixes in the forwarding tables that overlap l Some addresses may match more than one prefix n For example, we might find both l (a 16 bit prefix) and l (a 24 bit prefix) in the forwarding table of a single router n A packet destined to clearly matches both prefixes. l The rule is based on the principle of “longest prefix match” in this case n A packet destined to would match and not
Internetworking - 45 Address Resolution Protocol (ARP) n Map IP addresses into physical (MAC) addresses l destination host, next hop router n ARP (Address Resolution Protocol) l table of IP to physical address bindings l broadcast request if IP address not in table l target machine responds with its physical address l table entries are discarded if not refreshed
Internetworking - 46 ARP Packet Format l HardwareType: type of physical network (e.g., Ethernet) l ProtocolType: type of higher layer protocol (e.g., IP) l HLEN & PLEN: length of physical and protocol addresses l Operation: request or response l Source/Target Physical/Protocol addresses
Internetworking - 47 Host Configurations n Ethernet addresses are configured into network by manufacturer and they are unique n IP addresses must be unique on a given internetwork but also must reflect the structure of the internetwork n Most host Operating Systems provide a way to manually configure the IP information for the host n Drawbacks of manual configuration A lot of work to configure all the hosts in a large network n Automated Configuration Process is required
Internetworking - 48 Dynamic Host Configuration Protocol (DHCP) n DHCP server is responsible for providing configuration information to hosts n There is at least one DHCP server for an administrative domain n DHCP server maintains a pool of available addresses
Internetworking - 49 n Newly booted or attached host sends DHCP DISCOVER message to a special IP address ( ) n DHCP relay agent unicasts the message to DHCP server and waits for the response DHCP relay DHCP relay Broadcast Unicast to server DHCP server
Internetworking - 50 DHCP Example
Internetworking - 51 Internet Control Message Protocol (ICMP) n Defines a collection of error messages that are sent back to the source host whenever a router or host is unable to process an IP datagram successfully l Destination host unreachable due to link /node failure l Reassembly process failed l TTL had reached 0 (so datagrams don't cycle forever) l IP header checksum failed n ICMP-Redirect l From router to a source host l With a better route information
Internetworking - 52 Outline n Introduction n IP and Routers n IP Subnetting n Classless Addressing n Routing protocols n Distance Vector protocol n Link State protocol
Internetworking - 53 Routing Forwarding versus Routing Forwarding: – to select an output port based on destination address and routing table Routing: – process to build the routing table
Internetworking - 54 Routing Forwarding table vs. Routing table Forwarding table Used when a packet is being forwarded An entry in the forwarding table contains the mapping from a network number to an outgoing interface and some MAC information, such as Ethernet Address of the next hop Routing table Built by the routing algorithm Generally contains mapping from network numbers to next hops
Internetworking - 55 Routing Example rows from (a) routing and (b) forwarding tables Prefix/Length Next Hop / Prefix/Length InterfaceMAC Address /16 08:0:2c:e3:b:2:20 (a) (b)
Internetworking - 56 Routing Network as a Graph The basic problem of routing is to find the lowest-cost path between any two nodes Where the cost of a path equals the sum of the costs of all the edges that make up the path
Internetworking - 57 Routing For a simple network, we can calculate all shortest paths and load them into each node. Such a static approach has several shortcomings It does not deal with node or link failures It does not consider the addition of new nodes or links It implies that edge costs cannot change What is the solution ? Need a distributed and dynamic protocol Two main classes of protocols Distance Vector Link State
Internetworking - 58 Outline n Introduction n IP and Routers n IP Subnetting n Classless Addressing n Routing protocols n Distance Vector protocol n Link State protocol
Internetworking - 59 Distance Vector n Each node constructs a one dimensional array (a vector) containing the “distances” (costs) to all other nodes and distributes that vector to its immediate neighbors n Assume that each node knows the cost of the link to each of its directly connected neighbors
Internetworking - 60 Distance Vector Initial distances stored at each node (global view) B C A E F G D Distance to reach node Information at node
Internetworking - 61 Initial routing table at node A Distance Vector B C A E F G D
Internetworking - 62 Final routing table at node A Distance Vector B C A E F G D
Internetworking - 63 Final distances stored at each node (global view) Distance Vector B C A E F G D Distance to reach node Information at node
Internetworking - 64 Distance Vector n Every T seconds each router sends its routing table to its neighbors n Each router then updates its routing table based on the new information n Problems include l fast response to good news l slow response to bad news l Too many messages to update
Internetworking - 65 Distance Vector When a node detects a link failure F detects that link to G has failed F sets distance to G to infinity and sends update to A A sets distance to G to infinity since it uses F to reach G A receives periodic update from C with 2-hop path to G A sets distance to G to 3 and sends update to F F decides it can reach G in 4 hops via A ∞ 2 3
Internetworking - 66 Distance Vector n Count-to-infinity problem n Slightly different cases may cause the network unstable l Suppose the link from A to E goes down l In the next round of updates, A advertises a distance of infinity to E, but B and C advertise a distance of 2 to E 2 ∞ ∞ ∞
Internetworking - 67 Distance Vector l Depending on the exact timing of events, the following might happen Node B, upon hearing that E can be reached in 2 hops from C, concludes that it can reach E in 3 hops and advertises this to A Node A concludes that it can reach E in 4 hops and advertises this to C Node C concludes that it can reach E in 5 hops; and so on. This cycle stops only when the distances reach some number that is large enough to be considered infinite – Count-to-infinity problem
Internetworking - 68 Count-to-infinity Problem n In fact, some relatively small number is used to approximate the infinity n For example, the maximum number of hops to get across a certain network is less than 16 n One technique to improve the time to stabilize routing is called split horizon l When a node sends a routing update to its neighbors, it does not send those routes it learned from each neighbor back to that neighbor l For example, if B has the route (E, 2, A) in its table, then it knows it must have learned this route from A, and so whenever B sends a routing update to A, it does not include the route (E, 2) in that update
Internetworking - 69 Count-to-infinity Problem n split horizon with poison reverse, a stronger version of split horizon l B actually sends that back route to A, but it puts negative information in the route to ensure that A will not eventually use B to get to E l For example, B sends the route (E, ∞) to A
Internetworking - 70 Outline n Introduction n IP and Routers n IP Subnetting n Classless Addressing n Routing protocols n Distance Vector protocol n Link State protocol
Internetworking - 71 Link State Routing Strategy: Send to all nodes (not just neighbors) information about directly connected links (not entire routing table). n Link State Packet (LSP) l ID of the node that created the LSP l Cost of link to each directly connected neighbor l Sequence number (SEQNO) l Time-to-live (TTL) for this packet
Internetworking - 72 Link State Routing n Reliable Flooding l Store most recent LSP from each node l Forward LSP to all nodes but one that sent it l Generate new LSP periodically; increment SEQNO l Start SEQNO at 0 when reboot l Decrement TTL of each stored LSP; discard when TTL=0
Internetworking - 73 Link State Routing Example of reliable flooding of LSP packets From node A
Internetworking - 74 Shortest Path Routing n OSPF (Open Shortest Path First) n Each router computes its routing table directly from the LSP’s it has collected using the Dijkstra’s algorithm n Find the shortest path from the router to each other node.
Internetworking - 75 Summary n Introduced issues for building scalable and heterogeneous networks by using routers to interconnect networks. n Internet Protocol (IP) l Connectionless model for data delivery l Best-effort delivery (unreliable service) packets are lost packets are delivered out of order duplicate copies of a packet are delivered packets can be delayed for a long time n Routers and Routing protocols l Routing Table lookup
Internetworking - 76 Summary n IP Subnetting l Subnetmask l Subnet number n Classless Inter-Domain Routing (CIDR) l Routes aggregated to reduce routing table size l Prefix and Prefix length /21 presents 8 class C networks /22 presents 4 class C networks n DHCP (Dynamic Host Configuration Protocol) n ICMP (Internet Control Message Protocol)
Internetworking - 77 Summary n Two major classes of routing protocols l Distance Vector Send entire routing table to directly connected neighbors. fast response to good news slow response to bad news Count-to-infinite problem Split-horizon solution Split horizon with poison reverse solution RIP (Routing Information Protocol)
Internetworking - 78 Summary l Link State Send to all nodes information about directly connected links Reliable broadcasting LSPs Each node has the entire network topology of the AS Calculate the shortest path to each other node OSPF (Open Shortest Path First)