Presentation is loading. Please wait.

Presentation is loading. Please wait.

Network Layer4-1 Chapter 4 Network Layer All material copyright 1996-2009 J.F Kurose and K.W. Ross, All Rights Reserved.

Similar presentations


Presentation on theme: "Network Layer4-1 Chapter 4 Network Layer All material copyright 1996-2009 J.F Kurose and K.W. Ross, All Rights Reserved."— Presentation transcript:

1 Network Layer4-1 Chapter 4 Network Layer All material copyright 1996-2009 J.F Kurose and K.W. Ross, All Rights Reserved

2 Network Layer4-2 Network layer r transport segment from sending to receiving host r on sending side encapsulates segments into _______________ r on rcving side, delivers segments to _________ r network layer protocols in every _______, ____ r router examines header fields in all IP datagrams passing through it application transport network data link physical application transport 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

3 Network Layer4-3 Forwarding table Destination Address Range Link Interface 11001000 00010111 00010000 00000000 through 0 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 through 1 11001000 00010111 00011000 11111111 11001000 00010111 00011001 00000000 through 2 11001000 00010111 00011111 11111111 otherwise 3 # possible entries?

4 Network Layer4-4 Longest prefix matching Prefix Match Link Interface 11001000 00010111 00010 0 11001000 00010111 00011000 1 11001000 00010111 00011 2 otherwise 3 DA: 11001000 00010111 00011000 10101010 Examples DA: 11001000 00010111 00010110 10100001 Which interface?

5 Network Layer4-5 IP datagram format ver length 32 bits data (variable length, typically a TCP or UDP segment) 16-bit identifier header checksum time to live 32 bit source IP address head. len type of service flgs fragment offset upper layer 32 bit destination IP address Options (if any) how much overhead with TCP? r 20 bytes of TCP r ____ bytes of IP r = ___ bytes + app layer overhead

6 Network Layer4-6 IP Addressing: introduction r IP address: ____-bit identifier for host, router interface r interface: connection between host/router and physical link m routers typically have multiple interfaces m host typically has one interface m IP addresses associated with each interface 223.1.1.1 223.1.1.2 223.1.1.3 223.1.1.4 223.1.2.9 223.1.2.2 223.1.2.1 223.1.3.2 223.1.3.1 223.1.3.27 223.1.1.1 = 11011111 00000001 00000001 00000001 223 111

7 Network Layer4-7 Subnets r IP address: m subnet part (high order bits) m host part (low order bits) r What’s a subnet ? m device interfaces with same subnet part of IP address m can physically reach each other without intervening router 223.1.1.1 223.1.1.2 223.1.1.3 223.1.1.4 223.1.2.9 223.1.2.2 223.1.2.1 223.1.3.2 223.1.3.1 223.1.3.27 network consisting of 3 subnets subnet

8 Network Layer4-8 Subnets 223.1.1.0/24 223.1.2.0/24 223.1.3.0/24 Recipe r To determine the subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet. Subnet mask: /24

9 Network Layer4-9 Subnets How many? 223.1.1.1 223.1.1.3 223.1.1.4 223.1.2.2 223.1.2.1 223.1.2.6 223.1.3.2 223.1.3.1 223.1.3.27 223.1.1.2 223.1.7.0 223.1.7.1 223.1.8.0223.1.8.1 223.1.9.1 223.1.9.2

10 Network Layer4-10 IP addressing: CIDR CIDR: Classless InterDomain Routing m subnet portion of address of arbitrary length m address format: a.b.c.d/x, where x is # bits in subnet portion of address 11001000 00010111 00010000 00000000 200.23.16.0/23

11 Network Layer4-11 DHCP: Dynamic Host Configuration Protocol Goal: allow host to dynamically obtain its IP address from network server when it joins network Can renew its lease on address in use Allows reuse of addresses (only hold address while connected an “on”) Support for mobile users who want to join network (more shortly) DHCP overview: m host broadcasts “_________” msg [optional] m DHCP server responds with “__________” msg [optional] m host requests IP address: “___________” msg m DHCP server sends address: “___________” msg

