Download presentation
Presentation is loading. Please wait.
Published byEllen Banks Modified over 8 years ago
1
Network Layer4-1 Chapter 4 Network Layer These ppt slides are originally from the Kurose and Ross’s book. But some slides are deleted and added for my own purpose, and some of them are modified.
2
Network Layer4-2 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet Protocol m Datagram format m IPv4 addressing m ICMP m IPv6 r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the Internet m RIP m OSPF m BGP r 4.7 Broadcast and multicast routing
3
Network Layer4-3 Key Network-Layer Functions r forwarding: move packets from router’s input to appropriate router output r routing: determine route taken by packets from source to dest. m Routing algorithms analogy: r routing: process of planning trip from source to dest r forwarding: process of getting through single interchange
4
Network Layer4-4 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet Protocol m Datagram format m IPv4 addressing m ICMP m IPv6 r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the Internet m RIP m OSPF m BGP r 4.7 Broadcast and multicast routing
5
Network Layer4-5 Switching networks r There should be transmission links to connect between network end systems. r Switches(or routers) help to reduce the number of transmission link when we construct a large network. switched networkpoint-to-point links (dedicated links)
6
Network Layer4-6 Switching technology r Circuit switching m Telephone networks r Packet switching m Computer networks
7
Network Layer4-7 Circuit switching network r Circuit switching creates a direct physical link(channel) between two terminals, and this physical link is used only by two terminals during connection time. r This physical channel between two devices is called a circuit.
8
Network Layer4-8 Packet Switching r Data to be sent is fragmented into pieces. Each fragmented piece is called packet. r The physical link is not dedicated to two stations, rather the link is shared with other stations. packet Physical link(channel)
9
Network Layer4-9 Two types of Packet Switching IP X.25 Frame Relay ATM
10
Network Layer4-10 Datagram r There is no established path that packets should follow between source and destination. r Thus, switches should decide the route(path) for each packet. r IP is based on datagram packet switching.
11
Network Layer4-11 Virtual Circuit Packet Switching r The path that all packet should follow between source and destination should be established before packets are transmitted. r Switches decide route(path) only one time at the path setup time.
12
Network Layer4-12 Virtual Circuit Packet Switching r The path established before data transmission is similar to a circuit in the circuit switching. But the link on the path is shared with many stations, not dedicated to a specific station. r That is why it is called virtual circuit switching.
13
Network Layer4-13 Routing in datagram r How can routers determine the path of packets to destinations? m Routers use the packet’s destination address to forward the packet. m Each router has a forwarding table that maps destination addresses to link interfaces at which the packet will be delivered to the next- hop router on the path to the destination.
14
Network Layer4-14 Routing Table r Mask r Destination address r next-hop address r flags m U(UP)- Router is operating now m G(gateway)- destination is in other network m H(host-specific) m D(added by redirection) m M(modified by redirection) r reference count: # of users to use this path r use: # of packets to pass through this router r interface
15
Network Layer4-15 Router Operation Receive an IP packet 1. For each entry in the routing table Apply the mask to packet destination address If (the result matches the value in the destination field) If (the G flag is absent) Use packet destination address as next hop address Send packet to fragmentation module with next hop address Return 2. If no match is found, send an ICMP error message 3. Return
16
Network Layer4-16 193.14.5.160 193.14.5.192 R1 111.0.0.0 R2 R3 R4 192.16.7.0 194.17.21.0 R5 m1m3 m0 default router 193.14.5.165 193.14.5.197 111.25.19.20 111.15.17.32 111.20.18.14 182.16.7.5 194.17.21.14 192.16.7.52 194.17.21.68 111.30.31.18 194.17.21.16
17
Network Layer4-17 Routing Table of R1
18
Network Layer4-18 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet Protocol m Datagram format m IPv4 addressing m ICMP m IPv6 r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the Internet m RIP m OSPF m BGP r 4.7 Broadcast and multicast routing
19
Network Layer4-19 The Internet Network layer forwarding table Host, router network layer functions: Routing protocols path selection RIP, OSPF, BGP IP protocol addressing conventions datagram format packet handling conventions ICMP protocol error reporting router “signaling” Transport layer: TCP, UDP Link layer physical layer Network layer
20
Network Layer4-20 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet Protocol m Datagram format m IPv4 addressing m ICMP m IPv6 r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the Internet m RIP m OSPF m BGP r 4.7 Broadcast and multicast routing
21
Network Layer4-21 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
22
Network Layer4-22 Header Fields(1) r version(4 bits) m The current IP is version 4. r head length (4 bits) m fixed part(20 bytes) + option (in 32-bit words) m Ex, fixed part = 5 (160 bits) r Type of services(TOS) or Differentiated services(DS) m Defines the class of datagram for quality of service. r total length (8 bits) m Header + data (unit: bytes) m Data 의 Size = TOTAL LENGTH - HLEN Maximum size of IP Datagram is 65,535 bytes long.
23
Network Layer4-23 Header Fields(2) r Identification (16 bits) m It identifies the datagram from a source. m Normally it is incremented by 1 every datagram. r Flags (3 bits) m Two flag bits are defined: “more fragmentation” 비트 “don’t fragment” 비트 r Fragmentation offset (13 bits)
24
Network Layer4-24 MTU and Fragmentation r Maximum Transmission Unit(MTU) m Each physical network has its own maximum length of data unit(PDU) it can process. Ex, Ethernet: 1518 bytes, ATM: 53 bytes m Thus the size of the IP datagram should not larger than MTU of the physical network it is passing through. r Fragmentation m If the datagram size is larger that MTU of the physical network, the datagram must be fragmented. Net 1 (MTU=1000) Net 2 (MTU=400) 1000 bytes
25
Network Layer4-25 DATA 1 DATA 2DATA 3 400 Octet 200 Octet DATA 1 DATA 2 DATA 3 Original datagram (1000 octets) Fragment offset = 0, More Fragment Bit = 1 Fragment offset = 400/8=50, More Fragment Bit = 1 Fragment offset = 800/8=100, More Fragment Bit = 0 Fragmentation 0 399 400799 800999
26
Network Layer4-26 Header Fields(3) r Time-to-live (8 bits) m It is used to control the max. # of hops(routers) visited by the datagram. m Normally it starts with 32 or 64. Each router that processes the datagram decrements this number by 1. m If the value reaches 0, the router discards this datagram. And the router sends the ICMP message to the source host. r Protocol (8 bits) m It defines the higher layer protocol that uses the services of the IP layer.
27
Network Layer4-27 Protocol Values 12 617 89
28
Network Layer4-28 Checksum r It is used for the error detection for the IP header. So the checksum covers only the header. r If the checksum is incorrect, the receiver discards this datagram. r Sender m packet is divided into k sections, each of n bits(16 bits) m all sections are added together using 1’s complement m the final result is complemented to make the checksum r Receiver m packet is divided into k sections, each of n bits m all sections are added together using 1’s complement m the result is complemented m If the final result is 0, then no error
29
Network Layer4-29 n bits all 0s n bits Section 1 Section 2 checksum Section n Sum checksum …. complement sender n bits All 0s? Section 1 Section 2 checksum Section n Sum checksum …. complement receiver n bits checksum packet
30
Network Layer4-30 Example
31
Network Layer4-31 Option r Options(variable) m It is used for testing and debugging. m The following fields are defined. Record route loose source routing strict source routing timestamp
32
Network Layer4-32 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet Protocol m Datagram format m IPv4 addressing m ICMP m IPv6 r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the Internet m RIP m OSPF m BGP r 4.7 Broadcast and multicast routing
33
Network Layer4-33 Addressing r Internet architecture r Classful addressing r Subnetting r Private addresses and NAT r Classless addressing
34
Network Layer4-34 Internet Architecture r The internet consists of many heterogeneous networks. m A network of networks r The Internet is a special internet which connects all networks based on the TCP/IP protocol. r In Internet, internetworking devices called routers(or gateways) provide interconnections among all networks.
35
Network Layer4-35 Net 1 Net 2Net 3 R1R2 Internet real structure router physical net host Internet as a universal network host user’s view Virtual, uniform one network
36
Network Layer4-36 IP address r IP addresses denote the connection(interface) to the Internet. m cf> telephone address, ethernet address r IP addresses are unique. m Each address defines only on connection to the Internet. r IP addresses are global(universal). m Any host connected to the Internet must use the same IP addressing scheme.
37
Network Layer4-37 IP address r An IP address is a 32 bits long. r It consists of two parts: net-id and host- id. Net idHost id 32 bits Denote a specific physical network In the Internet Denote a connection in a specific physical network
38
Network Layer4-38 Dotted decimal notation
39
Network Layer4-39 Types of IP addresses
40
Network Layer4-40 Range of Each Class
41
Network Layer4-41 Net-id and host-id of each class
42
Network Layer4-42 Network Address
43
Network Layer4-43 Sample Network
44
Network Layer4-44 Special IP addresses r 0’s mean “this”, 1’s mean “all” Limited broadcast( local net) 2 all 0s all 1s net host 127anything (often 1) This host 1 Host on this net 1 Directed broadcast for net 2 Loopback 3 Notes: 1 Allowed only at system startup(bootstrap) and is never a valid destination address. 2 Never a valid source address. 3 Should never appear on a network. Used in testing.
45
Network Layer4-45 Subnetting r IP address is designed with two levels of hierarchy: netid and hostid. r Sometimes the block of a network address assigned to an organization need to be divided for efficient routing, so that an organization has several subnetworks(subnets). r Subnetting provides a mean to have three levels of hierarchy.
46
Network Layer4-46 H1 128.10.1.1 H2 128.10.1.2 Network 128.10.1.0 H3 128.10.2.1 H4 128.10.2.2 Network 128.10.2.0 REST OF THE INTERNET all traffic to 128.10.X.X R All packets with 128.10.x.x are coming to this organization from outside.
47
Network Layer4-47 Address with subnet-id
48
Network Layer4-48 Subnet Mask r The subnet mask specifies how many bits in the host-id are assigned for subnet-id.
49
Network Layer4-49 Subnet Example Network ID Subnet ID Host ID 16 8 8 11111111 11111111 11111111 00000000 Network ID Subnet ID Host ID 16 10 6 11111111 11111111 11111111 11 000000 0xffffff00 = 255.255.255.0 0xffffffc0 = 255.255.255.192
50
Network Layer4-50 Private Address r The private addresses are not recognized in the global Internet. r IP private addresses can only be used in local networks. r The blocks of IP private addresses m 10.0.0.0 ~ 10.255.255.255 m 172.16.0.0 ~ 172.31.255.255 m 192.168.0.0 ~ 192.168.255.255 r The local sites with private addresses can be connected to the global Internet through NAT.
51
Network Layer4-51 NAT: Network Address Translation r Motivation: local network uses just one IP address as far as outside word is concerned: m no need to be allocated range of addresses from ISP: - just one IP address is used for all devices m can change addresses of devices in local network without notifying outside world m can change ISP without changing addresses of devices in local network m devices inside local net not explicitly addressable, visible by outside world (a security plus).
52
Network Layer4-52 Network Address Translation(NAT)
53
Network Layer4-53
54
Network Layer4-54 Translation Table r How does a NAT router know the destination address for a packet coming from the outside? m For many-to-many relation between the private address network and global Internet servers, we need the following translation table. Private Address Private Port External Address External Port Transport Protocol 172.18.3.1140025.8.3.280TCP 172.18.3.2140125.8.3.280TCP...
55
Network Layer4-55 Classless Interdomain Routing(CIDR) r Classful address m IP addresses have three classes depending on the leftmost bit(s). m So the length of the net-id has fixed depending on the classes. r Classless address m IP addresses has no classes. The length of net-id is variable. m The length of net-id is specified for each IP address. m CIDR uses classless address.
56
Network Layer4-56 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 subnet part host part 200.23.16.0/23
57
Network Layer4-57 CIDR notation r In CIDR, an IP address is expressed as: m Network address/length Ex) 234.170.168.0/21 –(234.170.168.0, 234.170.175.255) block Dotted decimal32-bit binary equivalent lowest 234.170.168.0 11101010 10101010 10101000 00000000 highest 234.170.175.255 11101010 10101010 10101111 11111111 CIDR mask 11111111 11111111 11111000 00000000
58
Network Layer4-58 Ex) 198.32.0.0/16 (198.32.0.0, 198.32.255.255) block lowest 198.32.0.0 11000110 00100000 00000000 00000000 Highest 198.32.255.255 11000110 00100000 11111111 11111111
59
Network Layer4-59 An ISP has the address block of 206.0.64.0/18 (64/24s). If a customer requests 800 IP addresses, then the ISP can assign the address block of 206.0.68.0/22 (4 contiguous/24s) to the customer. What is the advantage of using CIDR comparing with the case of assigning one class B address or 4 class C addresses? ISP’s block 11001110.00000000.01000000.00000000 206.0.64.0/18 client’s block 11001110.00000000.01000100.00000000 206.0.68.0/22 Class C(0) 11001110.00000000.01000100.00000000 206.0.68.0/24 Class C(1) 11001110.00000000.01000101.00000000 206.0.69.0/24 Class C(2) 11001110.00000000.01000110.00000000 206.0.70.0/24 Class C(3) 11001110.00000000.01000111.00000000 206.0.71.0/24 Example
60
Network Layer4-60 IP addresses: how to get one? Q: How does host get IP address? r hard-coded by system admin in a file m Wintel: control-panel->network->configuration- >tcp/ip->properties m UNIX: /etc/rc.config r DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server m “plug-and-play” (more in next chapter)
61
Network Layer4-61 IP addresses: how to get one? Q: How does network get subnet part of IP addr? A: gets allocated portion of its provider ISP’s address space ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20 Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23 Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23... ….. …. …. Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23
62
Network Layer4-62 IP addressing: the last word... Q: How does an ISP get block of addresses? A: ICANN: Internet Corporation for Assigned Names and Numbers m allocates addresses m manages DNS m assigns domain names, resolves disputes
63
Network Layer4-63 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet Protocol m Datagram format m IPv4 addressing m ICMP m IPv6 r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the Internet m RIP m OSPF m BGP r 4.7 Broadcast and multicast routing
64
Network Layer4-64 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
65
Network Layer4-65 Error Reporting messages(1)
66
Network Layer4-66 Error Reporting messages(2) r Destination Unreachable m When a router or host can’t route a datagram, it discards the datagram and sends a destination unreachable message to the source. r Source quench m When a router or host discards datagrams due to congestion, It sends a source quench message to the source.
67
Network Layer4-67 Error Reporting messages(3) r Time exceeded m When TTL value is 0, a router discards the datagram and send a Time exceeded message the original source host. m When all fragmented datagrams of one datagram do not arrive at the destination within a certain time limit, this message is generated. r Parameter problem m When any ambiguous or missing values in the header of the datagram are detected,
68
Network Layer4-68 Error Reporting messages(4) r Redirection m The host may send a datagram which is destined for a wrong router because of its old routing table. In this case the router will forward this datagram to the correct router and at the same time it sends a redirection message back to the host.
69
Network Layer4-69 Query Messages(1)
70
Network Layer4-70 Query Messages(2) r Error Request and Reply m Used for diagnostic purpose r Time stamp Request and Reply m When routers or hosts determine the round- trip time needed for a datagram to travel between them r Address Mask Request and Reply m When a host want to know the subnet mask of the network it belongs to
71
Network Layer4-71 Query Messages(3) r Router Solicitation and Advertisement m When a host want to know a default router, it broadcasts a router solicitation message. m A router can send a router advertisement message periodically even if no host has solicited.
72
Network Layer4-72 ICMP message encapsulation
73
Network Layer4-73 Example of ICMP Use r Ping r Traceroute r MTU discovery
74
Network Layer4-74 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.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.