William Stallings Data and Computer Communications
Download
Report
Transcript William Stallings Data and Computer Communications
Data and Computer
Communications
Internet Protocols
Network Architecture Features
Addressing
Packet size
Access mechanism
Timeouts
Error recovery
Flow control
Routing
User access control
Connection based or connectionless
Connectionless Internetworking
Advantages
Flexibility
Robust
No unnecessary overhead
Unreliable
Not guaranteed delivery
Not guaranteed order of delivery
Packets can take different routes
Reliability is responsibility of next layer up
(e.g. TCP)
IP Operation
Go to Router X
MAC address for Router X
IP PDU
Encapsulated with LAN protocol
Encapsulated with X.25 protocol
Design Issues
Routing
Datagram lifetime
Fragmentation and re-assembly
Error control
Flow control
Routing
End systems and routers maintain routing tables
Indicate next router to which datagram should be sent
Static
Dynamic
May contain alternative routes
Flexible response to congestion and errors
Source routing
Source specifies route as sequential list of routers to be
followed
Datagram Lifetime
Datagrams could loop indefinitely
Consumes resources
Transport protocol may need upper bound on datagram life
Datagram marked with lifetime
Time To Live field in IP
Once lifetime expires, datagram discarded (not forwarded)
Hop count
Decrement time to live on passing through a each router
Time count
Need to know how long since last router
Fragmentation and
Re-assembly
Different packet sizes
When to re-assemble
At destination
Results in packets getting smaller as data traverses
internet
Intermediate re-assembly
Need large buffers at routers
Buffers may fill with fragments
All fragments must go through same router
Inhibits dynamic routing
IP Fragmentation (1)
IP re-assembles at destination only
Uses fields in header
Data Unit Identifier (ID)
Identifies end system originated datagram
Source and destination address
Protocol layer generating data (e.g. TCP)
Identification supplied by that layer
Data length
Length of user data in octets
IP Fragmentation (2)
Offset
Position of fragment of user data in original datagram
In multiples of 64 bits (8 octets)
More flag
Indicates that this is not the last fragment
Fragmentation Example
Application data
IP header is the same as origin
TCP header is not duplicated –
More is the same as original
Internet Protocol (IP)
Part of TCP/IP
Specifies interface with higher layer
e.g. TCP
Specifies protocol format and mechanisms
IPv4
Used by the Internet
addresses are 32 bits wide
Its header is 20 bytes at minimum
Uses doted-decimal notation (e.g. 43.23.43.56)
IPv6
Provides larges address domain; addresses are 128 bits wide
Multiple separate headers are supported
Handles audio and video; providing high quality paths
Supports unicast, multicast, anycast
Dealing with Failure
Re-assembly may fail if some fragments
get lost
Re-assembly time out
Requires buffer
Need to detect failure – but how?
Assigned to first fragment to arrive
If timeout expires before all fragments arrive,
discard partial data
Use packet lifetime (time to live in IP)
If time to live runs out, kill partial data
Parameters (1)
Source address
Destination address
Protocol
Recipient e.g. TCP
Type of Service
Specify treatment of data
unit during transmission
through networks
+
0-3
4-7
8 - 15
0
Version
Header length
Type of Service
32
64
Identification
Time to Live
Source, destination
address and user protocol
Uniquely identifies PDU
Needed for re-assembly
and error reporting
Send only
16 - 18
Protocol
Source Address
128
Destination Address
160
Options + padding
Data
19 - 31
Total Length
Flags
96
192
Identification
Fragment Offset
Header Checksum
IP Packet Format - TTL
TTL (time-to-live) refers to the number of router
hops the IP packet is allowed before it must be
discarded.
Each router that receives a packet subtracts one from
the count in the TTL field.
When the count reaches zero, the router detecting it
discards the packet and sends an Internet Control
Message Protocol (ICMP) message back to the
originating host
IP Header
The IP datagram contains
data and IP address
The IP datagram is
encapsulated in a frame
with physical address
The header changes as the
frame goes from one
network domain to the next
IP Datagram
Frame
Frame
Address
IP
Data
Address
Encapsulated IP Packet in Ethernet Frame
Ethernet Frame Carrying IP Packet
MAC and
Associated
IP address
Encapsulated IP Packet in Ethernet Frame
Ethernet Frame Carrying IP Packet
An Ethernet frame containing IP information has
08 00 in its type field
IP starting with 45 Hex indicates IPv4 with
standard length of 20 bytes
IP starting with 4F Hex indicates IPv4 with
standard length of 60 bytes
Remember: 24=16; 45= 0100 0101= One Byte
0000
0010
0020
Protocol Analyzer Display:
00 00 C0 A0 51 24 00 C0 93 21 88 A7 08 00 45 08
00 5A DC 28 00 00 FF 01 88 08 C0 99 B8 01 C0 99
B8 03 2a B4 DD …..
Example:
99 is one
byte
1001 1001
IP Addressing
Two address types
Physical address (the frame has the physical address)
Logical
Static address resolution
Dynamic address resolution
How to map physical and IP addresses
IP datagram contains the logical IP address
To transport IP packets both physical and IP addresses must
be known
Embedded in the hardware (NIC, e.g., 00 00 11 00 11 33)
Also called the Media Address Control (MAC) address
Local tables of IP addresses
Centralized directory
Address resolution mechanism
Address resolution mechanisms
ARP (address resolution protocol) – IP48 bit Ethernet address
RARP (reverse) address resolution protocol are used to convert
MAC to IP address and vice versa
IP Addressing – IPv4
A network address is divided into Netid and Hostid
IP Address classification
(number of hosts per network)
Class
Leading bits
Network
Address (Netid)
Host
Address (Hostid)
Class A
0
7 bit (125)*
24 bit (16,777,151,750)
Class B
10
14 bit (16,368)
16 bit (65,534)
Class C
110
21 bit (2,096,896)
8 bit (254)
Class D (multicast)
1110
Class E (reserved)
1111
* Some values are reserved!
IP Addressing Classification
Network
Address
Host Address
Multicast Address
Network Address
Host Address
Reserved for Internet research
Network
Address
Host
Address
Example of IP Addressing
Q1: Determine the network address
for the following IP addresses:
1- 84.42.58.11 (84 = 54 Hex = 0101 0100)
Netid=84.0.0.0
Class A
Hostid=0.42.58.11
2- 144.54.67.5 (144 = 90 Hex = 1001 0000)
Netid=144.62.0.0
Class B
Hostid=0.0.67.5
Q2: What type of IP address classification
will a large organization with 1000
individual users in 150 dispersed buildings
use? Class B
IP Routing Protocols
Routing packets requires having knowledge about the network
Partial (know your own neighbors)
Full (know the entire network elements)
Retrieving network information (network discovery protocols)
RIP (routing information protocol): routing based on the least
number of hops
OSPF (open shortest path first): Routing based on number of
hops, link speed, congestion
TCP/IP Stack Protocol
Bridge
IS used to connect two LANs
using similar LAN protocols
Address filter passing on
packets to the required network
only
OSI layer 2 (Data Link)
Router
Connects two (possibly
dissimilar) networks
Uses internet protocol present
in each router and end system
OSI Layer 3 (Network)
Subnets and
Subnet Masks
00 10 00 00
Each LAN assigned subnet number
Site looks to rest of internet like single network
Host portion of address partitioned into subnet
number and host number
Local routers route within subnetted network
Subnet mask indicates which bits are subnet
number and which are host number
Allow arbitrary complexity of internetworked
LANs within organization
Insulate overall internet from growth of network
numbers and routing complexity
Routing Using Subnets
Masking
3-bit subnet
IP Address of B: 192.228.17.57
IP Address of A: 192.228.17.33
IP Address of X: 192.228.17.32
00 1|1 10 01
00 1|0 00 01
00 1|0 00 00
Subnet mask:
11 10 00 00
255.255.255.224
5-bit host
Note: if we XOR IP Address of B & Subnet Mask
We will have:
00 11 10 01 XOR 00 10 00 00 = 00 01 10 01
Host number is 25 00 01 10 01;
192 1100 0000, hence, Class C network (8-bit host/subnet) !
NetId
SubNetId
Host
Why Change IP?
Address space exhaustion
Two level addressing (network and host)
wastes space
Network addresses used even if not connected
to Internet
Growth of networks and the Internet
Extended use of TCP/IP
Single address per host
Requirements for new types of service
IP v6 Header vs. IPV4
Note:
IPv5 used for Stream
Protocol- IP-layer protocol
that provides end-to-end
guaranteed service across a
network.
Features:
Extended address space
Improved option mechanism
Dynamic address assignment
Multicasting and anycasting
Flow routing
128 bits
128 bits
Internet Addressing
Over half million networks are connected to the
Internet
Network numbers are managed by ICNN
(Internet Corporation for Assigned Names and
Numbers) - http://www.icann.org/
Delegates part of address assignments to regional
authorities
IP addresses are given to ISPs and companies
IP addresses are based on dotted decimal
notation: 192.41.7.32
IP address 0.0.0.0 refer to machine’s own network when
it is being booted (This host)
255.255.255.255 broadcast on the LAN
127.x.y.z reserved for loopback testing
More about subnets….
Routers can be connected to multiple LANs
LANS are divided into subnets each identified by a subnet
mask: 255.255.252.0 (… 1111 1100 0000 0000) 3210=22 to identify the subnet!
Mask: netID + SunnetID or /22 (subnet mask is 22 bit long)
Subnets are not visible outside the network
Example: Assume subnet mask is 255.255.252.0/22
Subnet 1: 130.50.4.1
Subnet 2: 130.50.8.1
…000010|00 00000001
Subnet 3: 130.50.12.1
…000011|00 00000001
Assume a packet’s destination is 130.50.15.6 which subnet
does it belong to?
Mask: … 1111 11|00 0000 0000
Adrs: … 0000 11|11 0000 0110
Hence: the packet must go to Subnet 3
Classes and subnets…
Classful routing is not very efficient
Having IP address classes creates issues
Addresses can be under utilized (Class A)
Addresses can be over utilized (Class C)
Management of addresses may be difficult
Organizations can grow!
Classless InterDomain Routing (CIDR)
Allocate remaining IP addresses in variable-sized block;
no regard to class!
Use 32-bit mask!
Uses a single routing table
Classless Routing - Example
What happens if a packet has an address of 194.24.17.4?
Where does it go?
O: ….1111 0000 0000 0000 AND 0001 0001 0000 0100
…. 0001 0000 0000 0000 (194.24.16.0)
How do you represent class B using CIDR?
16-bit NetID + 16-bit HostID /16
Network Address Translation (NAT)
Addresses are growing! What is the
solution?
NAT:
Use IPV6
Use NAT
Allows using one IP address per company
Internally new nodes can be added!
How?
NAT Operation
IP reserved addresses
10.x.y.z
172.16.x.y
192.168.x.y
Receiving a packet from the
Internet
Sender
NAT box:
Add IP address
TCP will have the destination port
(0-1023)
The port determines which server on
the remote (destination) side to
process the packet
Using the PORT address in TCP,
change the IP address to a
designated address (10.0.01)
Sending a packet into the Internet
NAT box:
Changes 10.0.0.1 to 198.60.42.12
198.60.42.12
NAT Issues…
Addresses are not unique: many 10.0.0.1!
NAT controls are the incoming and
outgoing packets – reliability!
NAT accesses TCP and IP layers – layers
should work independent of one another
NAT only allows TCP/IP or UDP/IP
NAT does not support applications which
insert the IP address in the body (FTP or
H.323)
Internet Control Protocols
IP protocol only deal with the data transfer
We need control protocol to check the
network
ICMP, ARP, RARP, BOOTP, HDCP
Internet Control Message
Protocol (ICMP)
ICMP error messages are used by routers and hosts to tell a
device that sent a datagram about problems encountered in
delivering it
Used to test the network
Messages are encapsulated in the IP packet
Has many message types
Code field is used for subtypes
ARP (address resolution protocol)
Exploits broadcast property of a LAN
Each host on LAN maintains a a table of IP
subnetwork addresses
If the address can not be found ARP
broadcasts a request
Shouting: Who know about this IP address?
Other hosts listen and reply
The reply includes IP address and MAC
Any interested host can learn about the new
information
ARP Example
Assume 1 is sending a message to 2 ([email protected])
Sonoma.edu is the host
Host 1 sends a message to Domain Name System (DNS): what is the IP address
for Sonoma.edu? 192.31.65.5
What is the MAC address for 192.31.65.5? Use ARP broadcast!
Host 2 respond: it is E2
Host 1 maps IP and MAC; encapsulate the IP message in the Ethernet frame and
send it
Cashing can enhance ARP operation
ARP Example
Assume 1 is sending a message to 4 ([email protected])
Sonoma.edu is the host
Host 1 sends a message to Domain Name System (DNS): what is the IP address
for Sonoma.edu? 192.31.65.5 What is the MAC address for 192.31.65.5? ARP
cannot pass through the router!
Two choices:
Reconfigure routers to response to ARP (Proxy ARP)
Send the message to the LAN router (E3)F1F34 – Each router looks are the IP
address and passes it to the next node using the routing table
RARP and BOOTP
Reverse ARP translates the Ethernet address to
IP address
RARP broadcasts the question (destination
address is all one)
A diskless machine when it is booking can ask: My MAC
is 12.03.23.43.23.23; what is my IP?
Not passed through the router!
Each LAN needs a RARP server!
Bootstrap protocol uses UDP and forwards over
routers
Mapping must be done manually in each router!
Uses one server but harder to implement!
Dynamic Host Configuration Protocol
DHCP allows many and automatic configuration
Replaces BOOTP and RARP
DHCP sends a DISCOVER Packet
What is the IP address for this MAC?
Even when an IP address is assigned, how long is it good
for?
Before the IP address is removed find another IP
address….called Leasing
Remember…
This is My MAC; what is my IP address?
RARP / DHCP
This is the destination host name, what it
is IP address? DNS Server
This is the IP address, what is your` MAC
address? ARP
References
Tanenbaum
Tomasi Text Book
Comer Text book