(Subnet) Addresses - JNNCE ECE Manjunath

advertisement
Unit –6
Network Layer:
Logical Addressing
04\08\2010
Unit-VI Network Layer
1
Overview
•
•
04\08\2010
Ipv4 addresses
Ipv6 addresses
Unit-VI Network Layer
2
ADDRESSING
Four levels of addresses are used in an internet
employing the TCP/IP protocols: physical, logical, port,
and specific.
04\08\2010
Unit-VI Network Layer
3
Physical Addressing
•
A network adapter has a unique and permanent physical
address.
•
A Physical address is also called MAC address is a 48bit flat address burned into the ROM of the NIC (Network
Interface Card) card at the factory which is a Layer1 device
of the OSI model.
•
On a local area network, low-lying hardware-conscious
protocols deliver data across the physical network using
the adapter's physical address.
•
On a basic ethernet network, for example, a computer
sends messages directly onto the transmission medium.
•
The network adapter of each computer listens to every
transmission on the local network to determine whether a
message is addressed to its own physical address.
04\08\2010
Unit-VI Network Layer
4
Physical Addressing
04\08\2010
Unit-VI Network Layer
5
Logical Addressing
•
A Logical address also called IP address is a 32- bit
address assigned to each system in a network.
•
This works in Layer-3 of OSI Model.
•
This would be generally the IP address.
04\08\2010
Unit-VI Network Layer
6
Logical Addressing
04\08\2010
Unit-VI Network Layer
7
Logical Addressing
04\08\2010
Unit-VI Network Layer
8
Logical Addressing
04\08\2010
Unit-VI Network Layer
9
Logical Addressing
04\08\2010
Unit-VI Network Layer
10
IP Addresses
04\08\2010
Unit-VI Network Layer
11
The physical addresses will change from hop to hop,
but the logical addresses usually remain the same.
04\08\2010
Unit-VI Network Layer
12
Port Address
A single wire connects the network to the distant computer, but
there may be many applications on that machine-a web server,
an ftp server, a telnet server, etc.-waiting for somebody to
connect.
So the question arises: How do you use one wire and one IP
address to connect to the right application? The answer: Ports.
Port address is transport layer ID (similar to IP in Network
Layer) which identify the application on the host.
A port address is a 16-bit address represented by one
decimal number as shown.
Telnet
Mail (smtp, or send mail)
World Wide Web
Post Office (pop, or get mail)
News (nntp)
04\08\2010
Port
Port
Port
Port
Port
23
25
80
110
119
Unit-VI Network Layer
13
IPv4 ADDRESSES
04\08\2010
Unit-VI Network Layer
14
IPv4 ADDRESSES
An IPv4 address is a 32-bit address that uniquely and
universally defines the connection of a device (for
example, a computer or a router) to the Internet.
•
•
•
•
04\08\2010
Address Space Notations
Classful Addressing
Classless Addressing
Network Address Translation (NAT)
Unit-VI Network Layer
15
IPv4 ADDRESSES
• IPv4 protocol address has an address space
• An address is the total number of addresses used by the
protocol.
• If a protocol uses N bits to define an address the address
space is 2N value.
•
•
•
•
Notations
Binary Notation and Dotted Decimal Notation
Binary Notation: 32 bits are used each octet is referred as
byte, 4 byte address
Dotted Decimal Notation: Written in Decimal point and each
byte is separated by dots.
04\08\2010
Unit-VI Network Layer
16
IPv4 ADDRESSES
An IPv4 address is 32 bits long.
The IPv4 addresses are unique and universal.
• An IP address is a 32-bit sequence of 1s and 0s.
• To make the IP address easier to use, the address
is usually written as four decimal numbers
separated by periods.
• This way of writing the address is called the dotted
decimal format.
The address space of IPv4 is 232 or 4,294,967,296.
04\08\2010
Unit-VI Network Layer
17
Classful Addressing
04\08\2010
Unit-VI Network Layer
18
Internet Addresses (IP Addresses)
Defined when IP was standardized in 1981
IP addresses are 32-bit long and consist of:
• a network address part – network identifier
• a host address part – host number within that network
IP addresses are grouped into classes (A,B,C)
depending on the size of the network identifier
and the host part of the address
A fourth class (Class D) was defined later (1988)
for Multicast addresses
04\08\2010
Unit-VI Network Layer
19
Internet Address Classes
Class A
• 126 networks (0 and 127 reserved) (1 byte starts from but
•
MSB bit is always 0)
Assigned to very large size networks where number of
hosts 65K to16M
Class B
• 16384 networks
• Assigned to Intermediate size networks where number of
hosts 256 to 65K
Class C
• 2097152 networks
• Assigned to smaller networks where #hosts < 256
04\08\2010
Unit-VI Network Layer
20
Finding the classes in binary and dotted-decimal notation
Number of blocks and block size in classful IPv4 addressing
04\08\2010
Unit-VI Network Layer
21
Every IP address has two parts:
1. Network
2. Host
IP addresses are divided
into classes A,B and C to
define large, medium,
and small networks.
The Class D address was
created to enable multicasting.
IETF reserves Class E
addresses for its own research.
04\08\2010
Unit-VI Network Layer
22
Reserved IP ADDRESSES
Certain host addresses
are reserved and cannot
be assigned to devices on
a network.
An IP address that has
binary 0s in all host bit
positions is reserved for
the network address.
An IP address that has
binary 1s in all host bit
positions is reserved for
the broadcast address.
04\08\2010
Unit-VI Network Layer
23
Example
Change the following IPv4 addresses from binary notation
to dotted-decimal notation.
Solution
04\08\2010
Unit-VI Network Layer
24
Example
Change the following IPv4 addresses from dotted-decimal
notation to binary notation.
Solution
04\08\2010
Unit-VI Network Layer
25
Example
Find the error, if any, in the following IPv4 addresses.
Solution
a. 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.
04\08\2010
Unit-VI Network Layer
26
Example
Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111
Solution
a. 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.
04\08\2010
Unit-VI Network Layer
27
Netid and Hostid
Netid and Hostid
In classful addressing an IP address in class A,B, C is divided
into netid and hostid
In class A one byte defines the netid and 3 bytes defines the
host ID
In class B 2 byte defines the netid and 2 bytes defines the
host ID
In class C 3 byte defines the netid and 1 bytes defines the
host ID
04\08\2010
Unit-VI Network Layer
28
Mask
Mask
The mask helps to find the netid and hostid
In class A first 8 bits defines the netid; the next 24 bits hostid,
hence in this first 8 are 1s.
/n i.e 8 or 16 or 24 shows the mask for each class.
This /n notation is called Classless Interdomain Routing
(CIDR)
Default masks for classful addressing
04\08\2010
Unit-VI Network Layer
29
Subnets
04\08\2010
Unit-VI Network Layer
30
Problems with Classes
Class A usually too big
Class C often too small
Not enough Class Bs
Inefficient utilisation of address space
Solution: Extending the network part of the address:
Subnetting
In classful addressing, a large part of the available
addresses were wasted.
04\08\2010
Unit-VI Network Layer
31
Subnetting
Subnets
.
A campus network consisting of LANs for various departments
04\08\2010
Unit-VI Network Layer
32
Subnetting
Subnet Mask
Subnet masks are applied to an IP address to identify the
Network portion and the Host portion of the address.
A bitwise logical AND operation between the address and
the subnet mask s performed in order to find the Network
Address or number.
Default Subnet Masks
Class A - 255.0.0.0
• 11111111.00000000.00000000.00000000
Class B - 255.255.0.0
• 11111111.11111111.00000000.00000000
Class C - 255.255.255.0
• 11111111.11111111.11111111.00000000
04\08\2010
Unit-VI Network Layer
33
Subnetting
Logical Bitwise AND Operation
Example
• 140.179.240.200
It’s a Class B, so the subnet mask is:
• 255.255.0.0
In Binary:
10001100.10110011.11110000.11001000
11111111.11111111.00000000.00000000
10001100.10110011.00000000.00000000
By doing this, the computer has found that Network Address
is 140.179.0.0
04\08\2010
Unit-VI Network Layer
34
Subnetting
Another Example:
Suppose we have the address of: 206.15.143.89?
What class is it?
Class C
What is the subnet mask?
255.255.255.0
What is the Network Address?
206.15.143.0
What is the host portion of the address?
0.0.0.89
04\08\2010
Unit-VI Network Layer
35
Subnetting
You can manipulate your subnet mask in order to create
more network addresses.
If you have a Class C network, how many individual host
addresses can you have?
• 1 to 254
• Remember, you can’t have all “0”s and all “1”s in the
host portion of the address (Reserved address).
• So we cannot use 206.25.143.0 (all “0”s) or
206.25.143.255 (all “1”s) as a host address.\
• Remember, an address of all “0”s or all “1”s cannot
be used in the last octet (or host portion). All “0”s
signify the Network Address and all “1”s signify the
broadcast address
04\08\2010
Unit-VI Network Layer
36
Subnetting
Example
We have 1 Class C Network (206.15.143.0)
And we have 254 host address (1 to 254)
But what if our LAN has 5 networks in it and each network
has no more than 30 hosts on it?
Do we apply for 4 more Class C licenses, so we have one
for each network?
We would be wasting 224 addresses on each network, a
total of 1120 addresses
04\08\2010
Unit-VI Network Layer
37
Subnetting
Subnetting is a way of taking an existing class license
and breaking it down to create more Network Addresses.
This will always reduce the number of host addresses for
a given network.
Subnetting makes more efficient use of the address.
04\08\2010
Unit-VI Network Layer
38
Subnetting
How Does Subnetting Work?
Additional bits can be added (changed from 0 to
1) to the subnet mask to further subnet, or
breakdown, a network.
When the logical AND is done by the computer,
the result will give it a new Network (or Subnet)
Address.
04\08\2010
Unit-VI Network Layer
39
Subnetting
We ask our ISP for a Class C license.
They give us the Class C bank of 206.15.143.0
This gives us 1 Network (206.15.143.0) with the potential
for 254 host addresses (206.15.143.1 to 206.15.143.254).
But we have a LAN made up of 5 Networks with the largest
one serving 25 hosts.
So we need to Subnet our 1 IP address...
04\08\2010
Unit-VI Network Layer
40
Subnetting
So How Does This Work?
To calculate the number of subnets (networks) and/or
hosts, we need to do some math:
Use the formula 2n-2 where the n can represent either
how many subnets (networks) needed OR how many
hosts per subnet needed (where -2 is 000000000 and
11111111 addresses are not used).
04\08\2010
Unit-VI Network Layer
41
Subnetting
So How Does This Work?
We know we need at least 5 subnets. So 23-2
will give us 6 subnet addresses (Network
Addresses).
We know we need at least 25 hosts per network.
25-2 will give us 30 hosts per subnet (network).
This will work, because we can steal the first 3
bits from the host’s portion of the address to give
to the network portion and still have 5 (8-3) left
for the host portion:
04\08\2010
Unit-VI Network Layer
42
Subnetting
Break it down:
Let’s go back to what portion is what:
We have a Class C address:
NNNNNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH
With a Subnet mask of:
11111111.11111111.11111111.00000000
We need to steal 3 bits from the host portion to give
it to the Network portion:
NNNNNNNN.NNNNNNNN.NNNNNNNN.NNNHHHHH
04\08\2010
Unit-VI Network Layer
43
Subnetting
Break it down:
NNNNNNNN.NNNNNNNN.NNNNNNNN.NNNHHHHH
This will change our subnet mask to the following:
11111111.11111111.11111111.11100000
Above is how the computer will see our new subnet mask,
but we need to express it in decimal form as well:
255.255.255.224
04\08\2010
128+64+32=224
Unit-VI Network Layer
44
Subnetting
What address is what?
Which of our 254 addresses will be a Subnet (or
Network) address and which will be our host addresses?
Because we are using the first 3 bits for our subnet
mask, we can configure them into eight different ways
(binary form):
04\08\2010
Unit-VI Network Layer
45
Subnetting
What address is what?
Which of our 254 addresses will be a Subnet (or
Network) address and which will be our host
addresses?
Because we are using the first 3 bits for our
subnet mask, we can configure them into eight
different ways (binary form):
000
001
010
011
100
101
110
111
04\08\2010
Unit-VI Network Layer
46
Subnetting
What address is what?
We cannot use all “0”s or all “1”s
000
001
010
011
100
101
110
111
•We are left with 6 useable network numbers.
04\08\2010
Unit-VI Network Layer
47
Subnetting
Network (Subnet) Addresses
Remember our values:
128
64
32
16
8
Now our 3 bit configurations:
0
0
1
H
H
0
1
0
H
H
0
1
1
H
H
1
0
0
H
H
1
0
1
H
H
1
1
0
H
H
04\08\2010
Unit-VI Network Layer
4
2
1
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
Equals
32
64
96
128
160
192
48
Subnetting
Network (Subnet) Addresses
0
0
0
1
1
1
0
1
1
0
0
1
1
0
1
0
1
0
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
32
64
96
128
160
192
Each of these numbers becomes the Network
Address of their subnet...
04\08\2010
Unit-VI Network Layer
49
Subnetting
Network (Subnet) Addresses
206.15.143.32
206.15.143.64
206.15.143.96
206.15.143.128
206.15.143.160
206.15.143.192
04\08\2010
Unit-VI Network Layer
50
Subnetting
host Addresses
The device assigned the first address will receive the
first number AFTER the network address shown before.
0
0
206.15.143.33 or 32+1
1
0
0
0
0
1
And the last address in the Network will look like this:
0
0
1
206.15.143.62
1
1
1
1
0
*Remember, we cannot use all “1”s, that is the broadcast
address (206.15.143.63)
04\08\2010
Unit-VI Network Layer
51
Subnetting
Host Addresses
The next network will start at 206.15.143.64
The first IP address on this subnet network will receive:
206.15.143.65
0
1
0
0
0
0
0
1
And the last address in the Network will receive:
206.15.143.94
0
1
0
1
1
1
1
0
*Remember, the broadcast address (206.15.143.95)
04\08\2010
Unit-VI Network Layer
52
Subnetting
Can you figure out the rest?
Network:
206.15.143.32
206.15.143.64
206.15.143.96
206.15.143.128
206.15.143.160
206.15.143.192
04\08\2010
Host Range
206.15.143.32 to 206.15.143.62
206.15.143.65 to 206.15.143.94
206.15.143.97 to 206.15.143.126
206.15.143.129 to 206.15.143.158
206.15.143.161 to 206.15.143.190
206.15.143.193 to 206.15.143.222
Unit-VI Network Layer
53
Subnetting
How the computer finds the Network Address:
200.15.143.89 An address on the subnet
225.225.225.224 The new subnet mask
When the computer does the Logical Bitwise AND Operation
it will come up with the following Network Address (or Subnet
Address):
11001000.00001111.10001111.01011001= 200.15.143.89
11111111.11111111.11111111.11100000 = 255.255.255.224
11001000.00001111.10001111.01000000 = 200.15.143.64
This address falls on our 2nd Subnet (Network)
04\08\2010
Unit-VI Network Layer
54
Classless Addressing
04\08\2010
Unit-VI Network Layer
55
Classless Addressing
Classfull Addressing: drawbacks
Classful Addressing + Subnetting
• at least one route per class is advertised in
routing updates
Number of networks is doubling faster than once
per year
Memory is not growing that fast
Only a few routers can keep the current number
of routes
04\08\2010
Unit-VI Network Layer
56
Classless Addressing
Overview: (Classful) IPv4 Addressing Limits
Provides IP scheme with limitations:
• Class A – 126 networks: 16,777,214 hosts each
• Class B – 65,000 networks: 65,534 hosts each
• Class C – 2 million networks: 254 hosts each
While available addresses were running
out, only 3% of assigned addresses
were actually being used!
• Subnet zero, broadcast addresses,
pool of unused addresses at
Class A and B sites, etc.
04\08\2010
Unit-VI Network Layer
57
Classless Addressing
Introduced by CIDR - Classless Inter Domain Routing
Networks are grouped (aggregated) into blocks
Blocks of networks are advertised
New way of thinking:
• There are no network numbers, but just address space
prefixes
• There are no subnet masks, just prefix lengths
Classless addresses notation
10.181.215.32 /27
10.181.215.32 with mask 255.255.255.224
Binary representation of mask:
11111111.11111111.11111111.11100000
04\08\2010
Unit-VI Network Layer
58
Classless Address Notation
04\08\2010
Hosts
Prefix
Classful
Subnet Mask
...
...
...
...
8
/29
255.255.255.248
16
/28
255.255.255.240
32
/27
255.255.255.224
64
/26
255.255.255.192
128
/25
255.255.255.128
256
/24
1C
255.255.255.0
...
...
...
...
4096
/20
16 C’s
255.255.240.0
8192
/19
32 C’s
255.255.224.0
16384
/18
64 C’s
255.255.192.0
32768
/17
128 C’s
255.255.128.0
65535
/16
1B
255.255.0.0
...
...
...
...
Unit-VI Network Layer
59
Classless Addressing
Rules:
1. The address in a block must be contiguous.
2. The number of address in a block must be a
power of 2 (1, 2, 4, 8, . . .)
3. The first address must be evenly divisible by the
number of address .
04\08\2010
Unit-VI Network Layer
60
Example
Figure 19.3 shows a block of addresses, in both binary and dotteddecimal notation, granted to a small business that needs 16 addresses.
The addresses are contiguous. The number of addresses is a power of 2
(16 = 24), and the first address is divisible by 16. The first address,
when converted to a decimal number, is 3,440,387,360, which when
divided by 16 results in 215,024,210.
04\08\2010
Unit-VI Network Layer
61
Classless Addressing
Mask: In 32 bit in which n leftmost bits are 1s and the 23-n
rightmost bits are 0s
In IPv4 addressing, a block of addresses can be defined as
x.y.z.t /n
in which x.y.z.t defines one of the addresses and the /n defines
the mask.
The first address in the block can be found by setting the
rightmost 32 − n bits to 0s.
The last address in the block can be found by setting the
rightmost 32 − n bits to 1s.
The number of addresses in the block can be found by using the
formula 232−n.
04\08\2010
Unit-VI Network Layer
62
Example
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?
Solution: The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101
00010000
00100101 0010000
or 205.16.37.32.
04\08\2010
Unit-VI Network Layer
63
Example
Find the last address for the block 205.16.37.39/28.
Solution: The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32 − 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111
or
205.16.37.47
Find the number of addresses in Example 19.6.
The value of n is 28,
of addresses is 2 32−28 or 16.
04\08\2010
which
Unit-VI Network Layer
means
that
number
64
Example
Another way to find the first address, the last address, and the
number of addresses is to represent the mask as a 32-bit binary (or 8digit hexadecimal) number. This is particularly useful when we are
writing a program to find these pieces of information. In Example
19.5 the /28 can be represented as
11111111 11111111 11111111 11110000
(twenty-eight 1s and four 0s).
Find
a. The first address
b. The last address
c. The number of addresses.
04\08\2010
Unit-VI Network Layer
65
Example
Solution
a. The first address can be found by ANDing the given
addresses with the mask. ANDing here is done bit by
bit. The result of ANDing 2 bits is 1 if both bits are 1s;
the result is 0 otherwise.
04\08\2010
Unit-VI Network Layer
66
Example
b. The last address can be found by ORing the given
addresses with the complement of the mask. ORing
here is done bit by bit. The result of ORing 2 bits is 0 if
both bits are 0s; the result is 1 otherwise. The
complement of a number is found by changing each 1
to 0 and each 0 to 1.
04\08\2010
Unit-VI Network Layer
67
Example
c.
04\08\2010
The number of addresses can be found by
complementing the mask, interpreting it as a decimal
number, and adding 1 to it.
Unit-VI Network Layer
68
Network Addresses
Network Addresses
1. 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.
2. The router has 2 addresses one belongs to the granted
block the other belongs to the network that is at other side
of the router.
04\08\2010
Unit-VI Network Layer
69
Hierarchy
Hierarchy in a telephone network in North America
IP addresses have levels of hierarchy.
In North America telephone network has 3 levels of hierarchy.
1st level defines the area code,2nd level exchange and the last
level defines the connection of the local loop.
04\08\2010
Unit-VI Network Layer
70
Hierarchy
Two levels of hierarchy in an IPv4 address
1. Each address in the block can be considered as a two-level
hierarchical structure:
2. The leftmost n bits (prefix) define the network;
3. The rightmost 32 − n bits define the host, and is called as
suffix.
04\08\2010
Unit-VI Network Layer
71
Hierarchy
Three-level hierarchy in an IPv4 address
1. An organization that is granted a block of addresses may
create clusters of networks called subnets and divide the
addresses between the different networks.
2. The rest of the world considers the organization as one
entity; however internally has several subnets.
3. All messages are sent to the router, router routes to subnets.
04\08\2010
Unit-VI Network Layer
72
Example
Suppose an organization is given the block 17.12.14.0/26, which
contains 64 addressees. The organization has three offices and needs
to divide the addresses into three subblocks of 32, 16, and16
addresses. Find the new masks.
Soln:
1. Mask for the first subnet is n1, then232-n1 must be 32 i.e n1=27
2. Mask for the second subnet is n2, then232-n2 must be 16 i.e n2=28
3. Mask for the third subnet is n3, then232-n3 must be 16 i.e n3=28
We can find the subnet addresses from one of addresses in the subnet
In subnet 1 the addresses 17.12.14.29/27 can give us the subnet
address if the mask is of /27
Host: 00010001 00001100 00001110 00011101
Mask: 27
Subnet: 00010001 00001100 00001110 0000000 =>17.12.14.0
04\08\2010
Unit-VI Network Layer
73
Example
In subnet 2 the addresses 17.12.14.45/28 can give us the subnet
address if the mask is of /28
Host: 00010001 00001100 00001110 00101101
Mask: 28
Subnet: 00010001 00001100 00001110 0010000 => 17.12.14.32
In subnet 3 the addresses 17.12.14.50/28 can give us the subnet
address if the mask is of /28
Host: 00010001 00001100 00001110 00110010
Mask: 28
Subnet: 00010001 00001100 00001110 0011000 =>17.12.14.48
04\08\2010
Unit-VI Network Layer
74
Configuration and addresses in a subnetted network
04\08\2010
Unit-VI Network Layer
75
Addresses Allocation
Addresses Allocation
•
Global Authority called Internet Corporation for Assigned
Names and Addresses(ICANN).
•
ICANN allocates addresses to ISP, ISP grants addresses
to its customers.
04\08\2010
Unit-VI Network Layer
76
Example
An ISP is granted a block of addresses starting with 190.100.0.0/16
(65,536 addresses). The ISP needs to distribute these addresses to three
groups of customers as follows:
1. The first group has 64 customers; each needs 256 addresses.
2. The second group has 128 customers; each needs 128 addresses.
3. The third group has 128 customers; each needs 64 addresses.
Design the subblocks and find out how many addresses are still
available after these allocations.
04\08\2010
Unit-VI Network Layer
77
Example
Group 1: In this group, each customer needs 256 addresses. That is 8
(log2 256) bits are needed to define each host. The prefix length is then
32 − 8 = 24. The addresses are
Group 2: In this group, each customer needs 128 addresses. This
means that 7 (log2 128) bits are needed to define each host. The prefix
length is then 32 − 7 = 25. The addresses are
04\08\2010
Unit-VI Network Layer
78
Example
Group 3
For this group, each customer needs 64 addresses. This
means that 6 (log264) bits are needed to each host. The
prefix length is then 32 − 6 = 26. The addresses are
Number of granted addresses to the ISP: 65,536
Number of allocated addresses by the ISP: 40,960
Number of available addresses: 24,576
04\08\2010
Unit-VI Network Layer
79
Example
An example of address allocation and distribution by an ISP
04\08\2010
Unit-VI Network Layer
80
Network Addresses
Translation (NAT)
04\08\2010
Unit-VI Network Layer
81
Network Addresses Translation (NAT)
Private vs Public IP Addresses
• Whatever connects directly into Internet must have public (globally
unique) IP address
• There is a shortage of public IPv4 address
• So Private IP addresses can be used within a private network
• Three address ranges are reserved for private usage
• 10.0.0.0/8
• 172.16.0.0/16 to 172.31.0.0/16
• 192.168.0.0/24 to 192.168.255.0/24
• A private IP is mapped to a Public IP, when the machine has to
access the Internet
04\08\2010
Unit-VI Network Layer
82
Natting
Network Addresses
Translation (NAT)
NAT
NAT (Network Address Translation) Maps Private
IPs to Public IPs
It is required because of shortage of IPv4 Address
04\08\2010
Unit-VI Network Layer
83
Natting
Network Addresses
Translation (NAT)
Static NAT : Maps unique Private IP to unique
Public IP
Dynamic NAT : Maps Multiple Private IP to a Pool of
Public IPs (Port Address Translation : Maps a
Public IP and Port Number to a service in Private IP)
04\08\2010
Unit-VI Network Layer
84
Network Addresses Translation (NAT)
•
•
•
•
•
The Internet authorities have reserved three sets of
addresses as private addresses
Any organization can use an address out of this set without
permission from the Internet authorities.
Therese addresses are unique inside the organization, but
they are not unique globally.
The router will not forward a packet that has theses
addresses as destination addresses.
The site have one single connection to the global Internet
through Router that runs the NAT software.
Addresses for private networks
04\08\2010
Unit-VI Network Layer
85
Network Addresses Translation (NAT)
A NAT implementation
04\08\2010
Unit-VI Network Layer
86
Network Addresses Translation (NAT)
Addresses in Translation
•
•
Outgoing packets go through the NAT router replaces the
source address in the packet with the global NAT address.
All incoming packet destination address are replaced by
private address.
04\08\2010
Unit-VI Network Layer
87
Network Addresses Translation (NAT)
•
•
When the router translates the source address of the outgoing packet it
also makes note of the destination address.
When response comes back from destination address it checks for its
source address from translation table
04\08\2010
Unit-VI Network Layer
88
Network Addresses Translation (NAT)
Five-column translation table
04\08\2010
Unit-VI Network Layer
89
NAT and ISP
•
•
An ISP that serves dial up customers can use NAT to conserve addresses.
Suppose ISP has 1000 addresses but has 100,000 customers. Each of the
customer is assigned a private network address. The ISP translates each
addresses in outgoing packet to one of the 1000 global address.
An ISP and NAT
04\08\2010
Unit-VI Network Layer
90
IPv6 ADDRESSES
04\08\2010
Unit-VI Network Layer
91
IPv6 ADDRESSES
Despite all short-term solutions, address depletion is
still a long-term problem for the Internet. This and other
problems in the IP protocol itself have been the
motivation for IPv6.
Structure
Address Space
04\08\2010
Unit-VI Network Layer
92
IPv6 Addresses
Structure:
•
IPv6 address consists of 16 bytes or 128 bits long and
specified in hexadecimal colon notation.
•
128 bits are divided into 8 sections, each 2 bytes in
length.
•
2 bytes in hex notation requires 4 hex digits.
IPv6 address in binary and hexadecimal colon notation
04\08\2010
Unit-VI Network Layer
93
IPv6 Addresses
Abbreviation
• IP address in hexadecimal format is very long
and contains many digits are zero.
• The leading zeros of a section are omitted.
Abbreviated IPv6 addresses
04\08\2010
Unit-VI Network Layer
94
Example
Expand the address 0:15::1:12:1213 to its original.
Solution
We first need to align the left side of the double colon to the
left of the original pattern and the right side of the double
colon to the right of the original pattern to find how many
0s we need to replace the double colon.
This means that the original address is.
04\08\2010
Unit-VI Network Layer
95
IPv6 Addresses
Type prefixes for IPv6 addresses
04\08\2010
Unit-VI Network Layer
96
IPv6 Addresses
Type prefixes for IPv6 addresses (continued)
04\08\2010
Unit-VI Network Layer
97
IPv6 Addresses
Prefixes for provider-based unicast address
•
•
•
04\08\2010
Type Identifier: 3 bit field , defines the address as a provider
based address
Registry Identifier: 5 bit field indicates the agency that has
registered . INTERNIC center for North America: RIPNIC
center for European registration APNIC Asian and Pacific
countries
Provider Identifier: Internet Provider (ISP) 16 bit
Unit-VI Network Layer
98
IPv6 Addresses
Prefixes for provider-based unicast address
•
•
•
04\08\2010
Subscriber Identifier: 24 bit length is used to identify
subscriber (Organization)
Subnet Identifier: Each organization has many subnets and
32 bit is used for identification
Node Identifier: 48 bit is used to identify node connected to
a subnet.
Unit-VI Network Layer
99
IPv6 Addresses
Multicast address in IPv6
•
•
•
used to define a group of hosts instead of just one
Flag is used define group of address as either permanent or
transient.
Scope:
Anycast Addresses
04\08\2010
Unit-VI Network Layer
100
IPv6 Addresses
Reserved addresses in IPv6
•
•
Unspecified is used when host does not know its own
address and sends an inquiry to find its address.
Loopback is used by a host to test itself without going into
the network.
04\08\2010
Unit-VI Network Layer
101
IPv6 Addresses
•
•
Compatible is used during the transition from IPv4 to IPv6.
Node using IPv6 want to send a message to another node
using IPv6, but message needs to pass through a part of
network that still operates in IPv4.
Mapped address is used when node has migrated to Ipv6
wants to send a packet to a node still using IPv4
04\08\2010
Unit-VI Network Layer
102
IPv6 Addresses
Local addresses in IPv6
04\08\2010
Unit-VI Network Layer
103
IPv6 Addresses
A large number of consecutive IP address are available starting
at 198.16.0.0. Suppose that four organizations, A, B, C, and D,
request 4000, 2000, 4000, and 8000 addresses, respectively,
and in that order. For each of these, give the first IP address
assigned, the last IP address assigned, and the mask in the
w.x.y.z/s notation.
To start with, all the requests are rounded up to a power of two.
The starting address, ending address, and mask are as follows:
A: 198.16.0.0 – 198.16.15.255 written as 198.16.0.0/20
B: 198.16.16.0 – 198.16.23.255 written as 198.16.16.0/21
C: 198.16.32.0 – 198.16.47.255 written as 198.16.32.0/20
D: 198.16.64.0 – 198.16.95.255 written as 198.16.64.0/19
04\08\2010
Unit-VI Network Layer
104
Download