ccnet-lec-10-ip-nat[1]
TRANSCRIPT
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
1/34
Lecture
10Data Communication & Networks
Internet Protocol (IP)
Muhammad Yousaf
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
2/34
Internet Protocol: (IP)
IP is a layer-3 protocolStandardized by IETF as RFC-791
Backbone of the Internet
Internet is the network of networks
Thousands of networks are interconnected with eachother via routers
Routers forward packets on the basis of IP
Thats why, routers are also termed as layer-3devices
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
3/34
Network of Networks:
Router, Aninterconnecting
node
Network-3Network-2
Network-1
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
4/34
Functionality of IP:
IP is a connectionless protocolProvides no guarantees, a best effort protocol
It performs the following important communicationtasks:
Global Addressing
Fragmentation & Reassembly
Packet Forwarding
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
5/34
TCP / IP protocol stack:
Source Router-1 Router-2 Destination
Physical
Data Link
IP
TCP | UDP
Application
Physical
Data Link
IP
Physical
Data Link
IP
TCP | UDP
Application
Physical
Data Link
IP
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
6/34
IP header:
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
7/34
IP header fields:
Version:Should have value 4 for IPv4Newer 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
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
8/34
IP header fields: cont
Identification:All fragments of the same message have sameidentification value
Helps to reassemble fragments of the same message
Flags:DF = dont fragmentMF = more fragments
Fragment Offset:
Measured in multiple of 8-bytesContains offset of fragment from the beginning of theoriginal message
Helps to in-order reassembly of fragments
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
9/34
Fragmentation example:
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
10/34
IP header fields: cont
Time To Live: (TTL)Is initialized by originator of packetDecremented by one at each intermediate router
If value of TTL is not zero then node process the packetotherwise discard the packet
Helps to limit the lifetime of packets
Protocol:Defines the upper layer protocol that will handle thepacket
e.g. TCP=6, UDP=17
Header Checksum:Is used to detect any error in header during transmission
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
11/34
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 routingdecision
Options:Optional field
e.g. source routing, timestamp, etcPadding:
Ensures that the packet is aligned to 32-bit boundary
Only used when optional field is used
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
12/34
IP Address:
IPv4 are 32-bit addressesRepresented as four 8-bit integer valuesCalled 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/addressesi.e. MAC addresses
Our current discussion is related to the IPv4 addresses
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
13/34
IP address of my system:
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
14/34
IPv4 Address classes:
IP address is divided in subparts:IP address = Network Part + Host PartNumber of bits assigned to network part or host part isnot fix
All nodes in a single network share commonnetwork part, but have different host part
Routers take forwarding decision only on the basisof network part
How many bits are assigned to network part iscritical
Historically it is determined by the class of IPaddress
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
15/34
Assigning IP addresses:
NW = 192.68.5NW = 130.10
NW = 70
70.0.0.100
70.160.0.10170.0.5.102
130.10.2.100
130.10.4.102 130.10.2.101
192.68.5.10
192.68.5.11192.68.5.12
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
16/34
IP Address classes:
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
17/34
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
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
18/34
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 usedIdea was to reserve this range for future use
e.g. for experimentation purpose
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
19/34
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.254Used for loopback testing even when system is not connected with network
Private Address Space:
Doesnt need to purchase these addresses
Reserved for local use. Routers dont forward packets with these addresses
Hence are not globally uniqueFrom 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)
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
20/34
Global Uniqueness of IP addresses:
To communicate over global Internet, node shouldhave globally unique address
IANA is the global authority that is responsible forassigning 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 InternetArchitecture Board (IAB)
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
21/34
IANAs 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
Rseaux IP Europens (RIPE)
Manages Europe & North Africa
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
22/34
Obtaining Global IP address:
Regional Organizations like APNIC doesnt provideIP addresses directly to individual users
Internet Service Providers (ISPs) can purchase IPaddresses only in blocks
ISPs then provide these globally unique IPaddresses to its subscribers
ISP allocates these addresses either statically or
dynamically
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
23/34
Obtaining Global IP address:
Static IP Address:Assigned permanently
Servers normally need addresses that are not changedover time
Cost is higher
Dynamic IP Address:Assigned temporarily
Can have new address in each session
Clients normally doesnt require permanent address
Services like DHCP, can manage dynamic addressassignment
Relatively of low cost
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
24/34
NAT / NAPT:
Globally Unique IP addresses are precious
Organizations cant afford to purchase hundreds ofIP addresses for their LAN users
They often purchase small number of global IP
addresses, and operate their all LAN users withthem
Think! As a LAN user while connecting overInternet, you never use global addresses
There are two schemes:Network Address Translation (NAT)
Network Address & Port Translation (NAPT)
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
25/34
NAT / NAPT Box:
Internet
NAT Box
Local networkwith many hosts
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
26/34
Network Address Translation:
Purchase a pool of global IP addresses
Assign local private addresses inside the LAN
LAN users will use local addresses for localcommunication
When they wish to communicate globally, nodeswill 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 userThis is called translation from local address toglobal address
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
27/34
NAT: cont
NAT box will maintain a table for all thesetranslations
When replies will arrive from the Internet,
NAT box will again translate the addresses,
but now from global address to the local address
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
28/34
Example of NAT Box:
Internet
SA=192.168.0.11
(local)
SA=192.168.0.12(local)
SA=192.168.0.13(local)
SA=202.113.29.124(global)
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
29/34
Static vs. Dynamic NAT
29Source: http://computer.howstuffworks.com/nat1.htm (05-11-2010)
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
30/34
NAPT:
Network Address and Port Translation (NAPT)Also called Overloading NAT
And also Port Address Translation (PAT)
Rather than purchasing a pool of addresses, lets
put up with only single IP addressSame global address will be used for all LAN users
Uniqueness is maintained via port numbers
Very economical scheme
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
31/34
NAPT:
31Source: http://computer.howstuffworks.com/nat1.htm (05-11-2010)
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
32/34
Translation through NAPT:
32
Source: http://www.exfo.com/en/Library/WaveReview/WRArticle.aspx?Id=204 (08-11-2010)
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
33/34
-
8/6/2019 ccnet-lec-10-IP-NAT[1]
34/34
myousaf@ymail com 34
To be continued