LGW2EChapter8

Download Report

Transcript LGW2EChapter8

Chapter 8 Communication
Networks and Services
The TCP/IP Architecture &
The Internet Protocol
Chapter 8 Communication
Networks and Services
The TCP/IP Architecture
Why Internetworking?

To build a “network of networks” or internet



operating over multiple, coexisting, different network technologies
providing ubiquitous connectivity through IP packet transfer
achieving huge economies of scale
H
H
Net51
Net
G
G
G
H
Net52
Net
Net53
Net
G
Net55
Net
G
Net54
Net
G
H
Why Internetworking?

To provide universal communication services


independent of underlying network technologies
providing common interface to user applications
H
Reliable Stream Service
H
Net51
Net
G
G
G
H
Net52
Net
Net53
Net
G
Net55
Net
G
Net54
Net
G
H
User Datagram Service
Why Internetworking?

To provide distributed applications



Any application designed to operate based on Internet
communication services immediately operates across the entire
Internet
Rapid deployment of new applications
 Email, WWW, Peer-to-peer
Applications independent of network technology


New networks can be introduced below
Old network technologies can be retired
Internet Protocol Approach



IP packets transfer information across Internet
Host A IP → router→ router…→ router→ Host B IP
IP layer in each router determines next hop (router)
Network interfaces transfer IP packets across networks
Router
Host A
Transport
Layer
Internet
Layer
Internet
Layer
Network
Interface
Router
Internet
Layer
Net51
Net
Router
Network
Interface
Host B
Network
Interface
Net52
Net
Network
Interface
Internet
Layer
Network
Interface
Internet
Layer
Net54
Net
Transport
Layer
Net53
Net
TCP/IP Protocol Suite
SMTP
DNS
Distributed
applications
TCP
UDP
HTTP
Reliable
stream
service
Best-effort
connectionless
packet transfer
IP
RTP
User
datagram
service
(ICMP, ARP)
Network
Network
Network
Interface 1
Interface 2
Interface 3
Diverse network technologies
Recall…
Network
Interface
Internet Names & Addresses
Internet Names
 Each host has a unique name
 Independent of physical
location
 Facilitate memorization by
humans
 Domain Name
 Organization under single
administrative unit
 Host Name
 Name given to host computer
 User Name
 Name assigned to user
[email protected]
Internet Addresses
Each host has globally unique logical 32
bit IP address
Separate address for each physical
connection to a network
Routing decision is done based on
destination IP address
IP address has two parts:
netid and hostid
netid unique
netid facilitates routing
Dotted Decimal Notation:
int1.int2.int3.int4
(intj = jth octet)
128.100.10.13
DNS resolves IP name to IP address
Physical Addresses




LANs (and other networks) assign physical addresses to
the physical attachment to the network
The network uses its own address to transfer packets or
frames to the appropriate destination
IP address needs to be resolved to physical address at
each IP network interface
Example: Ethernet uses 48-bit addresses



Each Ethernet network interface card (NIC) has globally unique
Medium Access Control (MAC) or physical address
First 24 bits identify NIC manufacturer; second 24 bits are serial
number
00:90:27:96:68:07 12 hex numbers
Intel
Encapsulation
HTTP Request
TCP Header contains source &
destination port numbers
TCP
header
HTTP Request
IP Header contains source and
destination IP addresses;
transport protocol type
TCP Segment
IP
header
Ethernet Header contains
source & destination MAC
addresses; network protocol
type
TCP
header
HTTP Request
IP Packets
Ethernet
header
IP
header
TCP
header
HTTP Request
FCS
Ethernet Frame
PDU of a given layer is encapsulated in a PDU of the layer below
Chapter 8 Communication
Networks and Services
The Internet Protocol
Internet Protocol


Correspond to network layer of the OSI model
Provides best effort, connectionless packet delivery





RFCs 791, 950, 919, 922, and 2474.
IP is part of Internet STD number 5, which also includes:



