tcp/iptcp/ip dr. clincylecture1 chapter 5: addressing (part 1 of 3) address structure classful...

28
Dr. Clincy Lecture 1 T C P / I P Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Upload: justina-fleming

Post on 15-Jan-2016

221 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 1

TCP / IP

Chapter 5: Addressing (part 1 of 3)

• Address Structure

• Classful Addressing

• Number Systems (Appendix B)

• Mask – Network Address

Page 2: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 2

TCP / IP

IP Addresses• Internetworking Protocol (IP) of the Network Layer is

responsible for uniquely identifying all devices and connections on the Internet

• The unique identifier is called an IP address

• IP address consist of 32 bits (for version 4)

• Keep in mind that, if a single device had multiple connections to the Internet, you would need an IP address for each connection

• Address space is 232 = 4,294,967,296 32-bit addresses

• In theoretical terms, 4,294,967,296 connections can be made to the Internet (not really true in real life)

Page 3: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 3

TCP / IP

• The IP Address has 3 notations: Binary, Dotted-decimal and HexadecimalThe IP Address has 3 notations: Binary, Dotted-decimal and Hexadecimal• Binary: 4 Octets: Binary: 4 Octets: 01110101 10010101 00011101 11101010• Dotted-Decimal (or dot notation):

IP Addresses

• For Dotted-Decimal, each number can range from 0 to 255

• Hexadecimal: 0111 0101 1001 0101 0001 1101 1110 1010

75 95 1D EA

75951DEA

Page 4: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 4

TCP / IP

Change the following IP address from binary notation to dotted-decimal notation: 10000001 00001011 00001011 11101111

SolutionSolution 129.11.11.239129.11.11.239

EXAMPLES

Change the following IP address from dotted-decimal notation to binary notation: 111.56.45.78

SolutionSolution 01101111 00111000 00101101 0100111001101111 00111000 00101101 01001110

Find the error, if any, in the following IP address: 111.56.045.78

SolutionSolution There are no leading zeroes in dotted-decimal notation (045).

Change the following IP addresses from binary notation to hexadecimal notation: 10000001 00001011 00001011 11101111

SolutionSolution 810B0BEF16

Page 5: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 5

TCP / IP

IP Addresses: Classful Addressing• When IP addressing was first started, it used a concept

called “classful addressing”. A newer concept called “classless addressing” is slowly replacing it though.

• Regarding “classful addressing”, the address space is divided into five classes: A, B, C, D and E.

Class # of addresses Percent of the Space

A 231=2147483648 50%

B 230=1073741824 25%

C 229=536870912 12.5%

D 228=268435456 6.25%

E 228=268435456 6.25%

Page 6: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 6

TCP / IP

Finding the class in binary notation

Finding the class in decimal notation

Page 7: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 7

TCP / IP

Find the class of the address:

00000001 00001011 00001011 11101111

SolutionSolution

The first bit is 0. This is a

class A address.

Find the class of the address:

11000001 10000011 00011011 11111111

SolutionSolution

The first 2 bits are 1; the third bit is 0. This is a class C address.

Find the class of the address:

227.12.14.87

SolutionSolution

The first byte is 227 (between 224 and 239); the class is D.

EXAMPLES

Page 8: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 8

TCP / IP

Netid and hostid

• A, B and C class-addresses are divided into network id and host id

• For Class A, Netid=1 byte, Hostid = 3 bytes

• For Class B, Netid=2 bytes, Hostid = 2 bytes

• For Class C, Netid=3 bytes, Hostid = 1 byte

Page 9: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 9

TCP / IP

Blocks in class A• Class A has 128 blocks or network ids

• First byte is the same (netid), the remaining 3 bytes can change (hostids)

• Network id 0 (first), Net id 127 (last) and Net id 10 are reserved – leaving 125 ids to be assigned to organizations/companies

• Each block contains 16,777,216 addresses – this block should be used by large organizations. How many Host can be addressed ????

• The first address in the block is called the “network address” – defines the network of the organization

Example

• Netid 73 is assigned

• Last address is reserved

• Recall: routers have addressees

Page 10: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 10

TCP / IP

Blocks in class B• Class B is divided into 16,384 blocks (65,536 addresses each)

• 16 blocks are reserved

• First 2 bytes are the same (netid), the remaining 2 bytes can change (hostids)

