Network Layer session 1 TELE3118: Network Technologies Week 5: Network Layer Forwarding, Features Some slides have been taken from: r Computer Networking: A Top Down Approach Featuring the Internet, 4 th edition. Jim Kurose, Keith Ross. Addison-Wesley, July All material copyright J.F Kurose and K.W. Ross, All Rights Reserved. r Computer Networks, 4 th edition. Andrew S. Tanenbaum. Prentice-Hall, 2003.
Network Layer5-2 IP Forwarding r Case I: hosts in same LAN (A B) r Case II: hosts in different LANs (A E) A note on terminology: Switch (bridge) vs. Router m Hardware vs. software? m layer-2 vs. layer-3? A B E IP datagram: misc fields source IP addr dest IP addr data
Network Layer5-3 Case I: hosts in same LAN Starting at A, dest. B: r look up dest-IP in routing table r dest is in LAN on interface r send datagram directly to B in Ethernet frame r how to determine B’s Ethernet MAC address? routing table at A DestMaskNext-hop L: B’s MAC addr A’s MAC addr A’s IP addr B’s IP addr IP payload datagram frame frame source, dest address datagram source, dest address misc fields data A B E
Network Layer5-4 ARP: Address Resolution Protocol r Each IP node (Host, Router) on LAN has ARP table r ARP Table: IP/MAC address mappings for same LAN nodes m TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min)
Network Layer5-5 ARP protocol r A wants to send datagram to B, and A knows B’s IP address. r Suppose B’s MAC address is not in A’s ARP table. r A broadcasts ARP query packet, containing B's IP address m all machines on LAN receive ARP query r B receives ARP packet, replies to A with its (B's) MAC address m frame sent to A’s MAC address (unicast) r A caches (saves) IP-to- MAC address pair in its ARP table until information becomes old (times out) m soft state: information that times out (goes away) unless refreshed r ARP is “plug-and-play”: m nodes create their ARP tables without intervention from net administrator
Network Layer5-6 Case II: hosts in different LANs Starting at A, dest. E: r look up network address of E in routing table r E on different network m A, E not directly attached r routing table: next hop router to E is r link layer sends datagram to router in Ethernet frame (ARP) r datagram arrives at r continued….. misc fields data routing table at A DestMaskNext-hop L: A B E
Network Layer5-7 Case II (contd.) Arriving at , destined for r look up network address of E in router’s routing table r E on same network as router’s interface m router, E directly attached r link layer sends datagram to in Ethernet frame via interface (ARP) r datagram arrives at !!! (hooray!) misc fields data routing table in router A B E DestMaskNext-hop L: L: L:
Network Layer5-8 Packet walk-through A ( ) B ( ) A R B Each node (host/router) has r Route table: dest/mask next-hop r ARP table: LAN IP addr MAC address
Network Layer5-9 r A creates datagram with source A, destination B r A uses ARP to get R’s MAC address for r A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram r A’s data link layer sends frame r R’s data link layer receives frame r R removes IP datagram from Ethernet frame, sees its destined to B r R uses ARP to get B’s physical layer address r R creates frame containing A-to-B IP datagram sends to B r B receives the frame and extracts IP datagram A R B
Network Layer5-10 To switch or route? vlan 100 vlan sMAC dMAC sIP dIP ----Data---- ?? Assume unicast traffic r Lookup dMAC in MAC-table r If (dMAC ≠ interface MAC) switch m switch (bridge) the frame as is onto learnt port r Else frame is for upper layer (IP) route m Lookup dest-IP in routing table (discard if no match) m Determine next hop MAC addr (ARP table) m Send datagram with new Ethernet header
Network Layer5-11 Switch-Router MAC table VLANMAC addressport E-3A-02-08Self A B E-3A-02-10Self router IP interfaces on VLANs 3 and 2018 No router IP interface on VLAN 76
Network Layer5-12 Switch-Router routing table L L L destination mask local next-hop LAN interfaces / / /24 default route
Network Layer5-13 Unicast forwarding algorithm Determine most specific match in routing table found one? drop packet dest on same LAN. nh-IP = dest-IP local intf? next-hop is router. nh-IP = gway-IP nh-IP in ARP table? send ARP request and wait for response get ARP response and fill in ARP table construct Ethernet header and send frame no yes no yes dest-MAC address mine? discard extract IP datagram dest-IP address mine? pass datagram data to upper layer yes no yes Send: Host receive: switch Ethernet frame dest-MAC address mine? Route IP datagram extract IP datagram dest-IP address mine? pass datagram data to upper layer yes no yes Switch/router receive:
Network Layer5-14 IP/Ethernet configuration / / / / / /24 what’s going on ?? /16 A B C DestMaskGateway L: IP interface: /24 Interface route
Network Layer5-15 IP/Ethernet configuration /24 default route: /24 default route: / /24 DestMaskGateway L: Internet
Network Layer5-16 IP/Ethernet configuration /16 default route: /24 default route: / / /24 default route: A C D IP reachability: switch --- from ABCDABCD A B C D to /24 default route: B router
Network Layer5-17 IP datagram format ver length 32 bits data (variable length, typically a TCP or UDP segment) 16-bit identifier Internet checksum time to live 32 bit source IP address IP protocol version number header length (bytes) max number remaining hops (decremented at each router) for fragmentation/ reassembly total datagram length (bytes) upper layer protocol to deliver payload to head. len type of service “type” of data flgs fragment offset upper layer 32 bit destination IP address Options (if any) E.g. timestamp, record route taken, specify list of routers to visit. how much overhead with TCP? r 20 bytes of TCP r 20 bytes of IP r = 40 bytes + app layer overhead
Network Layer5-18 IP Fragmentation & Reassembly r network links have MTU (max.transfer size) - largest possible link-level frame. m different link types, different MTUs r large IP datagram divided (“fragmented”) within net m one datagram becomes several datagrams m “reassembled” only at final destination m IP header bits used to identify, order related fragments fragmentation: in: one large datagram out: 3 smaller datagrams reassembly
Network Layer5-19 IP Fragmentation and Reassembly ID =x offset =0 fragflag =0 length =4000 ID =x offset =0 fragflag =1 length =1500 ID =x offset =185 fragflag =1 length =1500 ID =x offset =370 fragflag =0 length =1040 One large datagram becomes several smaller datagrams Example r 4000 byte datagram r MTU = 1500 bytes 1480 bytes in data field offset = 1480/8
Network Layer5-20 ICMP: Internet Control Message Protocol r used by hosts & routers to communicate network-level information m error reporting: unreachable host, network, port, protocol m echo request/reply (used by ping) r network-layer “above” IP: m ICMP msgs carried in IP datagrams r ICMP message: type, code plus first 8 bytes of IP datagram causing error Type Code description 0 0 echo reply (ping) 3 0 dest. network unreachable 3 1 dest host unreachable 3 2 dest protocol unreachable 3 3 dest port unreachable 3 6 dest network unknown 3 7 dest host unknown 4 0 source quench (congestion control - not used) 8 0 echo request (ping) 9 0 route advertisement 10 0 router discovery 11 0 TTL expired 12 0 bad IP header
Network Layer5-21 Traceroute and ICMP r Source sends series of UDP segments to dest m First has TTL =1 m Second has TTL=2, etc. m Unlikely port number r When nth datagram arrives to nth router: m Router discards datagram m And sends to source an ICMP message (type 11, code 0) m Message includes name of router& IP address r When ICMP message arrives, source calculates RTT r Traceroute does this 3 times Stopping criterion r UDP segment eventually arrives at destination host r Destination returns ICMP “host unreachable” packet (type 3, code 3) r When source gets this ICMP, stops.
Network Layer5-22 IPv6 r Initial motivation: 32-bit address space soon to be completely allocated. r Additional motivation: m header format helps speed processing/forwarding m header changes to facilitate QoS IPv6 datagram format: m fixed-length 40 byte header m no fragmentation allowed
Network Layer5-23 IPv6 Header (Cont) Priority: identify priority among datagrams in flow Flow Label: identify datagrams in same “flow.” (concept of“flow” not well defined). Next header: identify upper layer protocol for data
Network Layer5-24 Other Changes from IPv4 r Checksum: removed entirely to reduce processing time at each hop r Options: allowed, but outside of header, indicated by “Next Header” field r ICMPv6: new version of ICMP m additional message types, e.g. “Packet Too Big” m multicast group management functions
Network Layer5-25 Transition From IPv4 To IPv6 r Not all routers can be upgraded simultaneous m no “flag days” m How will the network operate with mixed IPv4 and IPv6 routers? r Tunneling: IPv6 carried as payload in IPv4 datagram among IPv4 routers
Network Layer5-26 Tunneling A B E F IPv6 tunnel Logical view: Physical view: A B E F IPv6 C D IPv4 Flow: X Src: A Dest: F data Flow: X Src: A Dest: F data Flow: X Src: A Dest: F data Src:B Dest: E Flow: X Src: A Dest: F data Src:B Dest: E A-to-B: IPv6 E-to-F: IPv6 B-to-C: IPv6 inside IPv4 B-to-C: IPv6 inside IPv4
Network Layer5-27 Future of IPv6? hourglass wineglass?