motivated by need to keep routers simple and by adaptibility to
failure of network elements
packets may be lost, out of order, or even duplicated
higher layer protocols must deal with these, if necessary
Internet Control Message Protocol (ICMP), RFC 792
Internet Group Management Protocol (IGMP), RFC 1112
IP packets contains header and data part
IP Packet Header
0
4
31
Version
IHL
8
16
19
24
Type of Service
Identification
Time to Live
Total Length
Flags
Protocol
Fragment Offset
Header Checksum
Source IP Address
Destination IP Address
Options
Length
 Minimum 20 bytes
 Up to 40 bytes in options fields
Padding
IP Packet Header
0
4
31
Version
IHL
8
16
24
Type of Service
Identification
Time to Live
Checksum
19
Total Length
Flags
Protocol
Fragment Offset
Header
Source IP Address
Destination IP Address
Options
Padding
Version: current IP version is 4. New generation IP  IPv6
Internet header length (IHL): length of the header in 32-bit words.
Type of service (TOS): specifies priority of packet based on delay, throughput, reliability
and cost. Recent Differentiated Services redefines TOS field to include other services
besides best effort.
IP Packet Header
0
4
Version
8
IHL
16
24
Type of Service
Identification
Time to Live
19
Total Length
Flags
Protocol
31
Fragment Offset
Header Checksum
Source IP Address
Destination IP Address
Options
Padding
Total length: number of bytes of the IP packet including header and data, maximum length
is 65,535 bytes.
Identification, Flags, and Fragment Offset: used for fragmentation and reassembly (More
on this shortly).
IP Packet Header
0
4
Version
8
IHL
16
24
Type of Service
Identification
Time to Live
19
Total Length
Flags
Protocol
31
Fragment Offset
Header Checksum
Source IP Address
Destination IP Address
Options
Padding
Time to live (TTL): number of hops packet is allowed to traverse in the network.
• Each router along the path to the destination decrements this value by one.
• If the value reaches zero before the packet reaches the destination, the router discards
the packet and sends an error message back to the source.
IP Packet Header
0
4
Version
8
IHL
16
24
Type of Service
Identification
Time to Live
19
Total Length
Flags
Protocol
31
Fragment Offset
Header Checksum
Source IP Address
Destination IP Address
Options
Padding
Protocol: specifies upper-layer protocol that is to receive IP data at the destination.
Examples include TCP (protocol = 6), UDP (protocol = 17), and ICMP (protocol = 1).
Header checksum: verifies the integrity of the IP header.
Source IP address and destination IP address: contain the addresses of the source and
destination hosts.
IP Packet Header
0
4
Version
8
IHL
16
24
Type of Service
Identification
Time to Live
19
Total Length
Flags
Protocol
31
Fragment Offset
Header Checksum
Source IP Address
Destination IP Address
Options
Padding
Options: Variable length field, allows packet to request special features such as security
level, route to be taken by the packet, and timestamp at each router. Detailed descriptions
of these options can be found in [RFC 791].
Padding: This field is used to make the header a multiple of 32-bit words.
Example of IP Header
IP Addressing
RFC 1166
 Each host on Internet has unique 32 bit IP address
 Each address has two parts: netid and hostid
 netid unique & administered by
 American Registry for Internet Numbers (ARIN)
 Reseaux IP Europeens (RIPE)
 Asia Pacific Network Information Centre (APNIC)
 Facilitates routing
 A separate address is required for each physical connection of a host to a
network; “multi-homed” hosts
 Dotted-Decimal Notation:
int1.int2.int3.int4
where intj = integer value of jth octet
IP address of 10000000 10000111 01000100 00000101
is 128.135.68.5 in dotted-decimal notation
• Five address classes: Class A, Class B, Class C, Class D and Class E

Network Mask
• Each of the commercial address classes has a set
classfull network mask. The network mask defines
which bits out of the 32 bit of the address are
defined as the network portion and which are the
host portion.
• The network mask is calculated by setting all bits to
a value of 1 in the octets designated for the
network portion and all bits to a value of 0 in the
octets designated for the host portion.
Classful Addresses
Class A
7 bits
0
netid
24 bits
hostid
• 126 networks with up to 16 million hosts
1.0.0.0 to
127.255.255.255
• A Class A address has the first octet as the network portion and the
remaining 3 octets as the host portion. Therefore, a Class A network
mask is defined as 255.0.0.0.
Classful Addresses
Class B
14 bits
1
0
netid
• 16,382 networks with up to 64,000 hosts
•
16 bits
hostid
128.0.0.0 to
191.255.255.255
A Class B address has the first and second octets as the
network portion and the third and fourth octets as the host
portion. A Class B network mask is shown as 255.255.0.0.
Classful Addresses
Class C
21 bits
1
1
0
netid
• 2 million networks with up to 254 hosts
8 bits
hostid
192.0.0.0 to
223.255.255.255
• A Class C address has the first, second, and third octet as the
network portion and the last octet as the host portion. A Class C
network mask is shown as 255.255.255.0.
Class D
28 bits
1
1
1
0
multicast address
224.0.0.0 to
239.255.255.255



