Professional Documents
Culture Documents
MSCEG 425
Lecture 8
Network Layer: Logical addressing
Fall 2007
Dr. L. Christofi Fall 2007 1
0. Overview
In this lecture we will cover the following topics:
1.#
Position of Network Layer
1.#
14.1 IPv4 ADDRESSES
Note
Note
1.#
Note
1.#
Example
Solution
We replace each group of 8 bits with its equivalent decimal
number (see Appendix B) and add dots for separation.
Example
Solution
We replace each decimal number with its binary equivalent
1.#
Example
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.
Note
1.#
Classful addressing
Example
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.
1.#
Number of blocks and block size in
classful IPv4 addressing
Note
1.#
Default masks for classful addressing
Note
1.#
Example
The figure below shows a block of addresses, in both binary and dotted-
decimal notation, granted to a small business that needs 16 addresses.
We can see that the restrictions are applied to this block. 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.
Note
1.#
Note
Example
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.
This is actually the block shown in figure below.
1.#
Note
Example
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
This is actually the block shown in figure below.
1.#
Note
Example
Solution
The value of n is 28, which means that number
of addresses is 2 32−28 or 16.
1.#
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 8-digit
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.
Example (continued)
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.
1.#
Example 19.9 (continued)
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.
1.#
Network address
• Network address is an address that defines the network itself; it
cannot be assigned to a host.
— All hostid bytes are 0s
— Defines the network to the rest of the Internet.
— First address in the block
— Given the network address, we can find the class of the address.
Note
Levels of hierarchy
• Levels of Hierarchy
— To reach a host on the Internet, we must first reach the network by
using the first portion of the address (netid)
— Then we must reach the host itself by using the second portion
(hostid)
— IP addresses are designed with two levels of hierarchy.
1.#
Note
Netid, Hostid
1.#
Hierarchy in telephone numbers
1.#
Subnetting
• Sub-netting
— We can divide a network into sub-networks while making
the world knows only the main network.
— In sub-netting, a network is divided into several smaller
groups with each sub-network (or subnet) having its own
sub-network address.
Example
Design the subblocks and find out how many addresses are still available
after these allocations.
1.#
Example 19.10 (continued)
Solution
Figure in slide 42 shows the situation.
Group 1
For this group, each customer needs 256 addresses. This means that 8
(log2 256) bits are needed to define each host. The prefix length is then
32 − 8 = 24. The addresses are:
Group 2
For 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
1.#
Example 19.10 (continued)
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:
1.#
Mask
Default masks
1.#
Example
Solution:
The router follows three steps:
1. The router looks at the first byte of the address to find the
class. It is class B.
2. The default mask for class B is 255.255.0.0. The router
ANDs this mask with the address to get 190.240.0.0.
3. The router looks in its routing table to find out how to
route the packet to this destination. Later, we will see
what happens if this destination does not exist.
Dr. L. Christofi Fall 2007 45
Subnet mask
1.#
Example
Solution:
The router follows three steps:
1. The router must know the mask. We assume it is /19, as
shown in Figure 19.23.
2. The router applies the mask to the address,
190.240.33.91. The subnet address is 190.240.32.0.
3. The router looks in its routing table to find how to route
the packet to this destination. Later, we will see what
happens if this destination does not exist.
Supernetting
1.#
Classless Addressing
1.#
Addresses for private networks
1.#
Address Translation
• All the outgoing packets go through the NAT router, which
replaces the source address in the packet with the global NAT
address.
• All incoming packets also pass through the NAT router, which
replaces the destination address in the packet (the NAT router
global address) with the appropriate private address.
1.#
Five-column translation table
1.#
14.2 IPv6 ADDRESSES
Note
1.#
IPv6 address in binary and hexadecimal
colon notation
1.#
Example
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.
1.#
Type prefixes for IPv6 addresses
(continued)
1.#
Multicast address in IPv6
1.#
Local addresses in IPv6
1.#
14.3 SUMMARY continued (part 14)
• In classless addressing, there are variable-length blocks that belong to no class. The entire
address space is divided into blocks based on organization needs.
• The first address and the mask in classless addressing can define the whole block.
• A mask can be expressed in slash notation which is a slash followed by the number of 1s in the
mask.
• Every computer attached to the Internet must know its IP address, the IP address of a router,
the IP address of a name server, and its subnet mask (if it is part of a subnet).
• DHCP is a dynamic configuration protocol with two databases.
• The DHCP server issues a lease for an IP address to a client for a specific period of time.
• Network address translation (NAT) allows a private network to use a set of private addresses for
internal communication and a set of global Internet addresses for external communication.
• NAT uses translation tables to route messages.
• The IP protocol is a connectionless protocol. Every packet is independent and has no relationship
to any other packet.
• Every host or router has a routing table to route IP packets.
• In next-hop routing, instead of a complete list of the stops the packet must make, only the
address of the next hop is listed in the routing table.
• In network-specific routing, all hosts on a network share one entry in the routing table.
• In host-specific routing, the full IP address of a host is given in the routing table.
• In default routing, a router is assigned to receive all packets with no match in the routing table.
• A static routing table's entries are updated manually by an administrator.
• Classless addressing requires hierarchial and geographic routing to prevent immense routing
tables.
References
1.#