• For example, Network id 128.0 covers addresses 128.0.0.0 to 128.0.255.255

• Network id 191.225 is the last netid for this block

Example

• Netid 180.8 is assigned

• Last address is reserved

• Recall: routers have addresses

Page 11: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 11

TCP / IP

Blocks in class C• Class C is divided into 2,097,152 blocks (256 addresses each)

• 256 blocks are reserved

• First 3 bytes are the same (netid), the remaining 1 byte can change (hostids)

• For example, Network id 192.0.0 covers addresses 192.0.0.0 to 192.0.0.255

Page 12: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 12

TCP / IP

Class D addresses Class D addresses are used for multicasting; are used for multicasting;

there is only there is only one block in this class.one block in this class.

Class E addresses are reservedClass E addresses are reservedfor special purposes; for special purposes;

most of the block is wasted. most of the block is wasted.

Page 13: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 13

TCP / IP

Network AddressesNetwork AddressesThe network address is the first address.

The network address defines the network to the rest of the Internet.

Given the network address, we can find the class of the address, the block, and the range of the addresses in the block

Given the network address 17.0.0.0, find the class, the block, and the range of the addresses.

SolutionSolution The class is A because the first byte is between 0 and 127. The block has a netid of 17. The addresses range from 17.0.0.0 to 17.255.255.255.

Given the network address 132.21.0.0, find the class, the block, and the range of the addresses.

SolutionSolutionThe class is B because the first byte is between 128 and 191. The block has a netid of 132.21. The addresses range from 132.21.0.0 to 132.21.255.255.

Given the network address 220.34.76.0, find the class, the block, and the range of the addresses. The class is C because the first byte is between 192 and 223. The block

has a netid of 220.34.76. The addresses range from 220.34.76.0 to 220.34.76.255.

SolutionSolution

Page 14: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 14

TCP / IP

REMINDER: Go Over Converting Binary to Decimal

and Vice Versa

Page 15: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 15

TCP / IP

Converting Number Systems - Review Base-10 The decimal number system is based on power of the base 10. For example, for the number 1259, the 9 is in the 10^0 column - 1s columnthe 5 is in the 10^1 column - 10s columnthe 2 is in the 10^2 column - 100s columnthe 1 is in the 10^3 column - 1000s column  1259 is  9 X 1 = 9  + 5 X 10 = 50  + 2 X 100 = 200  + 1 X 1000 = 1000 ----- 1259

 Base-2 (Binary)

The Binary number system uses the same mechanism and concept however, the base is 2 versus 10 The place values for binary are based on powers of the base 2:  … 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0  128 64 32 16 8 4 2 1

Page 16: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 16

TCP / IP

Converting Number Systems - ReviewSo, the binary number 10110011 can be converted to a decimal number  1 X 1 = 1 (right most bit or position)  1 X 2 = 2  0 X 4 = 0  0 X 8 = 0  1 X 16 = 16  1 X 32 = 32  0 X 64 = 0  1 X 128 = 128 (left most bit or position) ------ 179 in decimal To convert from decimal to binary requires a different method called the division/remainder method.

The idea is to repeatedly divide the decimal number and resulting quotients by 2. The answer will be the remainders.

 Example: convert 155 to binary (Start from the top and work down)

155/2 Q = 77, R = 1 (Start)77/2 Q = 38, R = 138/2 Q = 19, R = 019/2 Q = 9, R = 1 9/2 Q = 4, R = 14/2 Q = 2, R = 02/2 Q = 1, R = 01/2 Q = 0, R = 1 (Stop)

Answer is 10011011. Be careful to place the digits in the correct order.

Page 17: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 17

TCP / IP

Converting Number Systems - Review

Check the answer (10011011) :  1 X 1 = 1 1 X 2 = 2 0 X 4 = 0 1 X 8 = 8 1 X 16 = 16 0 X 32 = 0 0 X 64 = 0 1 X 128 = 128 ----- 155Base-16 (Hex)

The hexadecimal number system is based 16, and uses the same mechanisms and conversion routines we have already examined. The place values for hexadecimal are based on powers of the base 16 The digits for 10-15 are the letters A - F (A is 10, …….., F is 15)  …….. 16^3 16^2 16^1 16^0  4096 256 16 1 The binary number 10110011 can be converted to hexadecimal by grouping bits into groups of 4 bits:  1011 0011

B 3

Page 18: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 18