Used for multicast services that allow a host to send
information to a group of hosts simultaneously.
Up to 250 million multicast groups at the same time
Permanent group addresses




All systems in LAN; All routers in LAN;
All OSPF routers on LAN; All designated OSPF routers on a
LAN, etc.
Temporary groups addresses created as needed
Special multicast routers
Class E

Reserved for experiments
Tutorial
•
Convert the IP addresses to binary representation and identify the
address class:
218.58.20.165; 128.167.23.20; 2.196.128.50; 98.156.10.10;
270.10.24.96;45.66.244.89;233.3.4.12
• An IP address has a fixed length of 32 bits, where the most
significant bits identify the particular class.
1. Convert the dotted-decimal notation binary counterpart
2. Compare the binary notation to the class prefixes
27
128
26
64
25
32
24
16
23
8
22
4
21
2
20
1
Tutorial
218.
11011010.
Class C
58.
00111010.
20.
00010100.
165
10100101
189.
10111101.
Class B
167.
10100111.
23.
00010111.
20
00010100
Tutorial
• Identify the range of IPv4 addresses spanned by
Class A, Class B, and Class C.
Class A: 1.0.0.0 to 127.255.255.255
Reserved Host IDs (all 0s & 1s)
Internet address used to refer to network has hostid set to all 0s
0
0
0
0
0
0
0
0
0
this host
(used when
booting up)
a host
in this
network
host
Broadcast address has hostid set to all 1s
1
1
1
netid
1
1
1
1
1
1
1
1
1
broadcast on
local network
1
broadcast on
distant network
Private IP Addresses


Specific ranges of IP addresses set aside for use
in private networks (RFC 1918)
Use restricted to private internets (such as home
networks); routers in public Internet discard
packets with these addresses




Range 1: 10.0.0.0 to 10.255.255.255
Range 2: 172.16.0.0 to 172.31.255.255
Range 3: 192.168.0.0 to 192.168.255.255
Network Address Translation (NAT) used to
convert between private & global IP addresses
Example of IP Addressing
128.140.5.40
128.135.40.1
Interface
Address is
128.135.10.2
H
Network
R
128.135.0.0
H
128.135.10.20
H
Interface
Address is
128.140.5.35
Network
128.140.0.0
H
Subnet mask =
?
128.135.10.21
Address with host ID=all 0s refers to the network
Address with host ID=all 1s refers to a broadcast packet
H
128.140.5.36
R = router
H = host
Subnet Addressing

Original IP addressing has some drawbacks:





Consider an university has a Class B network address
So, there are 64,000 hosts  Complexity in managing these host
All Classes of IP networks can be divided into smaller networks
called subnetworks (or subnets).
Extra flexibility, makes more efficient use of network address
utilization, and contains broadcast traffic because a broadcast
will not cross a router
A subnet address is created by "borrowing" bits from the host
field and designating them as the subnet field. The number of
borrowed bits is variable and specified by the subnet mask.
Subnetting Example
Subnetting Example

If a packet with a destination IP address of 150.100.12.176 arrives at
the site from the outside network, which subnet should a router
forward this packet to?

To find the subnet number, the router need to know the subnet
mask, which consist of binary 1s for every network portion and
binary 0s for host portion. So, the subnet mask :


11111111
11111111
11111111
10000000
(255.255.255.128)
The router can determine the subnet number by performing a binary
AND between the subnet mask and the IP address.






