Upload
adonis-usher
View
216
Download
2
Embed Size (px)
Citation preview
Jump to first page
1
University of British Columbia
CICS 515 (Part 2)CICS 515 (Part 2) Computer NetworksLecture 5 – IP (Ch 4)
Instructor: Dr. Son T. VuongEmail: [email protected]
The World Connected
CICS515 Summer 2012 Instructor: Dr. Son Vuong 2
Ch 4: Network Layer and Routing The IP Protocol
IP Format, Addressing, fragmentation, Internet Control Protocols (ICMP) (next lecture)
Routing RIP (Routing Information Protocol) OSPF (Open Shortest Path First) The Interior Gateway Routing Protocol BGP – The Exterior Gateway Routing Protocol
IPv6 Internet Multicasting Mobile IP
CICS515 Summer 2012 Instructor: Dr. Son Vuong 3
ISO Architecture
Application
Presentation
Session
Transport
End host
One or more nodes
within the network
Network
Data link
Physical
Network
Data link
Physical
Network
Data link
Physical
Application
Presentation
Session
Transport
End host
Network
Data link
Physical
IP
CICS515 Summer 2012 Instructor: Dr. Son Vuong 4
Internet Architecture
Defined by Internet Engineering Task Force (IETF) Hourglass Design Application vs Application Protocol (FTP, HTTP)
…
FTP HTTP NV TFTP
TCP UDP
IP
NET1 NET2 NETn
TCP UDP
IP
Network
Application
CICS515 Summer 2012 Instructor: Dr. Son Vuong 5
Design Principles for Internet Make sure it works. Keep it simple. Make clear choices. Exploit modularity. Expect heterogeneity. Avoid static options and parameters. Look for a good design; it need not be perfect. Be strict when sending and tolerant when
receiving. Think about scalability. Consider performance and cost.
CICS515 Summer 2012 Instructor: Dr. Son Vuong 6
Collection of Subnetworks
The Internet = interconnected collection of many networks.
CICS515 Summer 2012 Instructor: Dr. Son Vuong 7
Example TCP/IP internet
R1
ETH FDDI
IPIP
ETH
TCP R2
FDDI PPP
IP
R3
PPP ETH
H1
IP
ETH
TCP
H8
R2
R1
H4
H5
H3H2H1
Network 2 (Ethernet)
Network 1 (Ethernet)
H6
Network 3 (FDDI)
Network 4(point-to-point)
H7 R3 H8
IP
CICS515 Summer 2012 Instructor: Dr. Son Vuong 8
IP Service Model Packet Delivery Model
Connectionless (datagram-based) Best-effort delivery (unreliable service)
Loss, out-of-order, duplication long, variable delay
Global Addressing Scheme IP Addresses Routing info provided within header, no set up
phase.
IP runs over any Layer 2/3 network Ethernet, FDDI, ATM, Point to Point, etc.
CICS515 Summer 2012 Instructor: Dr. Son Vuong 9
IP Packet Format
V ersion HLen TOS Length
Ident Flags Offset
TTL Protocol Checksum
DestinationIPAddr
Options (variable)Pad
(variable)
0 4 8 16 19 31
Data
SourceIPAddr
CICS515 Summer 2012 Instructor: Dr. Son Vuong 10
The IP Protocol (2)
Some of the IP options.
5-54
CICS515 Summer 2012 Instructor: Dr. Son Vuong 11
IP Packet Details Datagram format
Version (4) - Currently set to 4 (IPv4). We’ll discuss IPv6.
Hlen (4) - Number of 32-bit words in the header (allows for a variable number of options)
TOS (8) - Type of service (not widely used) Length (16) - Number of bytes in this datagram -
Maximum size is 64KB. Ident (16) - Used for fragmentation Flags(3)/Offset(13) (16) - Used for
fragmentation (offset in units of 8 bytes)
CICS515 Summer 2012 Instructor: Dr. Son Vuong 12
IP Packet Details cont.
TTL (8) - Number of hops this datagram can travel (defaults to 64). Originally was intended to count seconds, but impossible without a central clock.
Protocol (8) - Demultiplexing key for higher level protocols (TCP=6, UDP=17)
Checksum (16) - Of the header only, using Internet Checksum method (as in UDP and TCP)
DestAddr & SrcAddr (32) - See later. Options, e.g. timestamp, record route, (strict/loose)
source routing
CICS515 Summer 2012 Instructor: Dr. Son Vuong 13
Fragmentation and Reassembly Each Layer 2/3 network has a Maximum
Transmission Unit (MTU) e.g. Ethernet is 1500, FDDI is 4500
Unreasonable to make all IP packets small enough to fit within all possible MTUs.
Strategy Fragment only when necessary (MTU < Datagram) Try to avoid fragmentation at source host Fragments are self-contained IP datagrams Reassembly of fragments at destination host.
CICS515 Summer 2012 Instructor: Dr. Son Vuong 14
Fragmentation Example
H1 R1 R2 R3 H8
ETH IP (1400) FDDI IP (1400) PPP IP (512)
PPP IP (376)
PPP IP (512)
ETH IP (512)
ETH IP (376)
ETH IP (512)
CICS515 Summer 2012 Instructor: Dr. Son Vuong 15
Fragmentation cont.
If one fragment is lost, discard all other fragments. Higher layers will recover.
The IP header has fields for handling this type of fragmentation. Set the M bit (in flags) to indicate that more
data is coming. Set the offset to indicate where each of the
fragmented blocks starts. Set the ident field to identify related packets.
CICS515 Summer 2012 Instructor: Dr. Son Vuong 16
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 becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =1480/8
length = 4000 – 2*1480 = 4000 - 2960 = 1040
CICS515 Summer 2012 Instructor: Dr. Son Vuong 17
IP Fragmentation– Peer Instruction – Question 5.1
A 1300-byte IP datagram sent through a network with 500-byte MTU must be fragmented into 3 fragments with the following respective <length, offset> values in the header:
A. <500, 0>, <500, 460>, <500, 920> B. <500, 0>, <500, 480>, <300, 960>. C. <500, 0>, <500, 500, <300, 1000> D. <500, 0>, <500, 60>, <340, 120> E. None of the above
CICS515 Summer 2012 Instructor: Dr. Son Vuong 18
Global Addresses Properties of IP addresses.
Globally unique - No confusion about where to send a packet.
Hierarchical - Network component and host number.
Normally written in “Dot notation” (4 byte values, total 32 bits) 10.3.2.4 128.96.33.81 192.12.69.77 142.103.7.7 (cascade.cs.ubc.ca)
CICS515 Summer 2012 Instructor: Dr. Son Vuong 19
IP Addresses
IP address formats.
CICS515 Summer 2012 Instructor: Dr. Son Vuong 20
Address Notation
Binary 11000000 00000101 00110000 00000011
Hex Colon C0:05:30:03
Dotted Decimal 192.5.48.3
CICS515 Summer 2012 Instructor: Dr. Son Vuong 21
Class Ranges
Dotted Decimal w.x.y.z Class A: w= 0 thru 127 Class B: w= 128 thru 191 Class C: w= 192 thru 223 Class D: w= 224 thru 239 Class E: w= 240 thru 255
CICS515 Summer 2012 Instructor: Dr. Son Vuong 22
Class Formats Class A: 128 Networks, 16777216 hosts each Class B: 16384 Networks, 65536 hosts each Class C: 2097152 Networks, 256 hosts each
The plan was to give each organization (company or university) a network number that is appropriate for their size, and let them allocate host numbers.
Example: UBC has several class B and C addresses. E.g. 142.103.7.7 and 198.162.33.12
In reality, variations on this method are used.
CICS515 Summer 2012 Instructor: Dr. Son Vuong 23
IP Addresses (2)
Special IP addresses.
CICS515 Summer 2012 Instructor: Dr. Son Vuong 24
Subnets
A campus network consisting of LANs for various departments.
CICS515 Summer 2012 Instructor: Dr. Son Vuong 25
Subnets (2)
A class B network subnetted into 64 subnets.
CICS515 Summer 2012 Instructor: Dr. Son Vuong 26
CIDR – Classless InterDomain Routing
A set of IP address assignments
address format: a.b.c.d/x subnet portion of arbitrary length x
11001000 00010111 00010000 00000000
subnetpart
hostpart
200.23.16.0/23
CICS515 Summer 2012 Instructor: Dr. Son Vuong 27
NAT – Network Address Translation
Placement and operation of a NAT box.
CICS515 Summer 2012 Instructor: Dr. Son Vuong 28
Datagram Forwarding Using these IP address, how do we route
messages? Strategy
every datagram contains destination's address if directly connected to destination network, then
forward to host if not directly connected to destination network, then
forward to some router forwarding table maps network number into next hop each host has a default router each router maintains a forwarding table
A forwarding table maps network numbers into router addresses.
CICS515 Summer 2012 Instructor: Dr. Son Vuong 29
Example: Forwarding Table for R2
Network
1234
Next Hop
R3R1interface 1interface 0
For Router R2
R2
R1
H4
H5
H3H2H1
Network 2 (Ethernet)
Network 1 (Ethernet)
H6
Network 3 (FDDI)
Network 4(point-to-point)
H7 R3 H8
CICS515 Summer 2012 Instructor: Dr. Son Vuong 30
Examples
Sending from H1 to H2: Same network, so send an Ethernet frame to
the Ethernet address for H2
Sending from H1 to H8: Send an Ethernet frame from H1 to R1 Send an FDDI packet from R1 to R2 Send a point to point message from R2 to R3 Send an Ethernet frame from R3 to H8
CICS515 Summer 2012 Instructor: Dr. Son Vuong 31
Scalability In reality, it’s not possible to list an appropriate
router for every network on the internet. The table will get too big.
Commonly we’ll have a list of well-known networks, but use a default router for all other networks.
For example: Network 3 could get to Network 2 via R1, and will use R2 for all other networks.
Sometimes, we only have a single default router on each network.
CICS515 Summer 2012 Instructor: Dr. Son Vuong 32
Internet Control Message Protocol (ICMP) If something goes wrong with an IP packet, a
control message is sent back to the sender: Echo (ping) Request/Reply Timestamp Request/Reply Redirect (from router to source host) Source quench Destination unreachable (protocol, port, or host) TTL exceeded (so datagrams don't cycle forever) Checksum failed Reassembly failed Cannot fragment
CICS515 Summer 2012 Instructor: Dr. Son Vuong 33
Summary - What have we covered?
internetworks IP (Layer 3.5) packets and fragmentation addressing and address classes packet forwarding ICMP