Sei sulla pagina 1di 34

Lecture

Data Communication & Networks 10


Internet Protocol (IP)

Muhammad Yousaf
Internet Protocol: (IP)
IP is a layer-3 protocol
Standardized by IETF as RFC-791
Backbone of the Internet
Internet is the network of networks
Thousands of networks are interconnected with each
other via routers
Routers forward packets on the basis of IP
That’s why, routers are also termed as layer-3
devices

myousaf@ymail.com 2
Network of Networks:

Network-1 Router, An
interconnecting
node

Network-2 Network-3

myousaf@ymail.com 3
Functionality of IP:
IP is a connectionless protocol
Provides no guarantees, a best effort protocol
It performs the following important communication
tasks:
Global Addressing
Fragmentation & Reassembly
Packet Forwarding

myousaf@ymail.com 4
TCP / IP protocol stack:

Application Application

TCP | UDP TCP | UDP

IP IP IP IP

Data Link Data Link Data Link Data Link

Physical Physical Physical Physical

Source Router-1 Router-2 Destination

myousaf@ymail.com 5
IP header:

myousaf@ymail.com 6
IP header fields:
Version:
Should have value 4 for IPv4
Newer version of IP is IPv6
IHL:
Internet Header Length
Defines the header length in 32-bit words
Minimum length is 5; (5 x 4 = 20 bytes)
Type of Service: (TOS)
Defines the level of quality of service that this packet demands
e.g. in terms of delay, bandwidth, reliability or cost
Total Length:
Total length of complete packet in bytes
Maximum packet size is 64K bytes
myousaf@ymail.com 7
IP header fields: cont…
Identification:
All fragments of the same message have same
identification value
Helps to reassemble fragments of the same message
Flags:
DF = don’t fragment
MF = more fragments
Fragment Offset:
Measured in multiple of 8-bytes
Contains offset of fragment from the beginning of the
original message
Helps to in-order reassembly of fragments

myousaf@ymail.com 8
Fragmentation example:

myousaf@ymail.com 9
IP header fields: cont…
Time To Live: (TTL)
Is initialized by originator of packet
Decremented by one at each intermediate router
If value of TTL is not zero then node process the packet
otherwise discard the packet
Helps to limit the lifetime of packets
Protocol:
Defines the upper layer protocol that will handle the
packet
e.g. TCP=6, UDP=17
Header Checksum:
Is used to detect any error in header during transmission

myousaf@ymail.com 10
IP header fields: cont…
Source Address:
IP address of packet originating node
Destination Address:
IP address of the ultimate destination of the packet
This address is used by the routers to make the routing
decision
Options:
Optional field
e.g. source routing, timestamp, etc
Padding:
Ensures that the packet is aligned to 32-bit boundary
Only used when optional field is used
myousaf@ymail.com 11
IP Address:
IPv4 are 32-bit addresses
Represented as four 8-bit integer values
Called dotted-decimal notation
172.16.0.153
IPv6 are 128-bit addresses
Represented as eight 16-bit hexadecimal values separated by colons
5CFA:0002:0000:0000:CF07:1234:5678:FFCD
IP addresses are logical address values
Depends upon topological location of network
Independent of underlying hardware technology/addresses
i.e. MAC addresses
Our current discussion is related to the IPv4 addresses

myousaf@ymail.com 12
IP address of my system:

myousaf@ymail.com 13
IPv4 Address classes:
IP address is divided in subparts:
IP address = Network Part + Host Part
Number of bits assigned to network part or host part is
not fix
All nodes in a single network share common
network part, but have different host part
Routers take forwarding decision only on the basis
of network part
How many bits are assigned to network part is
critical
Historically it is determined by the class of IP
address
myousaf@ymail.com 14
Assigning IP addresses:
70.0.0.100

70.0.5.102 70.160.0.101
NW = 70

130.10.2.100 192.68.5.10

NW = 130.10 NW = 192.68.5

130.10.4.102 130.10.2.101 192.68.5.12 192.68.5.11

myousaf@ymail.com 15
IP Address classes:

myousaf@ymail.com 16
IP Address classes: cont…
Class is identified from the left most byte value
Class A:
From 0000 0000 to 0111 1111
i.e. from 0 to 127 e.g. 10.78.13.100
7-bits nw part = 128 different networks worldwide
24-bits host part = 16M hosts in each network
Class B:
From 1000 0000 to 1011 1111
i.e. from 128 to 191 e.g. 172.16.0.153
14-bits nw part = 16K different networks worldwide
16-bits host part = 64K hosts in each network
Class C:
From 1100 0000 to 1101 1111
i.e. from 192 to 223 e.g. 192.168.130.18
21-bits nw part = 2M different networks worldwide
8-bits host part = 256 hosts in each network

