IP Addressing - gozips.uakron.edu

Download Report

Transcript IP Addressing - gozips.uakron.edu

2440: 141
Web Site Administration
IP Addressing
Instructor: Enoch E. Damson
Data Packets
 Comprised of small chunks of data that each layer appends
onto the packet data received from the layer directly above it
 Commonly referred to as datagrams
 Sent out on the chosen physical medium to its destination
address (included in the packet by the network or IP layer
 Packets are nothing more than a series of bits (0s and 1s)
 If written in binary (bit) format, may take up a lot of space and hard to
read
 Instead, packets can be displayed in hexadecimal to save space


1 hex digit is equivalent to 4 bits
2 hex digits represents 8 bits (1 byte)
IP Addressing
2
Hexadecimal-Decimal-Binary
 Computers use the binary system (base 2) with only two
numeric symbols (0 and 1)
 Human beings find it easier working with decimal (base
10) values (0-9)
 Some datagrams are written in hexadecimal (base 16)
values (0-9, a-f)
IP Addressing
3
Numeric Conversions
 There are different methods of conversions between:
 Decimal to Binary (and vice versa)
 Decimal to Hexadecimal (and vice versa)
 Adopt a methodology that is easiest or makes most sense
to you
IP Addressing
4
Decimal to Hexadecimal Conversion
Example #1:
172
= 16 * 10 Remainder 12 (12 is c)
10
= 16 * 0 Remainder R10
(10 is a)
= AC (10 12)
Example #2:
205
= 16 * 12 Remainder 13 (13 is d)
12
= 16 * 0 Remainder 12 (12 is c)
= CD (12 13)
Example #3:
52
= 16 * 3 Remainder 4
3
= 16 * 0 Remainder 3
= 34
IP Addressing
Hexadecimals
a= 10
b= 11
c = 12
d= 13
e = 14
f = 15
5
Hexadecimal to Decimal Conversion
Example #1:
AC= (10 x 161) + (12 x 160)
=
160 + 12
=
172
Example #2:
CD= (12 x 161) + (13 x 160)
=
192 + 13
=
205
Example #3:
34= (3 x 161) + (4 x 160)
=
48 + 4
=
52
IP Addressing
Hexadecimals
a= 10
b= 11
c = 12
d= 13
e = 14
f = 15
6
Decimal to Binary Conversion
Example #1:
172
= 2 * 86 Remainder 0
86
= 2 * 43
Remainder 0
43
= 2 * 21
Remainder 1
21
= 2 * 10
Remainder 1
10
=2*5
Remainder 0
5
= 2 * 2 Remainder 1
2
= 2 * 1 Remainder 0
1
= 2 * 0 Remainder 1
IP Addressing
 Counting the remainders
from the bottom up, the
binary equivalent of the
decimal value 172 is:
 10101100
7
Decimal to Binary Conversion…
 Example #2:
 125 is converted to binary by finding the integer quotients and the
remainders as follows:







125 divided by 2 equals 62, remainder 1
62 divided by 2 equals 31, remainder 0
31 divided by 2 equals 15, remainder 1
15 divided by 2 equals 7, remainder 1
7 divided by 2 equals 3, remainder 1
3 divided by 2 equals 1, remainder 1
1 divided by 2 equals 0, remainder 1


1111101
For octets: pad with a 0

01111101
IP Addressing
8
Binary to Decimal Conversion

One method of converting the binary 11010011 to decimal is
as follows:
1.
2.
3.
4.
5.
Count the total number of digits in the number (8)
Subtract one from the total (8 - 1 = 7)
That number (7) is the power of 2 to associate with the highest
exponent for two in the number
Convert to exponential notation, using all the digits as multipliers
11010011, therefore, converts to:
IP Addressing
9
Binary to Decimal Conversion…
 Another method of converting the binary 01011011 to
decimals is as follows:
 Add all the decimals equivalents with the value 1 (for “on”
switches)


64 + 16 + 8 + 2 + 1
= 91
128
64
32
16
8
4
2
1
27
26
25
24
23
22
21
20
0
1
0
1
1
0
1
1
IP Addressing
10
High-Order Bit Patterns
IP Addressing
11
Low-Order Bit Patterns
IP Addressing
12
Hexadecimal-Decimal-Binary Conversion
Example
 ac.1c.0a.c1 converted to decimal yields 172.28.10.193
hexadecimal
decimal
ac

172
1c

28
0a

10
c1

193
 Converting the decimals to binary results to:
10101100.00011100.00001010.11000001
hexadecimal
decimal
binary octets
ac

172

10101100
1c

28

11100 (00011100)
0a

10

1010 (00001010)
c1

193

11000001
 The second and third octets are padded with leading 0s to make it 8 bits (1
byte) long
IP Addressing
13
Importance of Numeric
Conversions
 Converting between number systems is important when:
 Calculating IP addresses
 Calculating Subnets
 Interpreting hexadecimal packet representation
IP Addressing
14
IP Addressing
 An IP (Internet Protocol) address is a unique identifier for
a node or host connection on an IP network
 IP addresses are 32 bits (4 bytes) long
 Each byte is represented as an octet (decimal number from 0 to 255) –
a grouping of 8 bits usually expressed as decimal numbers
 The 4 bytes are usually represented in dotted decimal notation

E.g., 172.24.208.192
 IP addresses have two distinct parts:


Network identifier (E.g., 172.24.x.x for IP address above)
Host ID identifier (E.g., x.x.208.192 for the IP address above)
IP Addressing
15
IP Addressing…
 IP address are categorized into ranges referred to as classes:
 Classes A, B, C, D, and E
 Only IP addresses in the classes A, B, and C are available for
assigning an address to a host
 Class system provides a basis for determining which part of the
address is the network and which is the host ID
 The first octet of an address denotes its class
IP Addressing
16
IP Addressing Classes
 Class A:
 Intended for large corporations and governments
 An IP address registry assigns the first octet, leaving the last three
octets for network administrators to assign to hosts
First octet between 1-126
 16,777,214 hosts per network address
 Class B:

 Intended for use in medium-sized networks
 First two octets are assigned, leaving the last 2 for hosts


First octet between 128-191
65,534 hosts per network address
IP Addressing
17
IP Addressing Classes…
 Class C:
 Intended for small networks
 First three octets are assigned
First octet between 192-223
 254 hosts per network address
 Class D:

 Reserved for multicasting – a packet is addressed to allow reception at
more than one destination
 Applications using this include streaming media and videoconferencing
 First octet between 224-239
 Cannot be used to assign IP addresses to host computers
IP Addressing
18
IP Addressing Classes…
 Class E:
 Reserved for experimental use
 First octet between 240-255
 Cannot be used for IP address assignment
IP Addressing
19
Common IP Classes
Class
First
Byte
Subnet mask
Number of
Networks
Number of
Hosts
Class A
1 – 127
255.0.0.0
126
>16,000,000
Class B
128 – 191
255.255.0.0
> 16,000
>65,000
Class C
192 – 223
255.255.255.0
> 2,000,000
254
IP Addressing
20
IP Addressing…
 IP addresses beginning with 127 (or 01111111) are reserved
for loopback and for internal testing on a local machine
 127.0.0.0 network is called the loopback address – always
refers to the local computer and used to test the functionality
of TCP/IP
 localhost always corresponds to address 127.0.0.1
 To alleviate the problem of IP address scarcity, the TCP/IP’s
governing body, Internet Engineering Task Force (IETF),
reserved addresses for private networks
 Class A addresses beginning with 10
 Class B addresses from 172.16 to 172.31
 Class C addresses from 192.168.0 to 192.168.255
 These addresses cannot be routed across the Internet
IP Addressing
21
IP Addressing…
 Network Address Translation (NAT) – allows an IP address from one
network to be translated into another address on an internal network
 Can be used to translate a single IP address valid on the Internet into
multiple internal addresses
 Useful if your ISP gives you a single IP address but you have multiple
servers and users on the internal network
 IPv6 eliminates the need for private addressing
 It provides a 128-bit address (vs. IPv4’s 32 bits)
 A number of public and private companies around the world (IP address
registries) cooperatively manage the total collection of valid IP address
 The activity occurs under the control of the Internet Assigned Numbers
Authority (IANA) – a public nonprofit agency responsible for Internet
addressing and address management
IP Addressing
22
Classless Interdomain Routing
(CIDR)
 Addressing by class has been superseded by a more flexible
addressing method
 Classless Interdomain Routing (CIDR) – the network and host
demarcation can be made with any number of bits from the beginning
of the address

E.g., a Class C address’s network section is 24 bits


Using CIDR, an address registry can assign an address with a network section of 26
bits
 192.203.187.0/26
The CIDR technique involves “borrowing” bits from the host portion of the
address to create two or more network numbers, hence process is called
subnetting
 Subnetting divides network address in two or more subnetwork
addresses (with fewer host IDs for each)
IP Addressing
23
Why Subnet?
 Subnetting:
 Makes more efficient use of available IP addresses
 Enables dividing networks into logical groups
 Can make network communication more efficient
 Reduces broadcast traffic
IP Addressing
24
Subnet Masks
 Subnet mask (netmask) – determines which part of the IP
address denotes the network and host portions
 A 32-bit number that is always assigned to a host when the IP address
is assigned
 A binary 1 signifies that the corresponding bit in the IP address belongs
to the network portion
 A binary 0 signifies that the bit in the IP address belongs to the host
portion
 The default subnet mask uses a 255 (11111111 in binary) in each octet
in the IP address that corresponds to the network portion



Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0
IP Addressing
25
Calculating a Subnet Mask

To build a subnet mask, use the following steps:
1.
Decide how many subnets you need


Number is usually derived as a result of a network design document
Seeing how many network cable segments are connected to router
interfaces can help figure out the needed subnets

2.
Decide how many bits you need to meet or exceed the number of
required subnets

3.
4.
Each cable segment indicates a required subnet
Use the formula 2n, with n representing the number of bits you must
add to the starting subnet mask
Borrow bits from the top of the host portion of the address down
Ensure that you have enough host bits available to assign to
computers on each subnet

Use the formula 2n-2, with n representing the number of host (0) bits in
the subnet (after borrowing the bits from the host)
IP Addressing
26
Calculating a Subnet Mask Example

With a Class C address 200.10.10.0 needing 12 subnets:

The default subnet mask will be: 255.255.255.0


11111111.11111111.11111111.00000000 (binary equivalent)
To meet or exceed 12 subnets:


The nearest power of 2 is 16 (24) meaning 4 bits will be borrowed from
the host portion of the original subnet mask to the network portion
(making them 4 subnet bits)
Borrowing 4 bits from the left of the host creates the following subnet
mask:



11111111.11111111.11111111.11110000
255.255.255.240 (decimal equivalent)
To calculate the number of host addresses for each subnet:

Count the number of 0s remaining in the subnet mask to determine the
number of bits left for the host address


11111111.11111111.11111111.11110000 (4 bits left for host)
24 – 2 = 14 (host addresses required for each subnet)
IP Addressing
27
Calculating
a Subnet Mask Example…
 After calculating the appropriate subnet mask, determine
the network numbers by:

Placing the borrowed 4 bits in the network number and cycling the 4
bits through the possible combinations of values they represent (16
possible combinations as shown below, in this case)
IP Addressing
28
Calculating a Subnet Mask Example…

After calculating the
appropriate subnet mask,
determine the host numbers in
each subnet by:




Cycling through the 4 host bits
Therefore, the subnetwork
address 200.10.10.32 would
have host addresses from
200.10.10.33 through
210.10.10.47
However, you cannot use the IP
address in which all host bits
are 1s (because it is the
broadcast address)
So the actual range will be
210.10.10.33 through
210.10.10.46 (14 hosts)
Subnet Host Addresses
for 210.10.10.32
200.10.10.33
200.10.10.34
200.10.10.35
200.10.10.36
200.10.10.37
200.10.10.38
200.10.10.39
200.10.10.40
200.10.10.41
200.10.10.42
200.10.10.43
200.10.10.44
200.10.10.45
200.10.10.46
IP Addressing
29
Calculating Supernets
 Supernetting “borrows” bits from network portion of an IP
address to “lend” those bits to host portion
 Permits consecutive IP network addresses to be combined and viewed
in a single logical network
 Combining two or more small networks into one larger
network is only one reason to supernet
 Supernetting can combine multiple routing table entries into a single
entry, which can drastically decrease the table’s size on Internet routers
 This reduction in routing table size increases the speed and efficiency of
Internet routers
IP Addressing
30
Calculating Supernets Example
 Assuming a network design has the following four Class C network
addresses available, 192.168.0.0, 192.168.1.0, 192.168.2.0, 192.168.3.0 on
the proposed network without the necessary router interfaces to use the
numbers:
 The default subnet mask will be: 255.255.255.0
 11111111.11111111.11111111.00000000 (binary equivalent)
 You may combine the four networks into one by borrowing 2 bits (22 = 4) from
the network portion of the address and adding them to the host portion.

You will have a network address of 192.168.0.0 with a subnet mask of 255.255.252.0


11111111.11111111.11111100.00000000
255.255.252.0 (decimal equivalent)
 Instead of supporting only 8 bits for the host address portion, the supernet
now supports 10 bits (8 + 2) for the host addresses

This provides 1022 (210 – 2) host addresses on this supernet
IP Addressing
31