Download presentation
Published byHilda Gaines Modified over 9 years ago
1
Network Protocols Chapter 5 (TCP/IP Suite Book): IPv4 Addresses
Copyright © Lopamudra Roychoudhuri
2
Agenda IPv4 Addresses: IPv4 addresses and classes Classful addressing
Network addresses and masks Network Address Translation (NAT) 2
3
Network Layer The network layer is designed as a packet-switched network. Packet-switched network can provide either a connectionless service or a connection-oriented service. When the network layer provides a connectionless service, each packet traveling in the Internet is an independent entity; there is no relationship between packets belonging to the same message. In a connection-oriented service, there is a virtual connection between all packets belonging to a message.
4
Network Layer This means that the packet at the source is divided into manageable packets, normally called datagrams. Individual datagrams are then transferred from the source to the destination. The received datagrams are assembled at the destination before recreating the original message. The packet-switched network layer of the Internet was originally designed as a connectionless service.
5
Figure 4.3 A connectionless packet-switched network
The network layer is responsible for delivery of packets from the source to the destination.
6
Figure 4.4 Forwarding process in a connectionless network
The source address may be used to send an error message to the source if the packet is discarded. The forwarding decision is based on the destination address of the packet.
7
IP Addresses The identifier used in the IP layer of the TCP/IP protocol suite to identify each device connected to the Internet Uniquely and universally defines the connection of a host or a router to the Internet 32 bits, 4 bytes long dotted decimal notation Each of the 4 values is in range 0 – 255, such as, The address space of IPv4 is 232 or 4,294,967,296. 2
8
IP Addresses cont. How does every device on the Internet get a different IP address? IP Address Prefixes assigned to organizations by the Internet Assigned Numbers Authority (IANA) Distributes IP address pools to Regional Internet Registry (RIR) organizations, such as Réseaux IP Européens Network Coordination Centre (RIPE NCC) 2
9
IP Addresses cont. RIPE NCC hands over IP address prefixes to Organizations: ISPs, Universities, large businesses These organizations then control all IP addresses starting with that prefix Small businesses are loaned a group of IP addresses by ISP Individual PCs get a dynamically assigned IP address from ISP each time they dial up. 2
10
IP Addresses cont. 0x80 0x0B 0x03 0x3F
Hexadecimal notation 0x80 0x0B 0x03 0x3F Binary notation Dotted Decimal notation An IP address can also be thought of as a number in base 256. i.e., is nothing but 128*256^3 + 11*256^2 + 3*256^1 + 31*256^0 (See TCP/IP Textbook appendix B, Page 898)
11
IP Addresses IP address is designed to identify
A particular IP Network that this packet should be delivered to by Internet routers A particular IP host machine on that network that this packet should be delivered to by local router at the destination site 2
12
Classful IP Addresses IP addresses, when started a few decades ago, used the concept of classes. This architecture is called classful addressing. Class A: for Large networks Class B: for Medium networks Class C: for Small networks Class D: Multicast
13
Figure 5.7 Finding the class of an address using continuous checking
14
……0 ……1 ……0 ……1 ……0 ……1 ……0 ……1 ……0 ……1
15
Occupation of the address space
16
Figure 5.15 Information extraction in classful addressing
17
Example 19.1 Change the following IPv4 addresses from binary notation to dotted-decimal notation. Solution We replace each group of 8 bits with its equivalent decimal number (see Appendix B) and add dots for separation.
18
Example 19.2 Change the following IPv4 addresses from dotted-decimal notation to binary notation. Solution We replace each decimal number with its binary equivalent .
19
Example 19.3 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.
20
Example 19.4 Find the class of each address.
b c d 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.
21
Note In classful addressing, a large part of the available addresses were wasted.
22
Note Classful addressing, which is almost obsolete, is replaced with classless addressing.
23
Example 5.5 Find the number of addresses in a range if the first address is and the last address is Solution We can subtract the first address from the last address in base 256 (see Appendix B). The result is in this base. To find the number of addresses in the range (in decimal), we convert this number to base 10 and add 1 to the result. = 255 * 256^0 + 3 * 256^1 = = 1024
24
Net Address First address in the block
Network address defines the network to rest of Internet Given network address we can find the class of the address, the block, and range of addresses in the block
25
Network Address
26
Blocks in class A
27
Class A Address First byte value between 1 and 127
ICANN specifies value of 1st byte Organization chooses IP address for each device by assigning value in last 3 bytes. Organization may have (256 * 256 * 256) = 16 million different IP addresses for devices!! Millions of class A addresses are wasted. List of Assigned class A addresses 2
28
Blocks in class B
29
Class B Address First byte has value between 128 and 191
ICANN specifies value of 1st and 2nd bytes Organization chooses IP address for each device by assigning value in last 2 bytes. Organization has (256 * 256) = 65,536 different IP addresses for devices!! Many class B addresses are wasted. 2
30
Blocks in class C
31
Class C Address First byte has value between 192 and 223
ICANN specifies value of 1st, 2nd and 3rd bytes Organization chooses particular IP address for each device by assigning value in last byte. Organization gets 256 different IP addresses for its devices The number of addresses in class C is smaller than the needs of most organizations Example: IP addresses x are all controlled by Microsoft Corporation 2
32
Unicast, Multicast, and Broadcast Addresses
Unicast communication is one-to-one. Multicast communication is one-to-many. Broadcast communication is one-to-all.
33
Class D Address First byte has value between 224 and 239
There is no Network ID or Host ID. The entire address is used for multicasting Each address represents a group of hosts that all listen to one sender Example: Address can be used to send routing information to all RIP2-aware routers on a network segment. List of used multicast addresses 2
34
Multicast Category addresses
Distance Vector Multicast Routing Protocol Open Shortest Path First Internet Stream Protocol Routing Information Protocol Interior Gateway Routing Protocol
35
IP Special Addresses Address Netid Hostid Src/Dest Network Address
Specific All 0s None Direct Broadcast All 1s Dest Limited Broadcast This host Source Host on this network Loopback 127 Any 2
36
Direct Broadcast Direct broadcast address is used by a router to send a message to every host on a local network
37
Limited Broadcast Limited broadcast address is used by a host to send a packet to every host on the same network However, the packet is blocked by routers
38
This Host A host that does not know its IP address uses the IP address as the source address and as the destination address to send a message to a boot strap server Can be used only as a source address
39
Loopback A packet with loopback address will not reach the network
Can be used by a client process to send a message to a server process on the same machine Can only be used as a destination address
40
Private Addresses A number of blocks in each class are assigned for private use. They are not recognized globally, hence cannot be used on public Internet
41
Multihomed devices A device that has more than one Internet address;
a different address for each network connected to it
42
Sample internet A LAN with nw address (class C) A LAN with nw address (class B) A LAN with nw address (class A) A point-to-point WAN A switched WAN Note: The book does not show any IP address for point-to-point link end-points But in reality point-to-point WAN interfaces are also assigned IP addresses.
43
Question How can you determine if an IP address belongs to a particular network? Answer: Apply a netmask A mask is a 32-bit binary number that gives the first address in the block, i.e. the network address when bitwise ANDed with an address in the block
44
Network Address The network address is the beginning address of each block. It can be found by applying the default mask to any of the addresses in the block (including itself). It keeps the netid of the block and sets the hostid to zero.
45
Masking concept bit bit
46
Anding & Oring Tables Anding 1 Oring 1
47
Default Masks
48
Example 19.6 A block of addresses is granted to a small organization. We know that one of the addresses is /24. What is the first address in the block? Solution The binary representation of the given address is If we used the default mask and And it with the IP address, we get or
49
Note The last address in the block can be found by setting the rightmost 32 − n bits to 1s.
50
Example 5.13 An address in a block is given as Find the number of addresses in the block, the first address, and the last address. Solution Figure 5.16 shows a possible configuration of the network that uses this block. 1. From the 1st byte we know that this is a class A address. Hence number of network bits (n) is 8. The number of addresses in this block is N = 232−n=232−8=224 =16,777,216. 2. To find the first address, we keep the leftmost 8 bits and set the rightmost 24 bits all to 0s. The first address is , in which 8 is the value of n. 3. To find the last address, we keep the leftmost 8 bits and set the rightmost 24 bits all to 1s. The last address is
51
Figure 5.16 Solution to Example 5.13
52
Example 5.14 An address in a block is given as Find the number of addresses in the block, the first address, and the last address. Solution Figure 5.17 shows a possible configuration of the network that uses this block. 1. The number of addresses in this block is N = 232−n = 65,536. 2. To find the first address, we keep the leftmost 16 bits and set the rightmost 16 bits all to 0s. The first address is , in which 16 is the value of n. 3. To find the last address, we keep the leftmost 16 bits and set the rightmost 16 bits all to 1s. The last address is
53
Figure 5.17 Solution to Example 5.14
54
Example 5.15 An address in a block is given as Find the number of addresses in the block, the first address, and the last address. Solution Figure 5.17 shows a possible configuration of the network that uses this block. 1. The number of addresses in this block is N = 232−n = 256. 2. To find the first address, we keep the leftmost 24 bits and set the rightmost 8 bits all to 0s. The first address is , in which 24 is the value of n. 3. To find the last address, we keep the leftmost 24 bits and set the rightmost 8 bits all to 1s. The last address is
55
Figure 5.18 Solution to Example 5.15
56
Example 5.16 (Note that the book’s solution is incorrect)
A router receives a packet with the destination address Show how the router finds the network address of the packet. Solution Since the class of the address is C, we assume that the router applies the default mask for class C, to find the network address. 255 67
57
Another way to find the first address, last address,
, and the number of addresses 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. 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. b. The last address can be found by ORing the given addresses with the complement of the mask The complement of a number is found by changing each 1 to 0 and each 0 to 1. c. The number of addresses can be found by complementing the mask, interpreting it as a decimal number, and adding 1 to it.
58
Network Address Translation (NAT)
Network Address Translation (NAT): is the process of modifying IP address information in IPv4 headers while in transit across a traffic routing device. NAT is necessary when the number of IP addresses assigned to you by your ISP is less than the total number of computers that you wish to provide Internet access for. The simplest type of NAT provides a one-to-one translation of IP addresses. This refers to this type of NAT as basic NAT, which is often also called a one-to-one NAT. Another way to map an entire network (or networks) to a single IP address (Security wise). NAT allows you to take advantage of the reserved address blocks.
59
Figure 19.10 A NAT implementation
60
Figure 19.11 Addresses in a NAT
61
Figure 19.12 NAT address translation
62
Table 19.4 Five-column translation table
63
Figure An ISP and NAT
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.