Unit 3
Unit 3
TCP/IP-1
1
Internet Protocol (IP) enables the communication across
a vast and heterogeneous collection of networks that are
based on the different technology.
Any host computer that is connected to the Internet can
communicate with any other computer that is also
connected to the internet
The transport layer offer two basic communication
services that operate on top of IP: Transmission Control
Protocol (TCP) and User Datagram Protocol (UDP)
2
THE TCP/IP ARCHITECTURE
TCP/IP protocol suits not only TCP and IP but also to
other related protocols such as User Datagram Protocol
(UDP), the Internet Control Message Protocol (ICMP)
and basic application such as HTTP, TELNET and FTP.
Appplication layer protocol such as FTP and HTTP send
messages using TCP.
Application layer protocols such as SNMP and DNS
send their messages using UDP
PDU exchanged by TCP protocols are called TCP
segments or segments while those exchanged by UDP
protocols are called UDP datagrams or datagrams
3
CONTD..
Protocol Data Units exchanged by IP are called IP
packets or packets.
Receiving IP determines whether packets should be
sent to TCP or UDP
TCP/UDP sends each packet to appropriate application
based on the port number
4
5
HTTP Request
IP Header contains:
source and destination IP addresses;
IP
transport protocol type Header
Ethernet FCS
Header
Ethernet Header contains: source and destination physical addresses; network protocol type
Encapsulation of PDUs in TCP/IP
Here HTTP command is passed to the TCP layer which encapsulates the
message into a TCP segment.
Segment header contains port number for the client process and well
known port 80 for the HTTP server process.
The TCP segment is then passed to the IP layer where it is encapsulated
in an IP packet.
7
CONTD
IP packet is encapsulated into Ethernet frames
The frame header contains physical address that identify
the physical end points for the Ethernet sender and the
receiver.
Logical IP address need to be converted into specific
physical address to carry out the transfer of bits from one
device to another
This conversion is done by address resolution protocol.
10
INTERNET PROTOCOL APPROACH
IP packets transfer information across Internet
Host A IP router router… routerHost B IP
IP layer in each router determines next hop; router
Routing + encapsulation + segmentation/assembly
Network interfaces transfer IP packets across networks
11
THE INTERNET PROTOCOL
Internet protocol (IP) is the heart of the TCP/IP protocol
suit
IP corresponds to the network layer in the OSI reference
model and provides a connectionless best effort delivery
service to the transport layer.
12
IP PACKET
To understand the service provided by IP entity, it is
useful to examine the IP packet format which contains a
header part and a data part
The header has a fixed length component of 20 bytes
plus a variable length component consisting of options
that can be up to 40 bytes
13
0 4 8 16 19 24 31
Source IP Address
Destination IP Address
Options Padding
15
CONTD…
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.
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.
Padding: This field is used to make the header a multiple of
32-bit words
16
IP ADDRESSING
Each host on Internet has unique 32 bit IP address
Each address has two parts: netid and hostid
The network ID identifies the network the host connected to
Host ID identifies the network connection to the host
netid unique & administered by
American Registry for Internet Numbers (ARIN)
Facilitates routing
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
17
Bit position: 0 1 2 3 8 16 31
Class A 0 Net ID Host ID
20
Reserved Host IDs
A host ID that contains all 1s is meant to broadcast the packet to all
hosts on the network specified by the network ID.
If network ID also contains all 1’s, the packet is broadcast on the local
network
A host ID that contains all 0’s refers to the network specified by the
network ID, this is used during booting, host transmits packets with all
0’s in the source address –it is an attempt to find out its IP address.
21
PRIVATE IP ADDRESSES
Specific ranges of IP addresses set aside for use in private
networks
Loopback address: 127.X.Y.Z
22
Subnet Addressing
Subnetted
address 1 0 Net ID Subnet ID Host ID
25
CONTD..
At R1: IP Packet with address : 150.100.15.11 arrived from outside
network
R1 has to know next hop router to send packet
Binary of above IP: 10010101011001000000111100001011
Mask: 11111111111111111111111110000000
Result: 10010110011001000000111100000000
IP: 150.100.15.0
Router R1 looks up this subnet address in its table
Corresponding entry to specify the next hop router address for R2-
150.100.12.1
R2 receives and perform same operation and send packet directly to
the destination
26
FIND THE SUB NETWORK
ADDRESS
IP: 140.11.36.22 Mask:255.255.255.0
IP: 120.14.22.16 Mask:255.255.128.0
27
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
28
SEARCHING ROUTING TABLE
Each row in routing table contains:
29
CLASSLESS INTER DOMAIN
ROUTING
To overcome address inefficiency
To give more organizations access to the Internet
No concept of class
Addresses are granted in blocks
Restrictions
Addresses in a block must be contiguous
The number of addresses in a block must be a power of 2
The first address must be evenly divisible by the number of address
Ex:
205.16.37.32 to 205.16.37.47
First address is divisible by 16 which is power of 2
30
CIDR
Mask is used to define the block of addresses
Mask is a 32-bit number ; n leftmost bits are 1s
Find first address, last address and number of address
Given that one of the address: 205.16.37.39/28
IP address: 11001101000100000010010100100111
Mask : 11111111111111111111111111110000
First address : 11001101000100000010010100100000
(32-n right most 0’s) (205.16.37.32)
Last address: 11001101000100000010010100101111
(32-n right most 1’s) (205.16.37.47)
Number of address: Difference between last and first address
47-32=16
31
SUPERNETTING
Using a CIDR notation a prefix 205.100.0.0 of length 22 bits id
written as 205.100.0.0/22
The /22 notation indicates that the network mask is 22 bits
32
CONTD..
CIDR allows technique called supernetting to allow a
single routing entry to cover a block of classful address
Here address assignment should reflect the physical
topology of the network, in this case IP address prefix
should correspond to continents or nations
Tranit routing domains that carry traffic between domain
should have unique IP and domains that are attached to
them should begin with the transit routing domains
prefix
33
ADDRESS RESOLUTION
PROTOCOL
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)
34
REVERSE ADDRESS RESOLUTION
Used when a host knows its MAC but not its IP-which is kept in
separate disk at server.
Host broadcast its RARP request packet containing its MAC on the
network
All host receives but server responds with IP along with host’s
MAC address
Server must be located in the same physical network.
35
36
FRAGMENTATION AND
REASSEMBLY
Fragmentation based on Maximum Transmission Unit (MTU)
(Ethernet-MTU-1500)
IP breaks packets into segments whose size can not be greater than
MTU.
To reassemble the fragments, the destination waits until it has
received starts only after host has received all the packets belonging
to the same packet.
If one or more fragments are lost, reassembly will be stopped and
discards the rest of the fragment
To detect lost fragments, destination sets timer, if timer expires
before receiving all packets then hosts assumes missing fragments
37
were lost
FIELDS USED IN IP HEADER FOR
FRAGMENTATION
Identification-to identify which packet a fragment belongs; to
avoid mix up
Flags-
Unused bit
Don’t Fragment bit-1- forces the router not to fragment, discards if packet
length> MTU
More Fragment (MF)
Tells the destination host whether or not more fragments follow.
MF is set to 1 if there are more fragments,Otherwise set to 0
Fragment offset
Identifies the location of a fragment in packet
For first fragment this value is 0
38
EX: FRAGMENTING A PACKET
A packet is to be forwarded to a network with MTU of 576 bytes.
The packet has an IP header of 20 bytes and a data part of 1484
bytes. and of each fragment.
Maximum data length per fragment = 576 - 20 = 556 bytes.
Set maximum data length to 552 bytes to get multiple of 8.
39
INTERNET CONTROL MESSAGE
PROTOCOL(ICMP)
Encapsulated in IP packet (protocol type = 1)
Handles error and control messages
42
NETWORK ADDRESS TRANSLATION NAT
Within the company every machine has unique address (say
10.x.y.z).
When packet leaves the company,it passes through NAT box.
43
44
PROBLEMS
An address space has a total of 1024 addresses. How may bits
are needed to represent an address??????????
Hint 2x=1024 x=?
45
DRAW A DIAGRAM OF A NETWORK WITH ADDRESS 8.0.0.0 THAT IS
131.45.0.1
8.0.0.3
131.45.0.2
8.0.0.2
8.0.0.1
46
In a class A subnet,
IP address: 25.34.12.56, Mask 255.255.0.0
What is the first address (subnet address)?
IP Address: 25 . 34 . 12 . 56
Mask: 255 . 255 . 0 . 0
------ ------ ------ ------
Subnet Address: 25 . 34 . 0 . 0
Host connected to this sub network must have IP address in the range
25.34.0.0- to 25.34.0.254
25.34.0.255 is used to broadcast the packet
47
In a network, the address of one computer is 201.78.24.56 and
the address of another computer is 201.78.120.202.
multiply 96 by base 256 and add 146 to the product and subtract
result by1, will get :24721 addresses
48
PROBLEMS-IDENTIFY CLASS
FOR BELOW IP ADDRESS
● 1.22.200.10
● 201.240.200.2
● 217.3.6.8
● 180.170.0.2