Download presentation
Presentation is loading. Please wait.
Published byTero Jääskeläinen Modified over 6 years ago
1
Chapter 4 Network Layer Computer Networking: A Top Down Approach 6th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you see the animations; and can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: If you use these slides (e.g., in a class) that you mention their source (after all, we’d like people to use our book!) If you post any slides on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Thanks and enjoy! JFK/KWR All material copyright J.F Kurose and K.W. Ross, All Rights Reserved Network Layer
2
Network layer transport segment from sending to receiving host
on sending side encapsulates segments into datagrams on receiving side, delivers segments to transport layer network layer protocols in every host, router router examines header fields in all IP datagrams passing through it application transport network data link physical network data link physical application transport network data link physical Network Layer
3
Two key network-layer functions
forwarding: move packets from router’s input to appropriate router output routing: determine route taken by packets from source to dest. routing algorithms analogy: routing: process of planning trip from source to dest forwarding: process of getting through single interchange Network Layer
4
Interplay between routing and forwarding
1 2 3 0111 value in arriving packet’s header routing algorithm local forwarding table header value output link 0100 0101 1001 routing algorithm determines end-end-path through network forwarding table determines local forwarding at this router Network Layer
5
Datagram networks no call setup at network layer
routers: no state about end-to-end connections no network-level concept of “connection” packets forwarded using destination host address application transport network data link physical application transport network data link physical 1. send datagrams 2. receive datagrams Network Layer
6
Datagram forwarding table
4 billion IP addresses, so rather than list individual destination address list range of addresses (aggregate table entries) routing algorithm local forwarding table dest address output link address-range 1 address-range 2 address-range 3 address-range 4 3 2 1 IP destination address in arriving packet’s header 1 2 3 Network Layer
7
Datagram forwarding table
Destination Address Range through otherwise Link Interface 1 2 3 Q: but what happens if ranges don’t divide up so nicely? Network Layer
8
Longest prefix matching
when looking for forwarding table entry for given destination address, use longest address prefix that matches destination address. Destination Address Range *** ********* ********* *** ********* otherwise Link interface 1 2 3 examples: DA: which interface? DA: which interface? Network Layer
9
Router architecture overview
two key router functions: run routing algorithms/protocol (RIP, OSPF, BGP) forwarding datagrams from incoming to outgoing link forwarding tables computed, pushed to input ports routing processor routing, management control plane (software) forwarding data plane (hardware) high-seed switching fabric router input ports router output ports Network Layer
10
Input port functions decentralized switching:
lookup, forwarding queueing line termination link layer protocol (receive) switch fabric physical layer: bit-level reception data link layer: e.g., Ethernet see chapter 5 decentralized switching: given datagram dest., lookup output port using forwarding table in input port memory (“match plus action”) goal: complete input port processing at ‘line speed’ queuing: if datagrams arrive faster than forwarding rate into switch fabric Network Layer
11
Switching fabrics transfer packet from input buffer to appropriate output buffer switching rate: rate at which packets can be transfer from inputs to outputs often measured as multiple of input/output line rate N inputs: switching rate N times line rate desirable three types of switching fabrics memory memory bus crossbar Network Layer
12
Switching via memory first generation routers:
traditional computers with switching under direct control of CPU packet copied to system’s memory speed limited by memory bandwidth (2 bus crossings per datagram) input port (e.g., Ethernet) memory output system bus Network Layer
13
Switching via a bus datagram from input port memory
to output port memory via a shared bus bus contention: switching speed limited by bus bandwidth 32 Gbps bus, Cisco 5600: sufficient speed for access and enterprise routers bus Network Layer
14
Switching via interconnection network
overcome bus bandwidth limitations banyan networks, crossbar, other interconnection nets initially developed to connect processors in multiprocessor advanced design: fragmenting datagram into fixed length cells, switch cells through the fabric. Cisco 12000: switches 60 Gbps through the interconnection network crossbar Network Layer
15
Output ports datagram buffer queueing switch fabric link layer protocol (send) line termination buffering required when datagrams arrive from fabric faster than the transmission rate scheduling discipline chooses among queued datagrams for transmission Network Layer
16
Output port queueing at t, packets more from input to output one packet time later switch fabric buffering when arrival rate via switch exceeds output line speed queueing (delay) and loss due to output port buffer overflow! Network Layer
17
Input port queuing fabric slower than input ports combined -> queueing may occur at input queues queueing delay and loss due to input buffer overflow! Head-of-the-Line (HOL) blocking: queued datagram at front of queue prevents others in queue from moving forward one packet time later: green packet experiences HOL blocking switch fabric switch fabric output port contention: only one red datagram can be transferred. lower red packet is blocked Network Layer
18
The Internet network layer
host, router network layer functions: transport layer: TCP, UDP IP protocol addressing conventions datagram format packet handling conventions routing protocols path selection RIP, OSPF, BGP network layer forwarding table ICMP protocol error reporting router “signaling” link layer physical layer Network Layer
19
32 bit destination IP address
IP datagram format IP protocol version number 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) total datagram length (bytes) header length (bytes) “type” of data for fragmentation/ reassembly max number remaining hops (decremented at each router) upper layer protocol to deliver payload to e.g. timestamp, record route taken, specify list of routers to visit. how much overhead? 20 bytes of TCP 20 bytes of IP = 40 bytes + app layer overhead Network Layer
20
IP fragmentation, reassembly
network links have MTU (max.transfer size) - largest possible link-level frame different link types, different MTUs large IP datagram divided (“fragmented”) within net one datagram becomes several datagrams “reassembled” only at final destination IP header bits used to identify, order related fragments … fragmentation: in: one large datagram out: 3 smaller datagrams reassembly … Network Layer
21
IP fragmentation, reassembly
ID =x offset =0 fragflag length =4000 example: 4000 byte datagram MTU = 1500 bytes ID =x offset =0 fragflag =1 length =1500 =185 =370 =1040 one large datagram becomes several smaller datagrams 1480 bytes in data field offset = 1480/8 Network Layer
22
IP addressing: introduction
IP address: 32-bit identifier for host, router interface interface: connection between host/router and physical link router’s typically have multiple interfaces host typically has one or two interfaces (e.g., wired Ethernet, wireless ) IP addresses associated with each interface = 223 1 1 1 Network Layer
23
IP address format The 32-bit IP address is broken up into 4 octets, which are arranged into a dotted-decimal notation scheme. An octet is a set of 8 bits & not a musical instrument. Example of an IP version 4: Network Layer
24
Decimal to binary conversion
27 26 25 24 23 22 21 20 1 128 64 32 16 8 4 2 The binary number converts into the decimal number: = 255 The largest decimal number that can be stored in an IP address octet is 255 Network Layer
25
IP address classes Class Leftmost bits Start address Finish address A
0xxx B 10xx C 110x D 1110 E 1111 Class D addresses are used for multicasting and class E addresses Reserved for experimental uses Network Layer
26
Network & Host Representation
Network and host parts The 32 bits of the IP address are divided into Network & Host portions, with the octets assigned as a part of one or the other. Network & Host Representation By IP Address Class Class Octet1 Octet2 Octet3 Octet4 Class A Network Host Class B Class C Network Layer
27
Network mask Class A, 255.0.0.0 Class B, 255.255.0.0
Class C, An AND of an IP address with the network mask results into the network address Network Layer
28
Special addresses Network address Host address Description Example 0’s
Default Cisco Route 1’s Broadcast to local network N/W address Broadcast to N/W address 127 Any Loopback testing Network Layer
29
Private addresses Class Private start address Private last address A
B C Private addresses can be freely used on networks which are not Connected to the Internet or they are behind Gateways or Firewalls That use NAT(Network Address Translation) Network Layer
30
IP addresses: how to get one?
Q: How does a host get IP address? hard-coded by system admin in a file Windows: control-panel->network->configuration->tcp/ip->properties UNIX: /etc/rc.config DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server “plug-and-play” Network Layer
31
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/“on”) support for mobile users who want to join network (more shortly) DHCP overview: host broadcasts “DHCP discover” msg [optional] DHCP server responds with “DHCP offer” msg [optional] host requests IP address: “DHCP request” msg DHCP server sends address: “DHCP ack” msg Network Layer
32
DHCP client-server scenario
DHCP server: DHCP discover src : , 68 dest.: ,67 yiaddr: transaction ID: 654 arriving client DHCP offer src: , 67 dest: , 68 yiaddrr: transaction ID: 654 lifetime: 3600 secs DHCP request src: , 68 dest:: , 67 yiaddrr: transaction ID: 655 lifetime: 3600 secs DHCP ACK src: , 67 dest: , 68 yiaddrr: transaction ID: 655 lifetime: 3600 secs Network Layer
33
IP addressing: the last word...
Q: how does an ISP get block of addresses? A: ICANN: Internet Corporation for Assigned Names and Numbers allocates addresses manages DNS assigns domain names, resolves disputes Network Layer
34
NAT: network address translation
rest of Internet local network (e.g., home network) 10.0.0/24 all datagrams leaving local network have same single source NAT IP address: ,different source port numbers datagrams with source or destination in this network have /24 address for source, destination (as usual) Network Layer
35
NAT: network address translation
motivation: local network uses just one IP address as far as outside world is concerned: range of addresses not needed from ISP: just one IP address for all devices can change addresses of devices in local network without notifying outside world can change ISP without changing addresses of devices in local network devices inside local net not explicitly addressable, visible by outside world (a security plus) Network Layer
36
NAT: network address translation
implementation: NAT router must: 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 remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair 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 Network Layer
37
NAT: network address translation
NAT translation table WAN side addr LAN side addr 1: host sends datagram to , 80 2: NAT router changes datagram source addr from , 3345 to , 5001, updates table , , 3345 …… …… S: , 3345 D: , 80 1 S: , 80 D: , 3345 4 S: , 5001 D: , 80 2 S: , 80 D: , 5001 3 4: NAT router changes datagram dest addr from , 5001 to , 3345 3: reply arrives dest. address: , 5001 Network Layer
38
NAT: network address translation
16-bit port-number field: 60,000 simultaneous connections with a single LAN-side address! NAT is controversial: routers should only process up to layer 3 violates end-to-end argument NAT possibility must be taken into account by app designers, e.g., P2P applications address shortage should instead be solved by IPv6 Network Layer
39
Subnetting Enables to divide one physical network into several logically divided sub-networks Smaller broadcast domain Traffic reduction Security Network Layer
40
A network with two levels of hierarchy (not subnetted)
Network Layer
41
A network with three levels of hierarchy (subnetted)
Network Layer
42
Addresses in a network with and without subnetting
Network Layer
43
Default mask and subnet mask
Network Layer
44
Finding the Subnet Address
Given an IP address, the subnet address can be found in the same way as for the network address Apply the AND operation to the binary of IP address and the subnet mask Network Layer
45
Example What is the subnetwork address if the host address is and the subnet mask is ? 1 Hence the subnet address is Network Layer
46
Creating the subnets Class B add. 0 subnet Subnet 1 Subnet 2 ….
Broadcast subnet 172. 16. 0. 1 Number of subnets=2Number of subnet bits-2 Subnet 0 and the broadcast subnets should not be used Network Layer
47
Valid IP address in subnet 1
1st IP 2nd IP …. Last IP Bcast IP 1 . # valid IP addresses or # hosts=2Number of host bits - 2 In dotted decimal 1st IP 2nd IP Last IP Broadcast IP Network Layer
48
Example Subnet the class C IP, , using three bits from the host part subnet mask Network Layer
49
Example 1st Subnet Usable subnets Last Subnet Write the valid IP address of subnet 2 Network Layer
50
Solution Conversion from binary to decimal
Subnet number is First address: Broadcast address: (turn all the host bits into 1) Last address: (subtract 1 from the broadcast address) Other addresses are in the range from 1st to last Network Layer
51
Prefix notation Subnet masks have consecutive numbers of 1s
= Can be written as /16 Means that the first 16 bits represent the network part Example, /27 has a 27 bits prefix Network Layer
52
Finding the subnet number
Given a subnetted IP address, /27, find the subnet number, and range of IP addresses in the subnet Conversion into binary, AND operation Can we do it without using binary conversion? Network Layer
53
Finding the subnet number
Find the magic number MN=256 – value of the mask’s interesting octet MN= =32 Find the closest multiple to MN that is not greater than the address’ interesting octet (i.e. 70) 32*2=64 put this value in the interesting octet i.e (subnet number) The first address: Network Layer
54
Finding the broadcast address
Use the magic number again The broadcast address= MN+ Subnet number-1 MN+ Subnet number-1= = 95 The broadcast address= The range of valid IP addresses: to Network Layer
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.