myousaf@ymail.com 17
IP Address classes: cont…
Class D:
From 1110 0000 to 1110 1111
i.e. from 224 to 239 e.g. 230.100.0.99
No distinction of network/host part
Each address represents a multicast group address
28-bits = 256M number of different groups; enough!
Class E:
From 1111 0000 to 1111 0111
i.e. from 240 to onward
Has never been used
Idea was to reserve this range for future use
e.g. for experimentation purpose

myousaf@ymail.com 18
Special IP Addresses:
Broadcast Address:
All 32-bits are one
11111111.11111111.11111111.11111111
255.255.255.255
Loopback Address:
From 127.0.0.1 to 127.255.255.254
Used for loopback testing even when system is not connected with network
Private Address Space:
Doesn’t need to purchase these addresses
Reserved for local use. Routers don’t forward packets with these addresses
Hence are not globally unique
From 10.0.0.0 to 10.255.255.255 (Class-A)
From 172.16.0.0 to 172.31.255.255 (Class-B)
From 192.168.0.0 to 192.168.255.255 (Class-C)

myousaf@ymail.com 19
Global Uniqueness of IP addresses:
To communicate over global Internet, node should
have globally unique address
IANA is the global authority that is responsible for
assigning unique internet identifiers such as:
Domain Names
IPv4/ IPv6 addresses
TCP/UDP port numbers
Internet Assigned Numbers Authority (IANA)
Like IETF, IANA is also a part of Internet
Architecture Board (IAB)

myousaf@ymail.com 20
IANA’s regional bodies:
There are three regional organizations under IANA:
APNIC
Asia Pacific Network Information Center (APNIC)
Manages Asia & Australia
ARIN
American Registry for Internet Numbers (ARIN)
Manages North America, South America, Caribbean &
Sub-Saharan Africa
RIPE
Réseaux IP Européens (RIPE)
Manages Europe & North Africa
myousaf@ymail.com 21
Obtaining Global IP address:
Regional Organizations like APNIC doesn’t provide
IP addresses directly to individual users
Internet Service Providers (ISPs) can purchase IP
addresses only in blocks
ISPs then provide these globally unique IP
addresses to its subscribers
ISP allocates these addresses either statically or
dynamically

myousaf@ymail.com 22
Obtaining Global IP address:
Static IP Address:
Assigned permanently
Servers normally need addresses that are not changed
over time
Cost is higher
Dynamic IP Address:
Assigned temporarily
Can have new address in each session
Clients normally doesn’t require permanent address
Services like DHCP, can manage dynamic address
assignment
Relatively of low cost

myousaf@ymail.com 23
NAT / NAPT:
Globally Unique IP addresses are precious
Organizations can’t afford to purchase hundreds of
IP addresses for their LAN users
They often purchase small number of global IP
addresses, and operate their all LAN users with
them
Think! As a LAN user while connecting over
Internet, you never use global addresses
There are two schemes:
Network Address Translation (NAT)
Network Address & Port Translation (NAPT)

myousaf@ymail.com 24
NAT / NAPT Box:

Local network
Internet
with many hosts
NAT Box

myousaf@ymail.com 25
Network Address Translation:
Purchase a pool of global IP addresses
Assign local private addresses inside the LAN
LAN users will use local addresses for local
communication
When they wish to communicate globally, nodes
will attach their local address in the IP header
This packet will pass through the NAT box
NAT box will replace the local address with global
address without telling the local user
This is called translation from local address to
global address

myousaf@ymail.com 26
NAT: cont…
NAT box will maintain a table for all these
translations
When replies will arrive from the Internet,
NAT box will again translate the addresses,
but now from global address to the local address

myousaf@ymail.com 27
Example of NAT Box:
SA=192.168.0.11
(local)

SA=192.168.0.12
(local)

Internet
SA=202.113.29.124
(global)

SA=192.168.0.13
(local)

myousaf@ymail.com 28
Static vs. Dynamic NAT

myousaf@ymail.com Source: http://computer.howstuffworks.com/nat1.htm (05-11-2010) 29


NAPT:
Network Address and Port Translation (NAPT)
Also called Overloading NAT
And also Port Address Translation (PAT)
Rather than purchasing a pool of addresses, let’s
put up with only single IP address
Same global address will be used for all LAN users
Uniqueness is maintained via port numbers
Very economical scheme

myousaf@ymail.com 30
NAPT:

myousaf@ymail.com Source: http://computer.howstuffworks.com/nat1.htm (05-11-2010) 31


Translation through NAPT:

Source: http://www.exfo.com/en/Library/WaveReview/WRArticle.aspx?Id=204 (08-11-2010)


myousaf@ymail.com 32
NAT / NAPT pros & cons:
Advantages:
Low cost solution
Saves the rapidly depleting global IP address space
Disadvantages:
Client-oriented solution
Can’t be used for hosting the servers
Reason! Outside users can’t initiate connection with
users behind NAT box

myousaf@ymail.com 33
To be continued…

myousaf@ymail.com 34

Potrebbero piacerti anche