TCP / IP

Page 19: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 19

TCP / IP

Binary Arithmetic Refresher

• Number Converter Tool (your PC calculator)

• Can go from decimal to binary

• Can go from binary to decimal

Page 20: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 20

TCP / IP

MaskMask

A mask is a 32-bit binary number that gives the first address in the block (the network address) when bitwise ANDed with an address in the block.

• Given the network address, we can easily determine the block and range of addresses

• Suppose given the IP address, can we determine the network address (beginning of the block) ?

• To route packets to the correct network, a router must extract the network address from the destination IP address

• For example, given 134.45.78.2, we know this is a class B, therefore 134.45 is the netid and 134.45.0.0 is the network address (starting address of the block)

• How would we EXTRACT the network address from the IP address? We would use a MASK.

Page 21: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 21

TCP / IP

AND operation

• If bit is ANDed with 1, it’s preserved

• If bit is ANDed with 0, it’s changed to a 0.

• There are 3 default masks: one for each class. The default masks preserve the netid when ANDed with the addresses

• Class A Default Mask: 255.0.0.0

• Class B Default Mask: 255.255.0.0

• Class C Default Mask: 255.255.255.0

• A simple way to determine the netid for un-subnetted cases: (1) if mask byte is 255, retain corresponding byte of the address, (2) if mask byte is 0, set corresponding address byte to 0.

Page 22: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 22

TCP / IP

ExamplesExamples

Given the address 23.56.7.91 and the default class A mask, find the beginning address (network address).

SolutionSolutionThe default mask is 255.0.0.0, which means that only the first byte is preserved and the other 3 bytes are set to 0s. The network address is 23.0.0.0.

Given the address 132.6.17.85 and the default class B mask, find the beginning address (network address).

The default mask is 255.255.0.0, which means that the first 2 bytes are preserved and the other 2 bytes are set to 0s. The network address is 132.6.0.0.

SolutionSolution

Given the address 201.180.56.5 and the class C default mask, find the beginning address (network address).

The default mask is 255.255.255.0, which means that the first 3 bytes are preserved and the last byte is set to 0. The network address is 201.180.56.0.

SolutionSolution

Page 23: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 23

TCP / IP

0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 0 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1

5-bit Address Space Illustration

No Netid case

32 addresses/block

Number of blocks: 1

Address range per block: 0 to 31

Netids: N/A

Network Addresses : 00000

Broadcast Addresses: 11111

Page 24: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 24

TCP / IP

0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 0 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1

1-bit Netid case

16 addresses/block

Number of blocks: 2

Address range per block: 0 to 15

Netids: 0, 1

Network Addresses : 00000, 10000

Broadcast Addresses: 01111, 11111

5-bit Address Space Illustration

Page 25: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 25

TCP / IP

0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 0 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1

2-bit Netid Case

8 addresses/block

Number of blocks: 4

Address range per block: 0 to 7

Netids: 00, 01, 10, 11

Network Addresses : 00000, 01000, 10000, 11000

Broadcast Addresses: 00111, 01111, 10111, 11111

5-bit Address Space Illustration

Page 26: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 26

TCP / IP

0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 0 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1

3-bit Netid Case

4 addresses/block

Number of blocks: 8

Address range per block: 0 to 3

Netids: 000, 001, 010, 011, 100, 101, 110, 111

Network Addresses : 00000, 00100, 01000, 01100 10000, 10100, 11000, 11100

Broadcast Addresses: 00011, 00111, 01011, 01111 10011, 10111, 11011, 11111

5-bit Address Space Illustration

Page 27: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 27

TCP / IP

0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 0 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1

4 addresses/block and 8 addresses/block

Number of blocks: 6

Address range per block: 0 to 3 and 0 to 7

Netids: 000, 001, 010, 011, 10, 11

Network Addresses : 00000, 00100, 01000, 01100 10000, 11000

Broadcast Addresses: 00011, 00111, 01011, 01111 10111, 11111

Mixing 3-bit & 2-bit Cases (think of the 32-bit case)

Page 28: TCP/IPTCP/IP Dr. ClincyLecture1 Chapter 5: Addressing (part 1 of 3) Address Structure Classful Addressing Number Systems (Appendix B) Mask – Network Address

Dr. Clincy Lecture 28

TCP / IP

Sample internet

Token Ring

ATM

Ethernet

Ethernet