logical addressing - mehran uet...
TRANSCRIPT
LOGICAL ADDRESSING
Faisal Karim [email protected]
DEWSNet GroupDependable Embedded Wired/Wireless Networks
www.fkshaikh.com/dewsnet
IPv4 ADDRESSESIPv4 ADDRESSES
AnAn IPvIPv44 addressaddress isis aa 3232--bitbit addressaddress thatthat uniquelyuniquely andanduniversallyuniversally definesdefines thethe connectionconnection ofof aa devicedevice (for(forexample,example, aa computercomputer oror aa router)router) toto thethe InternetInternet..
Address SpaceNotationsClassful AddressingClassless Addressing
Topics discussed in this section:Topics discussed in this section:
An IPv4 address is 32 bits long.
Note
The IPv4 addresses are unique and universal.
Note
The address space of IPv4 is 232 or 4,294,967,296.
Note
Figure 1 Dotted-decimal notation and binary notation for an IPv4 address
Change the following IPv4 addresses from binarynotation to dotted-decimal notation.
Example 1
SolutionWe replace each group of 8 bits with its equivalentdecimal number and add dots for separation.
Change the following IPv4 addresses from dotted-decimalnotation to binary notation.
Example 2
SolutionWe replace each decimal number with its binaryequivalent
Find the error, if any, in the following IPv4 addresses.
Example 3
Solutiona. There must be no leading zero (045).b. There can be no more than four numbers.c. Each number needs to be less than or equal to 255.d. A mixture of binary notation and dotted-decimal
notation is not allowed.
In classful addressing, the address space is divided into five classes:
A, B, C, D, and E.
Note
Figure 2 Finding the classes in binary and dotted-decimal notation
Find the class of each address.a. 00000001 00001011 00001011 11101111b. 11000001 10000011 00011011 11111111c. 14.23.120.8d. 252.5.15.111
Example 4
Solutiona. The first bit is 0. This is a class A address.b. The first 2 bits are 1; the third bit is 0. This is a class C
address.c. The first byte is 14; the class is A.d. The first byte is 252; the class is E.
Table 1 Number of blocks and block size in classful IPv4 addressing
In classful addressing, a large part of the available addresses were wasted.
Note
Table 2 Default masks for classful addressing
Classful addressing, which is almost obsolete, is replaced with classless
addressing.
Note
Figure 19.3 shows a block of addresses, in both binaryand dotted-decimal notation, granted to a small businessthat needs 16 addresses.
We can see that the restrictions are applied to this block.The addresses are contiguous. The number of addressesis a power of 2 (16 = 24), and the first address is divisibleby 16. The first address, when converted to a decimalnumber, is 3,440,387,360, which when divided by 16results in 215,024,210.
Example 5
Figure 3 A block of 16 addresses granted to a small organization
In IPv4 addressing, a block of addresses can be defined as
x.y.z.t /nin which x.y.z.t defines one of the
addresses and the /n defines the mask.
Note
The first address in the block can be found by setting the rightmost
32 − n bits to 0s.
Note
A block of addresses is granted to a small organization.We know that one of the addresses is 205.16.37.39/28.What is the first address in the block?
SolutionThe binary representation of the given address is
11001101 00010000 00100101 00100111If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 0010000or
205.16.37.32. This is actually the block shown in Figure 19.3.
Example 6
The last address in the block can be found by setting the rightmost
32 − n bits to 1s.
Note
Find the last address for the block in Example 19.6.
SolutionThe binary representation of the given address is
11001101 00010000 00100101 00100111If we set 32 − 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111or
205.16.37.47This is actually the block shown in Figure 19.3.
Example 7
The number of addresses in the block can be found by using the formula
232−n.
Note
Find the number of addresses in Example 6.
Example 8
SolutionThe value of n is 28, which means that numberof addresses is 2 32−28 or 16.
Another way to find the first address, the last address, andthe number of addresses is to represent the mask as a 32-bit binary (or 8-digit hexadecimal) number. This isparticularly useful when we are writing a program to findthese pieces of information. In Example 19.5 the /28 canbe represented as
11111111 11111111 11111111 11110000(twenty-eight 1s and four 0s).
Finda. The first addressb. The last addressc. The number of addresses.
Example 9
Solutiona. The first address can be found by ANDing the given
addresses with the mask. ANDing here is done bit bybit. The result of ANDing 2 bits is 1 if both bits are 1s;the result is 0 otherwise.
Example 9 (continued)
b. The last address can be found by ORing the givenaddresses with the complement of the mask. ORinghere is done bit by bit. The result of ORing 2 bits is 0 ifboth bits are 0s; the result is 1 otherwise. Thecomplement of a number is found by changing each 1to 0 and each 0 to 1.
Example 9 (continued)
c. The number of addresses can be found bycomplementing the mask, interpreting it as a decimalnumber, and adding 1 to it.
Example 9 (continued)
Figure 4 A network configuration for the block 205.16.37.32/28
The first address in a block is normally not assigned to any device; it is used as the network address that
represents the organization to the rest of the world.
Note
Figure 5 Two levels of hierarchy in an IPv4 address
Figure 6 A frame in a character-oriented protocol
Each address in the block can be considered as a two-level
hierarchical structure: the leftmost n bits (prefix) define
the network;the rightmost 32 − n bits define
the host.
Note
Figure 7 Configuration and addresses in a subnetted network
Figure 8 Three-level hierarchy in an IPv4 address
An ISP is granted a block of addresses starting with190.100.0.0/16 (65,536 addresses). The ISP needs todistribute these addresses to three groups of customers asfollows:a. The first group has 64 customers; each needs 256
addresses.b. The second group has 128 customers; each needs 128
addresses.c. The third group has 128 customers; each needs 64
addresses.Design the subblocks and find out how many addressesare still available after these allocations.
Example 10
SolutionFigure 19.9 shows the situation.
Example 10 (continued)
Group 1For this group, each customer needs 256 addresses. Thismeans that 8 (28 256) bits are needed to define each host.The prefix length is then 32 − 8 = 24. The addresses are
Example 10 (continued)
Group 2For this group, each customer needs 128 addresses. Thismeans that 7 (27 128) bits are needed to define each host.The prefix length is then 32 − 7 = 25. The addresses are
Example 10 (continued)
Group 3For this group, each customer needs 64 addresses. Thismeans that 6 (26 64) bits are needed to each host. Theprefix length is then 32 − 6 = 26. The addresses are
Number of granted addresses to the ISP: 65,536Number of allocated addresses by the ISP: 40,960Number of available addresses: 24,576
Figure 9 An example of address allocation and distribution by an ISP
Techniques to reduce addressshortage in IPv4
Subnetting Classless Inter Domain Routing (CIDR) Network Address Translation (NAT)
Network Address Translation Each organization-
single IP address Within organization –
each host with IP unique to the orgn., from reserved set of IP addresses
NAT Example
SourceComputer
SourceComputer'sIP Address
SourceComputer's
Port
NAT Router'sIP Address
NAT Router'sAssigned
Port Number
A 10.0.0.1 400 24.2.249.4 1
B 10.0.0.2 50 24.2.249.4 2
C 10.0.0.3 3750 24.2.249.4 3
D 10.0.0.4 206 24.2.249.4 4
10.0.0.4
10.0.0.1
B
C
NAT (continued)
•Advantages:
– Reduce the need of public addresses
– Ease the internal addressing plan
– Transparent to some applications
– “Security” vs obscurity– Clear delimitation point for ISPs.
• Disadvantages:– Translation sometime complex (e.g.
FTP, VOIP).– Apps using dynamic ports (UPnP).– Does not scale (today avg. of 500
active sessions per user). – Introduce states inside the network:
• Multi-homed networks– Breaks the end-to-end paradigm.– Security with IPsec.– Difficulties for operations when done
inside a Provider network.
CIDR + NATToday 17% Left
Would increased use ofNATs be adequate?
NO! NAT enforces a ‘client-server’ application model where the server has
topological constraints. They won’t work for peer-to-peer or devices that are “called” by
others (e.g., IP phones) They inhibit deployment of new applications and services, because all
NATs in the path have to be upgraded BEFORE the application can be deployed.
NAT compromises the performance, robustness, and security of the Internet.
NAT increases complexity and reduces manageability of the local network.
Public address consumption is still rising even with current NAT deployments.
What were the goals of anew IP design? Expectation of a resurgence of “always-on”
technologies xDSL, cable, Ethernet-to-the-home, Cell-phones, etc.
Expectation of new users with multiple devices. China, India, Pakistan etc. as new growth Consumer appliances as network devices
(1015 endpoints)
Expectation of millions of new networks. Expanded competition and structured delegation.
(1012 sites)
Why is IPv4 to IPv6 transition so important?
IPv6 is a Network Protocol with many more addresses than IPv4:
340,282,366,920,938,463,374,607,431,768,211,456 available addresses.
With so many addresses we can overcome the shortage in IPv4 supply and continuing support the growth of Internet.
In IPv6 some tasks are simpler than in IPv4: (Auto-configuration, Renumbering, Multicast, IP Mobility, etc.)
IPv6 Enables Innovation. Particularly for applications without NAT
What is IPv6 in one page
Things that change in IPv6, that are good to know:
IPv6 addresses are represented by Hexadecimal numbers. Example: 2001:DB8:12FF:1231:FFB5::F9DA/64.
In IPv6 there is not Network Mask, only Prefix Length.
In IPv6 the header is always 40 bytes long, extensions are listed as “nextheader”.
In IPv6 there is no Broadcast, only Multicast.
In IPv6 there is no ARP or IGMP, ICMPv6 takes those jobs.
In IPv6 routers do not fragment, only Terminals. Path MTU Discover isMandatory.
IPv6 header does not include a checksum, so if designing software, UDP checksum is mandatory.
0 31
Ver IHL Total Length
Identifier Flags Fragment Offset
32 bit Source Address
32 bit Destination Address
4 8 2416
Service Type
Options and Padding
Time to Live Header Checksum Protocol
The IPv4 Header20 octets + options : 13 fields, including 3 flag bits
0 31
Version Class Flow Label
Payload Length Next Header Hop Limit
128 bit Source Address
128 bit Destination Address
4 12 2416
The IPv6 Header40 Octets, 8 fields
Summary of Header Changesbetween IPv4 & IPv6
Streamlined Fragmentation fields moved out of base header IP options moved out of base header Header Checksum eliminated Header Length field eliminated Length field excludes IPv6 header Alignment changed from 32 to 64 bits
Revised Time to Live Hop Limit Protocol Next Header Precedence & TOS Traffic Class Addresses increased 32 bits 128 bits
Extended Flow Label field added
Extension Headers
next header =TCP
TCP header + data
IPv6 header
next header =Routing
TCP header + dataRouting header
next header =TCP
IPv6 header
next header =Routing
fragment of TCPheader + data
Routing header
next header =Fragment
Fragment header
next header =TCP
IPv6 header
Extension Headers (cont.)
Generally processed only by node identified in IPv6 Destination Address field => much lower overhead than IPv4 options processing exception: Hop-by-Hop Options header
Eliminated IPv4’s 40-byte limit on options in IPv6, limit is total packet size,
or Path MTU in some cases Currently defined extension headers:
Hop-by-Hop Options, Routing, Fragment, Authentication, Encryption, Destination Options
Fragment Header
though discouraged, can use IPv6 Fragment header to support upper layers that do not (yet) do path MTU discovery
IPv6 frag. & reasm. is an end-to-end function; routers do not fragment packets en-route if too big—they send ICMP “packet too big” instead
Next Header
Original Packet Identifier
Reserved Fragment Offset 0 0 M
IPv4 and IPv6 dual reference stacks
Data link / physical layers Ethernet PPP HDLC …
IP (v4) IP (v6)
TCP UDP …
DNS SSH SMTP HTTP…
Network layer
Transport layer
Application layer
IGMP ICMP ARPICMPv6
IPv6 Mobility
Mobile hosts have one or more home address relatively stable; associated with host name in DNS
A Host will acquire a foreign address when it discovers it is in a foreign subnet (i.e., not its home subnet) uses auto-configuration to get the address registers the foreign address with a home agent,
i.e, a router on its home subnet
Packets sent to the mobile’s home address(es) are intercepted by home agent and forwarded to the foreign address, using encapsulation
Mobile IPv6 hosts will send binding-updates to correspondent to remove home agent from flow
Mobile IP (v4 version)
home agent
home location of mobile host
foreign agent
mobile host
correspondenthost
Mobile IP (v4 version)
home agent
home location of mobile host
foreign agent
mobile host
correspondenthost
Mobile IP (v4 version)
home agent
home location of mobile host
foreign agent
mobile host
correspondenthost
Mobile IP (v4 version)
home agent
home location of mobile host
foreign agent
mobile host
correspondenthost
Mobile IP (v6 version)
home agent
home location of mobile host
mobile host
correspondenthost
Mobile IP (v6 version)
home agent
home location of mobile host
mobile host
correspondenthost
Mobile IP (v6 version)
home agent
home location of mobile host
mobile host
correspondenthost
Mobile IP (v6 version)
home agent
home location of mobile host
mobile host
correspondenthost
Mobile IP (v6 version)
home agent
home location of mobile host
mobile host
correspondenthost