CSE 5348 / 7348 Instructor: Internetworking Protocols and Programming Anil Gurijala

Download Report

Transcript CSE 5348 / 7348 Instructor: Internetworking Protocols and Programming Anil Gurijala

Internetworking Protocols and Programming
CSE 5348 / 7348
Instructor: Anil Gurijala
Session 4: Ch. 10, 11 & 12
Application
15
16
Presentation
255.255.255.0
Session
0
Transport
Network
Data Link
Physical
5/27/2016
Southern Methodist University
16-bit source
port number
16-bit UDP length
16-bit destination
port number
16-bit UDP checksum
Data (if any)
1
3
1
Topics
• Classless and Subnet Address Extensions
– Transparent Routers
– Proxy ARP
– Subnet Addressing
– Classless Addressing or Supernetting
• Protocol Layering
• User Datagram Protocol
• 1st Mid Term details
5/27/2016
Southern Methodist University
2
Classful Internet Addressing Revisited
• The Internet is built up of an interconnection of Physical networks
• Each Physical network is identified by a unique Network ID
• Each host has a unique Host ID
• The internet address is a concatenation of the network ID and the Host ID
• IP addresses are broken down into classes to define the boundary between the
two fields
8
0
Class B
1 0
Class C
1 1 0
Class D
1 1 1 0
Class E
1 1 1 1 0
5/27/2016
hostid – 24 bits
netid – 8 bits
Class A
32
24
16
netid – 16 bits
hostid – 16 bits
hostid – 8 bits
netid – 24 bits
multicast group id
reserved for future use
Southern Methodist University
3
Extending the network
•Reality:
 The mix of hosts and networks is very site specific
 The organization usually tries to get enough network IDs to structure its
network
 Blocks of addresses allocated to organizations may not be properly utilized
4294697296 addresses should have been sufficient but is rapidly getting
depleted
5/27/2016
Southern Methodist University
4
Extending the Network
• Routing Table entries explode as more Network IDs are deployed
• Search for schemes where network prefix usage can be minimized
• Lesser number of networks to manage results in
 Smaller routing tables in Routers
 Lesser lookup times
 Lesser traffic due to routing information exchanges between routers
