ipaddr-1217448089978438-9
TRANSCRIPT
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 1/62
TCP/IP Addressing Demystified
- Edited by Alien Coders Team
Contributed by Souvik
Official Website: http://www.aliencoders.com
Facebook Page: https://www.facebook.com/aliencoders
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 2/62
What you will learn
• How internet addressing works
• Internet Addressing
• Role played by Routing and addressing
• ARP
•
TCP/UDP• IPv6 into the picture
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 3/62
• The Internet Protocol (IP) enables communications across a vast and
heterogeneous collection of networks.
• The Internet offers two basic communication services that operate on
top of IP:
•
TCP Transmission control protocol i.e reliable stream service.• UDP User datagram Protocol.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 4/62
The TCP header contains the port number of the client process and the well known
port 80 for the HTTP server process.
The IP network address are the logical address because they are defined in termsof logical topology of the routers and the end systems.
Ethernet LAN frames contains physical address that identify the physical
endpoints for the sender and the receiver.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 5/62
• The network interface layer is particularly concerned with the
protocols that are used to access the intermediate networks.
• At each gateway the network protocol is used to encapsulate the IP packet into a packet or frame of the underlying link.
• The router must determine the next hop in the route to the destinationand then encapsulate the IP packet or frame of the type of the nextnetwork or link
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 6/62
IP Packet
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 7/62
• Total Length : With 16 bits , the max packetlength = 65,535
• Protocol TCP =6 ; UDP =17 ; ICMP = 1
• Options : Security level , Route to be taken by the packet
• Padding : To make the header field a multiple of32 bit word.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 8/62
Network
I nternet AddressingHost
An IP address is divided into 2 parts:
a) network part 2) host part .
The part of a public IP address that identifies the network is
internationally controlled by the Network Information Center (NIC)
located in the Stanford Research Institute in California.
The part that identifies the host is controlled locally at a
network level.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 9/62
I nternet Addressing
An Internet address is four octets (i.e. 32 bits) long.
The first few bits in the network part of the address helps interpret the
address.These bits indicate the class of the address.
When a system wants to communicate over the internet they need to have a public address.
This public address has to be purchased from NIC in Stanford.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 10/62
Address classes
There are five Internet address classes. They are : Class A / B / C / D / E .
Class A addressing is used for very large networks, that is networks which willhave a large number of hosts attached to them.
For class A the MSB is 0.
Each pure class A network can support (224-2) hosts. One address each beingreserved for network address (all 0 ) and all one for broad cast.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 11/62
Class A
24 bits
Host ID
The first bit is 0 and next 7 bits called the Net ID identifies
the network . The next field contains the host ID, whichidentifies the particular host within the specified network.
In a class A address it's 24 bits long and therefore allows
for almost 17 million hosts on a network.
For example 10.200.20.5 is a class A address
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 12/62
Class B
Class B addressing is used for medium-sized networks.
If the first two bits in the address are 10, it's a class B address. 14 bits for network Idsand 16 bits for host Ids allowing about 16,000 networks and 64,000 hosts for eachnetwork.
The range of first octet of class B address is 128 – 191.i.e 128.0.0.0 to 191.255.0.0
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 13/62
Class C
The next address class is class C, probably the most common network class.
If the first 3 bits in the address are 110, the address is a class C address.
The net ID is 21 bits long and the host ID is 8 bits long, allowing about 21
million networks and 254 hosts per network.
The range of class C Network is 192.0.0.0 –
223.255.255.0
The 192.0.0.2555 is the broadcast address and 192.0.0.0 is the network address.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 14/62
Class D
Class D addressing is used for multicasting a number of hosts for applications
like audio and video conferencing.
Class D networks have the first 4 bits in the network part = 1110.
The first octet ranges from 224 – 239.
All the addressees from 224.0.0.0 to 239.255.255.255 can be used as multicast
address.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 15/62
All students in Internet Class!
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 16/62
• A host ID that contains all 1s is meant to broadcast the
packet to all hosts specified by the network.
• If the network ID also contains all 1s the packet is
broadcast on the local network.
• A host ID that contains all 0s refers to the networkspecified by the network ID , rather than to a host.
• A source may send all 0s in the source address while trying
to find out the correct IP address. The machine is thenidentified by its MAC address.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 17/62
• These are the IP address ranges reserved for private
networks within organizations.
• These addresses will not be allocated by NIC as public IP
address for the internet.
• There is no problem of clash because when a packet goes
outside the organization the local IP address gets translated
into into the public IP address purchased by the
organizations.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 18/62
Private Addressing
– Class A:
• 10.0.0.0 to 10.255.255.255---- 1 Class A network
– Class B:• 172.16.0.0 to 172.31.255.255 ---- 16 contiguous Class B
networks
– Class C:
• 192.168.0.0 to 192.168.255.255--- 255 contiguous Class Cnetworks
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 19/62
• These are IP address ranges reserved for private networks
within organizations.
• These addresses will not be allocated by NIC as public IP
addresses for the Internet.
•There is no problem of clash because when a packet goesoutside the organization the local IP address gets translated
into the public IP address purchased by the organization.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 20/62
Reserved and Available IP
Addresses
Class Address or Range Status
A 0.0.0.0
1.0.0.0 through 126.0.0.0
127.0.0.0
Reserved
Available
Reserved
B 128.0.0.0128.1.0.0 through 191.254.0.0
191.255.0.0
Reserved Available
Reserved
C 192.0.0.0
192.0.1.0 through 223.255.254
223.255.255.0
Reserved
Available
Reserved
D 224.0.0.0 through
239.255.255.255
Multicast group
addresses
E 240.0.0.0 through
255.255.255.254
255.255.255.255
Reserved
Broadcast
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 21/62
• Subnet Addressing : To add another
hierarchical level called the subnet .
• The beauty of the subnet addressing scheme is
that it is oblivious to the network outside the
organization.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 23/62
• An organization has many LANs , each consisting of no more than 100
hosts.
• 7 bits for for host identification in a sub network and other 9 bits areused for identifying the subnetwork.
• Packet with destination IP 150.100. 12.176 arrives
• The subnet mask used is 11111111 11111111 11111111 10000000 =
255.255.255.128
• The router performs the AND between the subnet mask and the IP and
the subnet number becomes 10010110 01100100 00001100 10000000: 150.100.12.128
This number is used to forward the packet to the correct subnetwork.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 24/62
I P Address Classes Exercise
Address Class Network Host
10.2.1.1
128.63.2.100
201.222.5.64
192.6.141.2
130.113.64.16
256.241.201.10
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 25/62
IP Address Classes Exercise
Answers
Address Class Network Host
10.2.1.1
128.63.2.100
201.222.5.64
192.6.141.2
130.113.64.16
256.241.201.10
A
B
C
C
B
Nonexistent
10.0.0.0
128.63.0.0
201.222.5.0
192.6.141.0
130.113.0.0
0.2.1.1
0.0.2.100
0.0.0.64
0.0.0.2
0.0.64.16
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 26/62
Subnet Mask
172 16 0 0
255 255 0 0
255 255 255 0
IP
Address
DefaultSubnet
Mask
8-bit
Subnet
Mask
Network Host
Network Host
Network Subnet Host
Also written as “/16” where 16 represents the number of 1s
in the mask.
Also written as “/24” where 24 represents the number of 1s
in the mask.
11111111 11111111 00000000 00000000
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 27/62
Decimal Equivalents of Bit
Patterns
1 0 0 0 0 0 0 0 = 128
1 1 0 0 0 0 0 0 = 192
1 1 1 0 0 0 0 0 = 224
1 1 1 1 0 0 0 0 = 240
1 1 1 1 1 0 0 0 = 248
1 1 1 1 1 1 0 0 = 252
1 1 1 1 1 1 1 0 = 254
1 1 1 1 1 1 1 1 = 255
128 64 32 16 8 4 2 1
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 28/62
16
Network Host
172 0 0
10101100
11111111
10101100
00010000
11111111
00010000
00000000
00000000
10100000
00000000
00000000
•Subnets not in use — the default
00000010
Subnet Mask without Subnets
172.16.2.160
255.255.0.0
Network
Number
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 29/62
• Network number is extended by eight bits
Subnet Mask with Subnets
16
Network Host
172.16.2.160
255.255.255.0
172 2 0
10101100
11111111
10101100
00010000
11111111
00010000
11111111
00000010
10100000
00000000
00000000
00000010
Subnet
SubnetAddress
1 2 8
1 9 2
2 2 4
2 4 0
2 4 8
2 5 2
2 5 4
2 5 5
S b t M k ith S b t
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 30/62
Subnet Mask with Subnets
(cont.)
Network Host
172.16.2.160
255.255.255.192
10101100
11111111
10101100
00010000
11111111
00010000
11111111
00000010
10100000
11000000
10000000
00000010
Subnet
•
Network number extended by ten bits
16172 2 128
SubnetAddress
1 2 8
1 9 2
2 2 4
2 4 0
2 4 8
2 5 2
2 5 4
2 5 5
1 2 8
1 9 2
2 2 4
2 4 0
2 4 8
2 5 2
2 5 4
2 5 5
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 31/62
Subnet Mask Exercise
Address Subnet Mask Class Subnet
172.16.2.10
10.6.24.20
10.30.36.12
255.255.255.0
255.255.240.0
255.255.255.0
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 32/62
Subnet Mask Exercise Answers
Address Subnet Mask Class Subnet
172.16.2.10
10.6.24.20
10.30.36.12
255.255.255.0
255.255.240.0
255.255.255.0
B
A
A
172.16.2.0
10.6.16.0
10.30.36.0
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 33/62
Broadcast Addresses
172.16.1.0
172.16.2.0
172.16.3.0
172.16.4.0
172.16.3.255(Directed broadcast)
255.255.255.255(Local network broadcast)
X
172.16.255.255(All subnets broadcast)
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 34/62
Addressing Summary Example
16172 2 160
10101100 00010000 1010000000000010 Host
Mask
Subnet
Broadcast
Last
First
172.16.2.160
255.255.255.192
4
1
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 36/62
Addressing Summary Example
10101100
11111111
00010000
11111111 11111111
10100000
11000000
00000010 Host
Mask
Subnet
Broadcast
Last
First
172.16.2.160
255.255.255.192
1
2
3
7
16172 2 160
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 37/62
Addressing Summary Example
10101100
11111111
00010000
11111111 11111111
10100000
11000000
10000000
00000010 Host
Mask
Subnet
Broadcast
Last
First
172.16.2.160
255.255.255.192
1
2
3
4
16172 2 160
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 38/62
Addressing Summary Example
10101100
11111111
00010000
11111111 11111111
10100000
11000000
10000000
00000010
10111111
Host
Mask
Subnet
Broadcast
Last
First
172.16.2.160
255.255.255.192
1
2
3
4
5
6
16172 2 160
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 39/62
Addressing Summary Example
10101100
11111111
00010000
11111111 11111111
10100000
11000000
10000000
00000010
10111111
10000001
Host
Mask
Subnet
Broadcast
Last
First
172.16.2.160
255.255.255.192
1
2
3
4
5
6
16172 2 160
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 40/62
Addressing Summary Example
10101100
11111111
00010000
11111111 11111111
10100000
11000000
10000000
00000010
10111111
10000001
10111110
Host
Mask
Subnet
Broadcast
Last
First
172.16.2.160
255.255.255.192
1
2
3
4
5
6
7
16172 2 160
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 41/62
Addressing Summary Example
10101100
11111111
10101100
00010000
11111111
00010000
11111111
00000010
10100000
11000000
10000000
00000010
10101100 00010000 00000010 10111111
10101100 00010000 00000010 10000001
10101100 00010000 00000010 10111110
Host
Mask
Subnet
Broadcast
Last
First
172.16.2.160
255.255.255.192
1
2
3
4
5
6
7
8
16172 2 160
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 42/62
Routing Demonstration
ARP
192.168.89.20
192.168.89.40
192.168.88.20
192.168.88.40
192.168.89.2
192.168.88.2
192.168.90.2
192.168.90.3
192.168.91.3
192.168.91.4
Router BRouter C
Router A
Layer 2
Layer 2
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 43/62
Routing done by Host
Network
Destination
Netmask Gateway Interface
0.0.0.0 0.0.0.0 192.168.88.2 192.168.88.40
192.168.88.0 255.255.255.0 192.168.88.4
0
192.168.88.40
192.168.88.40 255.255.255.25
5
127.0.0.1 127.0.0.1
Let assume IP packet received by network layer of
host have destination IP 192.168.88.20 and source IP: 192.168.88.40
192.168.88.20
AND
255.255.255.255
192.168.88.20
192.168.88.20
AND
255.255.255.0
192.168.88.0
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 44/62
Routing done by Host NetworkDestination
Netmask Gateway Interface
0.0.0.0 0.0.0.0 192.168.88.2 192.168.88.40
192.168.88.0 255.255.255.0 192.168.88.4
0
192.168.88.40
192.168.88.40 255.255.255.25
5
127.0.0.1 127.0.0.1
Let assume IP packet received by network layer of
host have destination IP 192.168.89.4 and source IP: 192.168.88.40
192.168.89.4
AND
255.255.255.255
192.168.89.4
192.168.89.4
AND
255.255.255.0
192.168.89.0
192.168.89.4
AND
0.0.0.0
0.0.0.0
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 45/62
NetworkDestination
Netmask Gateway Interface
0.0.0.0 0.0.0.0 192.168.90.3 192.168.90.2
192.168.88.0 255.255.255.
0
192.168.88.2 192.168.88.2
192.168.89.0 255.255.255.
0
192.168.89.2 192.168.89.2
192.168.90.0 255.255.255.
0
192.168.90.2 192.168.90.2
192.168.91.0 255.255.255.0
192.168.90.3 192.168.90.2
Let assume IP packet received by layer 3
have destination IP 192.168.89.4 and source IP: 192.168.88.40
192.168.89.4
AND
255.255.255.0
192.168.89.0
Routing Done Router A
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 46/62
NetworkDestination
Netmask Gateway Interface
0.0.0.0 0.0.0.0 192.168.91.4 192.168.91.3
192.168.88.0 255.255.255.0 192.168.90.2 192.168.90.3
192.168.89.0 255.255.255.0 192.168.90.2 192.168.90.3192.168.90.0 255.255.255.0 192.168.90.3 192.168.90.3
192.168.91.0 255.255.255.0 192.168.91.3 192.168.91.3
Routing Done by Router B
Let assume IP packet received by Router A
have destination IP 192.168.92.5 and source IP: 192.168.88.40
192.168.92.5
AND
255.255.255.0
192.168.92.0
192.168.92.5
AND
0.0.0.0
0.0.0.0
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 47/62
Dynamic Routing
Routing Protocol
Interior Gateway Protocol Exterior Gateway Protocol
Open Shortest Path First Routing Information Protocol
Border Gateway Protocol
Dijkstra Algorithm Bellman Ford Algorithm
Link State Protocol Distance Vector Protocol
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 48/62
Address Resolution Protocol• The address resolution protocol (ARP) is used when
one host wants to get the physical address of
another host on the same network.
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 49/62
Address Resolution Protocol
Ignored
Ignored
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 50/62
Address Resolution Protocol
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 51/62
Address Resolution
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 52/62
Fragmentation and Reassembly
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 53/62
IPv6
8/12/2019 ipaddr-1217448089978438-9
http://slidepdf.com/reader/full/ipaddr-1217448089978438-9 61/62
USER DATAGRAM PROTOCOL