IP add =
10010110 01100100 00001100 10110000
Subnet mask = 11111111 11111111 11111111 10000000
Binary AND =
10010110 01100100 00001100 10000000
Subnet = 150.
100.
12.
128
Subnet address used by routers within organization to forward the packet.
A host connected to this subnetwork must have an IP address in the range
150.100.12.129 to 150.100.12.254
Tutorial
•
A host in an organization has an IP address
150.32.64.98 and a subnet mask 255.255.240.0.
What is the address of this subnet? What is the range
of IP addresses that a host can have on this subnet?
Address: 10010110 00100000 01000000 00100010
Mask:
11111111 11111111 11110000 00000000
Subnet:
10010110 00100000 01000000 00000000
Host:
From: 10010110 00100000 01000000 00000001
To:
10010110 00100000 01001111 11111110
Tutorial
• A university has 150 LANs with 100 hosts in each LAN. Suppose the
university has one Class B address. Design an appropriate subnet
addressing scheme.
A Class B address has 16 bits for the network ID and 16 bits for the host ID. To
design an appropriate subnet addressing scheme we need to decide how many bits
to allocate to the host ID versus the subnet ID. We can choose either 7 bits or 8 bits
to identify the hosts.
If we allocate 8 bits for to identify the host, then there are sufficient subnet-id bits to
cover up to 28=256 LANs and enough host-id bits to cover up to 256 hosts for each
LAN. The subnet mask in this case is 255.255.255.0
The choice between 7 or 8 bits to represent the hosts depends on which is likely to
grow more, the number of subnets or the number of hosts in a LAN.
Subnet Example
H1
H2
150.100.12.154
150.100.12.176
150.100.12.128
150.100.12.129
150.100.0.1
To the rest of
the Internet
255.255.255.128=subnet
mask
R1
150.100.12.4
H3
H4
150.100.12.24
150.100.12.55
150.100.12.0
150.100.12.1
R2
H5
150.100.15.54
150.100.15.0
150.100.15.11
Routing with Subnetworks


IP layer in hosts and routers maintain a routing table
Originating host: To send an IP packet, consult routing
table



If destination host is in same network, send packet directly using
appropriate network interface
Otherwise, send packet indirectly; typically, routing table
indicates a default router
Router: Examine IP destination address in arriving
packet

If dest IP address not own, router consults routing table to
determine next-hop and associated network interface & forwards
packet
Routing Table

Each row in routing table
contains:
 Destination IP address
 IP address of next-hop
router
 Physical address
 Statistics information
 Flags


H=1 (0) indicates route is to a
host (network)
G=1 (0) indicates route is to a
router (directly connected
destination)
For every packet to be routed, the
routing table is search in the
following order & action
• Complete destination address;
send as per next-hop & G flag
• Destination network ID; send as
per next-hop & G flag
• Default router entry; send as per
next-hop
• Declare packet undeliverable;
send ICMP “host unreachable
error” packet to originating host
Example: Host H5 sends packet to
host H2
H1
H2
150.100.12.154
150.100.12.176
150.100.12.128
150.100.12.129
150.100.0.1
To the rest of
the Internet
R1
150.100.12.4
H3
H4
150.100.12.24
150.100.12.55
150.100.12.0
150.100.12.1
R2
H5
150.100.15.54
Routing Table at H5
Destination
Next-Hop
Flags
Net I/F
127.0.0.1
127.0.0.1
H
lo0
default
150.100.15.54
G
emd0
150.100.15.0
150.100.15.11
emd0
150.100.15.11
150.100.15.0
150.100.12.176
Example: Host H5 sends packet to
host H2
H1
H2
150.100.12.154
150.100.12.176
150.100.12.128
150.100.12.129
150.100.0.1
To the rest of
the Internet
R1
150.100.12.4
H3
H4
150.100.12.24
150.100.12.55
150.100.12.0
150.100.12.1
150.100.12.176
Routing Table at R2
Destination
Next-Hop
Flags
Net I/F
127.0.0.1
127.0.0.1
H
lo0
default
150.100.12.4
G
emd0
150.100.15.0
150.100.15.54
emd1
150.100.12.0
150.100.12.1
emd0
R2
H5
150.100.15.54
150.100.15.0
150.100.15.11
Example: Host H5 sends packet to
host H2
H1
H2
150.100.12.154
150.100.12.176
150.100.12.128
150.100.12.176
150.100.12.129
150.100.0.1
To the rest of
the Internet
R1
150.100.12.4
H3
H4
150.100.12.24
150.100.12.55
150.100.12.0
150.100.12.1
R2
Routing Table at R1
Destination
Next-Hop
Flags
Net I/F
127.0.0.1
127.0.0.1
H
lo0
150.100.12.176
150.100.12.176
emd0
150.100.12.0
150.100.12.4
emd1
150.100.15.0
150.100.12.1
G
emd1
H5
150.100.15.54
150.100.15.0
150.100.15.11
Subnet Example
H1
H2
10.192.1.4
10.192.1.6
10.192.0.0
10.192.2.9
10.101.0.1
To the rest of
the Internet
255.255.0.0=subnet mask
R1
10.119.2.4
H3
H4
10.119.1.55
10.119.2.2
10.119.0.0
10.119.12.1
R2
H5
10.140.5.54
Gateway for each host:???
H5=10.140.5.54
H4=H3=10.119.2.4
H1=H2=10.192.2.9
10.140.0.0
10.140.5.11
IP Address Problems