• Techniques
• Use of Transparent Routers to extend the address space.
• Use of Proxy ARP to extend the network
• Standardized Subnet addressing for extending networks
• Unnumbered interfaces for extending network connectivity
• Classless Addressing and Classless Inter domain Routing (CIDR)
5/27/2016
Southern Methodist University
5
IPv4 Address Exhaustion
Irrespective of all these improvements,
Complete Exhaustion of all available IPv4 Address Space:
October 2022
Exhaustion of the IPv4 Unallocated Address Pool
April 2013
Ref: http://bgp.potaroo.net/ipv4/
5/27/2016
Southern Methodist University
6
Transparent Routers
PSN
Wide Area
Network
TR
H1
H2
H3
• A Transparent Router helps extend WAN without adding new network
prefixes
• Several LANs can be connected to the WAN by interpreting the bytes in
the IP address
• Router demultiplexes packets arriving on its input to various hosts in the
local area network
• Router forwards all packets from the Hosts to the WAN
• Such routers are silent and do not respond to ICMP echo requests
5/27/2016
Southern Methodist University
7
Transparent Routers
• ARPANET was established in 1969 interconnecting Stanford, UCLA, and
University of Utah
• Early implementations used Packet Switched Nodes (PSN) to build the
WAN
• Transparent Routers were connected to a specific numbered port on the
PSN
• Hosts behind the Transparent Router were then numbered uniquely
• ARPANET address took the format 10.p.u.i (since it was a 10 net)
• “p” stood for Port number and “i” indicated the destination PSN
• “u” is left uninterpreted for the Transparent Router to demux on
• Example:
10.2.3.56 and 10.2.7.56 indicated two hosts behind the same
transparent router connected to port 2 of PSN 56
5/27/2016
Southern Methodist University
8
Transparent Routers
• Advantages
– Fewer network addresses
– Supports load balancing.
• Disadvantages
– Works better with Class A
– Not all the services, available at the regular routers,
available here.
5/27/2016
Southern Methodist University
9
Proxy ARP
H1
H2
H3
Router running
Proxy ARP
Main Network
R
Hidden Network
H4
H5
H6
• Router provides MAC resolution of hosts communicating across it
• ARP requests/reply and Gratuitous ARPs affect each interface on the
router as in the normal case
• H1 attempts to communicate with H4 and send ARP request
• Router R responds on behalf of H4 and accepts packets from H1
• Router R uses its ARP cache to forward packet to H4
5/27/2016
Southern Methodist University
10
Proxy ARP
• Advantages
– Completely transparent. No other routers on the
network need to be modified.
• Disadvantages
– It only works for ARP based networks.
– Does not work for complex networks. E.g. multiple
routers connected between two networks.
– Most implementations require manual provisioning of
routers.
5/27/2016
Southern Methodist University
11
Subnet Addressing or Subnetting
• Alllows a single network address to span multiple
physical networks.
• Most widely used scheme.
• Required part of IP addressing.
• Outside the Autonomous System, there is only one
IP address. But, within the Autonomous System,
multiple networks.
128.10.1.1
128.10.1.2
128.10.1.0
H1
Rest of
the
Internet
5/27/2016
All traffic to
128.10.0.0
R
H2
128.10.2.1
128.10.2.2
H3
H4
128.10.2.0
Southern Methodist University
12
Subnet Addressing
Internet Part
Local Part
Physical Network
Host
• The allocated block can be further split up into smaller networks defined by
a narrower subnet mask
• The Host portion may be further broken down into smaller subnets
• This results in a Hierarchical addressing scheme
• Routers at the highest level look at the first few bytes, the next level uses
more octets and so on
• Generally a site arbitrarily fixes a subnet mask depending on their
network/host ratio
• The Router lowest in the hierarchy uses direct delivery to deliver to the host
5/27/2016
Southern Methodist University
13
Subnet Mask Representation
• Subnet masks are written in dotted decimal form
• generally of the form 255.255.248.0, 255.255.0.0, etc.
• Standards do not state that all ones and zeroes should be
contiguous
• Subnet mask is always chosen with contiguous ones for ease of
implementation
• Subnet Address and mask can also be represented as
{ <network number>, <subnet number>, <host number>}
5/27/2016
Southern Methodist University
14
Subnet Mask Representation
• The number 255 is written as -1
• 255.255.0.0 for Class B is represented as { -1, -1, 0}
• {128.10, -1, 0 } means a network number of 128.10.0.0 with a
subnet mask of 255.255.0.0
• This notation is not popularly used since it is not clear how
many bits are used in each field of the notation
• Number of bits depend on the class of the address being
represented
5/27/2016
Southern Methodist University
15
Variable Length Subnet Masking
• Sites may select to have Physical networks of differing sizes
• Implies the use of different subnet masks at the same site
• The standard refers to this as Variable Length Subnetting
• All machines on that network should adhere to the subnet mask
established for that network
• Variable length subnet masking is possible because routing
protocols advertise each route accompanied by a mask
• A routing hierarchy can be established within the topology to
interconnect various types of networks
5/27/2016
Southern Methodist University
16
Datagram Routing
• The simple next hop routing will have to be modified to
accommodate variable subnet masking
• Standard routing algorithm searches routing table for entry that
matches destination Network
• The routing table entry has address of next hop router
• The router is able to compute network ID by simply looking at
the class of the destination IP address
• With sub netting the mask can be anything smaller than the
natural subnet mask
• Therefore Routing table should have a new field for each entry
which is the subnet mask
(subnet mask, network address, next hop address)
5/27/2016
Southern Methodist University
17
128.128.0.16
255.255.255.240
14 IP Addresses
R
R
Ethernet
Ethernet
128.128.50.0
255.255.255.0
Token Ring
128.128.33.0
255.255.255.0
PPP link
R
128.128.34.0
255.255.255.0
128.128.18.0
255.255.255.0
128.128.0.4
PPP link
255.255.255.252
128.128.0.8
255.255.255.252
128.128.0.12
255.255.255.252
R
128.128.49.0
255.255.255.0
128.128.17.0
255.255.255.0
Typical Topology
2 IP Addresses
R
Can be set up as anonymous Point to Point Networks
5/27/2016
Southern Methodist University
18
A Routing Algorithm
Interrupt from
packet
Id = destination IP
handler
address
Router has maxint interfaces each with IP address and subnet mask
= ip[n], sn[n]
index=0
temp1 = Id & sn[index]
temp2 = ip[index] & sn[index]
no
temp1 = temp2 ?
no
index++
index = maxint ?
yes
Go to “A”
yes
Forward packet
through direct delivery
Wait for next packet
5/27/2016
Southern Methodist University
19
A Routing Algorithm
A
Routing Table is of the form:
Id = destination IP
address
Entry[n] = [ netid[n], subnetmask[n], nexthop[n] ]
maxlen = current maximum length of the routing table
index=0
temp = Id & subnetmask[index]
no
temp = netid[index] ?
no
index++
yes
yes
Forward packet to
nexthop[index]
5/27/2016
index = maxlen
Generate destination
unreachable ICMP
message
Wait for next
packet
Southern Methodist University
20
Anonymous Point-To-Point Networks
• Certain topologies use special transport technologies to
interconnect physical networks together
• It is common practice to connect two geographically distant
routers using leased digital lines ( T1 rates)
• Since there are no ambiguities in the next hop, point-to-Point
connections do not need IP addresses for identification
• The interfaces that connect to the leased line are configured as
unnumbered, creating an anonymous network between two points
128.10.2.250
128.10.0.0
128.211.0.0
R1
1
R2
2
5/27/2016
128.211.0.100
Unnumbered
Southern Methodist University
21
Classless Addressing
• Address space depletion is a real problem
• Less than seventeen thousand Class B numbers are available
• More than two million Class C numbers exist
• To use up Class C addresses, ISPs are assigned multiple
contiguous blocks of Class C networks
• Since these networks are contiguous, they have a common prefix
• Rather than have individual entries in Routers for each of these
networks, use the common prefix to aggregate them
• The prefix will be wider than the natural subnet mask for Class C
• This is termed supernetting
5/27/2016
Southern Methodist University
22
Classless Addressing
• Assume an ISP has been allocated 2048 contiguous addresses
starting at address 128.211.168.0 (referred to as a CIDR block)
• The lowest IP address in this block is 128.211.168.0 and the
highest is 128.211.175.255
• Unlike subnet masks, Classless addresses should always have
contiguous ones
Boundary
Dotted Decimal
32-bit Binary equivalent
lowest
128.211.168.0
10000000 11010011 10101000 00000000
highest
128.211.175.255
10000000 11010011 10101111 11111111
Net mask
255.255.248.0
11111111 11111111 11111000 00000000
This is written as 128.211.168.0/21
5/27/2016
Southern Methodist University
23
Data Structures for Routing Tables
• Classful addresses are self identifying
• Routing Table can therefore be easily built as a Hash Table of
network IDs
• When a destination address needs to be looked up, router
computes hash function on the destination address to index into the
bucket
• The bucket will contain a list of network Ids and subnets, with
the IDs sorted in increasing subnet size (longest match first)
• Upon finding a match, the next hop can be retrieved and used for
forwarding the packet
• The algorithm will always pick the longest network ID match
5/27/2016
Southern Methodist University
24
Data Structures for Routing Tables
• Classless addressing cannot set an arbitrary starting bit position
for setting the network/host ID boundary
• the algorithm should choose the longest bit sequence that
corresponds to a route entry in the table
• the algorithm therefore has to iterate through the entire list first
for 32 bits, then for 31 bits, and so on until a match is found or all
bits have been exhausted
• The table is searched 32 x, which implies tremendous overheads
• Worst case happens when all routes fail to match except for the
default entry 0.0.0.0, which is compared after the iterations are
done
• Special data structures are needed to speed table lookup
5/27/2016
Southern Methodist University
25
Binary Trie Structure
• The routing Table is represented as a Binary Trie
• Successive bits in the address define a path from the root
downwards
• Consider the following set of numbers:
32 bit address
Unique prefix
00110101 00000000 00000000 00000000
001
01000110 00000000 00000000 00000000
0100
01010110 00000000 00000000 00000000
0101
01100001 00000000 00000000 00000000
011
10101010 11110000 00000000 00000000
1010
10110000 00000010 00000000 00000000
10110
10111011 00001010 00000000 00000000
10111
5/27/2016
Southern Methodist University
26
Binary Trie Structure
1
0
0
187.10.0.0 will have the
unique prefix 10111
0
1
1
1
0
Search path
1
0
1
1
0
A search for 146.20.25.56 fails on
the third bit because the prefix
100 does not exist in the trie
5/27/2016
Southern Methodist University
1
Leaf contains
address, subnet
mask, next hop
27
Data Structures for Routing Tables
• The prefix must cover the entire range of the Network ID
• For variable length subnet masking, each leaf will contain a
network ID A, a subnet mask M, and the next hop address N
• If the prefix matches, the destination address is masked with M
and compared to A
• If A matches the result of the AND operation, the packet is
forwarded to the next hop
• Else the packet is forwarded to the default router
• A table may have an entry for a network as well as a special entry
for a host on that network
• If A is set to the IP address of the host and the mask is set to
255.255.255.255, the host entry can get precedence over other
entries
5/27/2016
Southern Methodist University
28
Data Structures for Routing Tables
• The depth of the tree can be limited using specialized Trie
structures such as the PATRICIA and Level Compressed Tries
• In PATRCIA Tries, all nodes with one child are merged into their
parent
• Each node therefore specifies a value to test along with a number
of bits to skip
• A Level Compressed Trie provides optimization by eliminating
levels that can be skipped
• Tries provides better response for searching large amounts of
data, but require more sophisticated software, and computation to
update and maintain (add/delete operations)
• Routing tables change very rarely and are searched frequently
• The tradeoff is therefore in favor of Trie based data structures
5/27/2016
Southern Methodist University
29
Protocol Layering
Internetworking Protocols and Programming
•
Networks do not interconnect machines, they interconnect
human users
•
The complexity of human interaction should be converted
into an information stream, that can be transmitted across the
network digitally and retrieved in a comprehendible state
•
A simple way to handle complexity is to layer it on the basis
of generality
•
Functionality that is shared across all concepts of
information transfer goes into the lowest layers
•
Upper layer contain more and more specialized functionality
•
The advantage is that various specialized requirements can
share common lower layers without functional duplication
5/27/2016
Southern Methodist University
31
Internetworking Protocols and Programming
Sender 1
Sender 2
Layer 1a
Layer 1b
Receiver 1
Layer 1a
Layer 2
Receiver 2
Layer 1b
Layer 2
Layer 3
Layer 3
Network
•
Protocols are like Programming Languages
•
The desired functionality is translated into a sequence of
standardized messages between end points
•
Only peer layers understand each other
5/27/2016
Southern Methodist University
32
Protocol Reference Models
OSI seven Layer model
Application
TCP/IP five Layer model
Presentation
Session
Application
Transport
Transport
Network
Internet
Data Link
Network Interface
Physical
5/27/2016
Telnet, FTP, e-mail, etc.
TCP,UDP,SCTP
IP, ICMP, IGMP
Device Driver and Interface Card
Physical
Southern Methodist University
33
Layering on the Internet
Application
Physical
MAC
Application
• If the destination address does not match
one of its own, the packet is forwarded
TCP/UDP
MAC
Physical
5/27/2016
Router
IP
IP
MAC
IP
MAC
Physical
• Routers raise packets to layer three for
inspection
Router
Physical
Client
MAC
Router
IP
Router
Server
TCP/UDP
IP
IP
MAC
Physical
Physical
Southern Methodist University
34
Concept of Multiplexing/Demultiplexing
application
application
application
application
}
UDP
TCP
IGMP
ICMP
}
RARP
ARP
Ethernet
Driver
Demultiplexing based on
destination port number
in TCP or UDP header
IP
}
}
5/27/2016
Demultiplexing based on
protocol value in IP header
Demultiplexing based on
frame type in Ethernet Header
Incoming Frame picked if destination Media
Access and Control (MAC) address matches
setting on Network Interface Card
Southern Methodist University
35
User Datagram Protocol
The Transport Layer
• UDP: User Datagram Protocol is a simple transport layer protocol
• UDP is a connectionless protocol implying that there is no
handshaking between end-points prior to or during data exchange
• In UDP, one end just sends a datagram to the other end, without
preliminary handshaking
• at the UDP layer, data interchange happens between a source port
and a destination port
0
31
15 16
16-bit destination port number
16-bit source port number
16-bit UDP checksum
16-bit UDP length
8 bytes
Data (if any)
5/27/2016
Southern Methodist University
37
User Datagram Protocol
• Port numbers identify the sending and receiving processes
• IP Layer demultiplexes packets based on destination IP address
• UDP layer demuxes packets based on destination ports
• UDP length is the length of the UDP header and the UDP data in
bytes
• this is redundant information since IP layer already has datagram
length in its header
0
31
15 16
16-bit destination port number
16-bit source port number
16-bit UDP checksum
16-bit UDP length
8 bytes
Data (if any)
5/27/2016
Southern Methodist University
38
UDP Checksum
• UDP checksum covers the UDP header and the UDP data, unlike IP
which covers only header
• UDP checksum is optional, by IETF standards, but always enabled
• since checksum is ones complement sum of 16 bit words, padding
bytes may be necessary to round datagram size to multiple of 16
• If transmitted checksum is zero it indicates that the sender did not
compute a checksum
• If the computed checksum adds up to a zero, all ones are
transmitted
• UDP checksum should always be enabled especially if packets are
forwarded across routers
5/27/2016
Southern Methodist University
39
UDP Checksum
• the more the hops the larger the source of errors that could be
introduced by forwarding routers; checksums help detect errors
• Checksum is end-to-end, calculated by the sender and verified by
the receiver
• UDP checksum ensures that the datagram is delivered from the
right source to the right destination IP address
• UDP provides a 12-byte pseudo-header just for checksum
computation
• Pseudo-header includes certain fields from the IP header
• Pseudo-header is disposed off after the checksum is computed
5/27/2016
Southern Methodist University
40
UDP Header
31
0
32-bit source
15 16IP address
32-bit destination IP address
16-bit UDP length
8-bit protocol (17)
zero
UDP
pseudo
header
16-bit destination port number
16-bit source port number
16-bit UDP checksum
16-bit UDP length
UDP
header
Data (if any)
Pad byte (0)
5/27/2016
Southern Methodist University
41
UDP Services
• Standardized applications using the UDP protocol agree on
standardized protocol port numbers for specific services
• These ports are termed Well Known Ports (WKP) and are Internet
standards
• /etc/services file on any UNIX system will list the standard services
supported
• Service such as TFTP will be available on port 69, and NTP would
be available on port 123
• NTP and TFTP are implemented over UDP
• Clients can connect to these ports to request for services
5/27/2016
Southern Methodist University
42
UDP Services
• UDP can support reliable protocols over it
• A counterpart to UDP named TCP provides reliable service
• UDP is desirable since it is a light weight protocol
• Each UDP session is associated with a buffer allocated on the
machine corresponding to the service port
• All entities on the network transmitting UDP packets to that IP
address and port will be able to place datagrams in that buffer
• This is because UDP is a connectionless protocol
5/27/2016
Southern Methodist University
43
Homework #3 Due on Sept 27th
• 10.5, 10.17
• 12.2, 12.3, 12.7, 12.8
• Mid Term is postponed to Oct 5th
• Chapters 1 – 12 will be on the test
5/27/2016
Southern Methodist University
44
5/27/2016
Southern Methodist University
45
1st Mid Term
• Date: 09/19/05 Time: 6:30 PM to 7:45 PM
• Syllabus
– Class Notes: Sessions 1 – 4
– Text Book: Chapters 1 – 12
• Exam Format:
– Multiple Choice Questions
– Reasoning
– Design
(See Format of the 2004 Mid Term Exam)
5/27/2016
Southern Methodist University
46