12 Network Layer4-12 DHCP client-server scenario 223.1.1.1 223.1.1.2 223.1.1.3 223.1.1.4 223.1.2.9 223.1.2.2 223.1.2.1 223.1.3.2 223.1.3.1 223.1.3.27 A B E

13 Network Layer4-13 DHCP client-server scenario DHCP server: 223.1.2.5 arriving client time DHCP discover src : 0.0.0.0, 68 dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654 DHCP offer src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 654 Lifetime: 3600 secs DHCP request src: 0.0.0.0, 68 dest:: 255.255.255.255, 67 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs DHCP ACK src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs DHCP UDP IP Eth Phy

14 Network Layer4-14 NAT: Network Address Translation 10.0.0.1 10.0.0.2 10.0.0.3 10.0.0.4 138.76.29.7 Datagrams with source or destination in this network have 10.0.0/24 address for source, destination (as usual) All datagrams leaving local network have same single source NAT IP address: 138.76.29.7, different source port numbers

15 Network Layer4-15 NAT: Network Address Translation r Motivation: local network uses just one IP address as far as outside world is concerned: m ________________________________

16 Network Layer4-16 NAT: Network Address Translation Implementation: NAT router must: m outgoing datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #)... remote clients/servers will respond using (NAT IP address, new port #) as destination addr. m remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair m incoming datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table

17 Network Layer4-17 NAT: Network Address Translation 10.0.0.1 10.0.0.2 10.0.0.3 S: 10.0.0.1, 3345 D: 128.119.40.186, 80 1 10.0.0.4 138.76.29.7 S: __________, __ D: _________, ____ 4 S: 138.76.29.7, 5001 D: 128.119.40.186, 80 2 S: 128.119.40.186, 80 D: 138.76.29.7, 5001 3

18 Network Layer4-18 NAT: Network Address Translation r _______ port-number field: m 60,000 simultaneous connections with a single LAN-side address! r NAT is controversial: m routers should only process up to layer 3 m violates end-to-end argument NAT possibility must be taken into account by app designers, eg, P2P applications m address shortage should instead be solved by IPv6

19 Network Layer4-19 NAT traversal problem r client wants to connect to server with address 10.0.0.1 m server address 10.0.0.1 local to LAN (client can’t use it as destination addr) m only one externally visible NATted address: 138.76.29.7 r solution 1: statically configure NAT to forward incoming connection requests at given port to server m e.g., (123.76.29.7, port 2500) always forwarded to 10.0.0.1 port 25000 10.0.0.1 10.0.0.4 NAT router 138.76.29.7 Client ?

20 Network Layer4-20 NAT traversal problem r solution 2: Universal Plug and Play (UPnP) Internet Gateway Device (IGD) Protocol. Allows NATted host to:  learn public IP address (138.76.29.7)  add/remove port mappings (with lease times) i.e., automate static NAT port map configuration 10.0.0.1 10.0.0.4 NAT router 138.76.29.7 IGD

21 Network Layer4-21 NAT traversal problem r solution 3: relaying (used in Skype) m NATed client establishes connection to relay m External client connects to relay m relay bridges packets between to connections 138.76.29.7 Client 10.0.0.1 NAT router

22 Network Layer4-22 Distance Vector Algorithm Bellman-Ford Equation (dynamic programming) Define d x (y) := cost of least-cost path from x to y Then d x (y) = __________________

23 Network Layer4-23 Bellman-Ford example u y x wv z 2 2 1 3 1 1 2 5 3 5 Clearly, d v (z) = 5, d x (z) = 3, d w (z) = 3 d u (z) = Node that achieves minimum is next hop in shortest path ➜ forwarding table B-F equation says:

24 Network Layer4-24 Distance Vector Algorithm r D x (y) = estimate of least cost from x to y r Node x knows cost to each neighbor v: c(x,v) r Node x maintains distance vector D x = [D x (y): y є N ] r Node x also maintains its neighbors’ distance vectors m For each neighbor v, x maintains D v = [D v (y): y є N ]