In the 1990, two problems became apparent



IP Address Exhaustion


IP addresses were being exhausted
IP routing tables were growing very large
Class A, B, and C address structure inefficient
 Class B too large for most organizations, but future proof
 Class C too small
 Rate of class B allocation implied exhaustion by 1994
IP routing table size

Growth in number of networks in Internet reflected in # of table entries



Short-term solution:




From 1991 to 1995, routing tables doubled in size every 10 months
Stress on router processing power and memory allocation
Classless Interdomain Routing (CIDR), RFC 1518
New allocation policy (RFC 2050)
Private IP Addresses set aside for intranets
Long-term solution: IPv6 with much bigger address space
Classless Inter-Domain Routing


Enables a technique called supernetting to
allow a single routing entry to cover block of
classful address
Example:

Instead on four entries of Class C addresses


CIDR allows a single routing entry 205.100.0.0/22


205.100.0.0, 205.100.1.0, 205.100.2.0 and 205.100.3.0
Which includes all IP addresses from 205.100.0.0 to
205.100.3.255
CIDR deals with Routing Table Explosion
Problem
Hierarchical Routing & Table Efficiency
(a)
NET_1
0000
0001
0010
0011
NET_4
1
4
0100
0101
0110
0111
3
R2
R1
5
2
NET_2
1000
1001
1010
1011
00
01
10
11
00
01
10
11
1
3
2
3
1100
1101
1110
1111
3
4
3
5
(b)
0000
0111
1010
1101
1
0001
0100
1011
1110
4
3
R2
R1
5
2
0011
0110
1001
1100
0000
0111
1010
…
1
1
1
…
0001
0100
1011
…
4
4
4
…
0011
0101
1000
1111
NET_5
Address Resolution Protocol
Although IP address identifies a host, the packet is physically
delivered by an underlying network (e.g., Ethernet) which uses its own
physical address (MAC address in Ethernet). How to map an IP
address to a physical address?
H1 wants to learn physical address of H3 -> broadcasts an ARP request
H1
H2
150.100.76.20
H3
H4
150.100.76.22
150.100.76.21
150.100.76.23
ARP request (what is the MAC address of 150.100.76.22?)
Every host receives the request, but only H3 reply with its physical address
H1
H2
H3
ARP response (my MAC address is 08:00:5a:3b:94)
H4
Example of ARP
IPv6
Longer address field:
128 bits can support up to 3.4 x 1038 hosts
Simplified header format:
Simpler format to speed up processing of each header
All fields are of fixed size
IPv4 vs IPv6 fields:
Same: Version
Dropped: Header length, ID/flags/frag offset, header checksum
Replaced:
Datagram length by Payload length
Protocol type by Next header
TTL by Hop limit
TOS by traffic class
New: Flow label
Other IPv6 Features
Flexible support for options: more efficient and flexible
options encoded in optional extension headers
Flow label capability: “flow label” to identify a packet
flow that requires a certain QoS
Security: built-in authentication and confidentiality
Large packets: supports payloads that are longer than
64 K bytes, called jumbo payloads.
Fragmentation at source only: source should check
the minimum MTU along the path
No checksum field: removed to reduce packet
processing time in a router