25 Network Layer4-25 Distance vector algorithm (4) Basic idea: r From time-to-time, each node sends its own distance vector estimate to neighbors r Asynchronous r When a node x receives new DV estimate from neighbor, it updates its own DV using B-F equation: D x (y) ← min v {c(x,v) + D v (y)} for each node y ∊ N  Under minor, natural conditions, the estimate D x (y) converge to the actual least cost d x (y)

26 Network Layer4-26 Distance Vector Algorithm (5) Iterative, asynchronous: each local iteration caused by: r local link cost change r DV update message from neighbor Distributed: r each node notifies neighbors only when its DV changes m neighbors then notify their neighbors if necessary wait for (change in local link cost or msg from neighbor) recompute estimates if DV to any dest has changed, notify neighbors Each node:

27 Network Layer4-27 x y z x y z 0 2 7 ∞∞∞ ∞∞∞ from cost to from x y z x y z from cost to x y z x y z ∞∞ ∞∞∞ cost to x y z x y z ∞∞∞ 710 cost to ∞ 2 0 1 ∞ ∞ ∞ time x z 1 2 7 y node x table node y table node z table

28 Network Layer4-28 x y z x y z 0 2 7 ∞∞∞ ∞∞∞ from cost to from x y z x y z 0 2 3 from cost to x y z x y z 0 2 3 from cost to x y z x y z ∞∞ ∞∞∞ cost to x y z x y z 0 2 7 from cost to x y z x y z 0 2 3 from cost to x y z x y z 0 2 3 from cost to x y z x y z 0 2 7 from cost to x y z x y z ∞∞∞ 710 cost to ∞ 2 0 1 ∞ ∞ ∞ 2 0 1 7 1 0 2 0 1 7 1 0 2 0 1 3 1 0 2 0 1 3 1 0 2 0 1 3 1 0 2 0 1 3 1 0 time x z 1 2 7 y node x table node y table node z table D x (y) = min{c(x,y) + D y (y), c(x,z) + D z (y)} = min{2+0, 7+1} = 2 D x (z) = min{c(x,y) + D y (z), c(x,z) + D z (z)} = min{2+1, 7+0} = 3

29 Network Layer4-29 Intra-AS Routing r also known as Interior Gateway Protocols (IGP) r most common Intra-AS (autonomous systems) routing protocols: m RIP: Routing Information Protocol m OSPF: Open Shortest Path First m IGRP: Interior Gateway Routing Protocol (Cisco proprietary)

30 Network Layer4-30 RIP ( Routing Information Protocol) r distance vector algorithm r included in BSD-UNIX Distribution in 1982 r distance metric: # of hops (max = 15 hops) D C BA u v w x y z destination hops u 1 v 2 w 2 x 3 y 3 z 2 From router A to subnets:

31 Network Layer4-31 RIP advertisements r distance vectors: exchanged among neighbors every 30 sec via Response Message (also called advertisement) r each advertisement: list of up to 25 destination subnets within AS

32 Network Layer4-32 RIP: Example Destination Network Next Router Num. of hops to dest. wA2 yB2 zB7 x--1 ….…..... w xy z A C D B Routing/Forwarding table in D

33 Destination Network Next Router Num. of hops to dest. wA2 yB2 z x--1 ….…..... Network Layer4-33 RIP: Example Routing/Forwarding table in D w xy z A C D B Dest Next hops w - 1 x - 1 z C 4 …. …... Advertisement from A to D

34 Network Layer4-34 RIP: Link Failure and Recovery If no advertisement heard after 180 sec --> neighbor/link declared dead m routes via neighbor invalidated m new advertisements sent to neighbors m neighbors in turn send out new advertisements (if tables changed) m link failure info quickly (?) propagates to entire net m poison reverse used to prevent ping-pong loops (infinite distance = 16 hops)


Download ppt "Network Layer4-1 Chapter 4 Network Layer All material copyright 1996-2009 J.F Kurose and K.W. Ross, All Rights Reserved."

Similar presentations


Ads by Google