Chapter 6 IPv4 Addresses – Part 2
description
Transcript of Chapter 6 IPv4 Addresses – Part 2
Chapter 6IPv4 Addresses – Part 2
CIS 81 Networking Fundamentals
Rick Graziani
Cabrillo College
Last Updated: 3/30/2008
2
This Presentation
For a copy of this presentation and access to my web site for other CCNA, CCNP, and Wireless resources please email me for a username and password. Email: [email protected] Web Site: www.cabrillo.edu/~rgraziani
3
Note
This presentation is not in the order of the book or online curriculum. This presentation also contains information beyond the curriculum.
Host IP Addresses
5
Host IP Addresses
172.0.0.0 (net) 10101100.00000000.00000000.00000000
255.0.0.0 (SM)11111111.00000000.00000000.00000000
172.0.0.1 10101100.00000000.00000000.00000001
172.255.255.254 10101100.11111111.11111111.11111110
172.255.255.255 10101100.11111111.11111111.11111111
(broadcast)
172.16.0.0 (net) 10101100.00010000.00000000.00000000
255.255.0.0 (SM) 11111111.11111111.00000000.00000000
172.16.0.1 10101100.00010000.00000000.00000001
172.16.255.25410101100.00010000.11111111.11111110
172.16.255.25510101100.00010000.11111111.11111111
(broadcast)
6
Host IP Addresses
172.1.16.0 10101100.00000001.00010000.00000000
255.255.240.0 11111111.11111111.11110000.00000000
172.1.16.1 10101100.00000001.00010000.00000001
…
172.1.31.254 10101100.00000001.00011111.11111110
172.1.31.255 10101100.00000001.00011111.11111111
(broadcast)
Number of hosts: 212 – 2 = 4,096 – 2 = 4,094 hosts
7
Who assigns IP Network Addresses?
Internet Assigned Numbers Authority (IANA) (http://www.iana.net) is the master holder of the IP addresses.
Today, the remaining IPv4 address space has been allocated to various other registries to manage for particular purposes or for regional areas. Regional Internet Registries (RIRs)
8
Regional Internet Registries (RIR)
The 5 RIR’s are: AfriNIC (African Network Information Centre) - Africa Region
http://www.afrinic.net APNIC (Asia Pacific Network Information Centre) - Asia/Pacific Region
http://www.apnic.net ARIN (American Registry for Internet Numbers) - North America Region
http://www.arin.net LACNIC (Regional Latin-American and Caribbean IP Address Registry) -
Latin America and some Caribbean Islands http://www.lacnic.net RIPE NCC (Reseaux IP Europeans) - Europe, the Middle East, and Central
Asia http://www.ripe.net
9
ISP (Internet Service Providers)
Tier 1 ISP: Large national or international ISPs that are directly connected to the
Internet backbone. Customers of Tier 1 ISPs:
lower-tiered ISPs large companies and organizations.
Offer reliability and speed AOL, SPRINT, Global Crossing, AT&T, Level 3, Verizon, NTT, Quest,
SAVVIS
Most companies or organizations obtain their IPv4 address blocks from an ISP.
10
ISP (Internet Service Providers)
Tier 2 ISP: Acquire their Internet service from Tier 1 ISPs. Tier 2 ISPs generally
focus on business customers. Examples: Allstream, AboveNet, British Telecom, Cogent
Communications, France Telecom, Teleglobe TeliaSonera International Carrier Time Warner Telecom, Tiscali International Network, XO Communications
Most companies or organizations obtain their IPv4 address blocks from an ISP.
11
ISP (Internet Service Providers)
Tier 3 ISP: Purchase their Internet service from Tier 2 ISPs. The focus of these
ISPs is the retail and home markets in a specific locale. Examples: Local ISPs
Most companies or organizations obtain their IPv4 address blocks from an ISP.
12
Special Unicast IPv4 Addresses
Default Route
Loopback Address Special address that hosts use to direct traffic to themselves. 127.0.0.0 to 127.255.255.255
Link-Local Addresses 169.254.0.0 to 169.254.255.255 (169.254.0.0 /16) Can be automatically assigned to the local host by the operating system
in environments where no IP configuration is available.
TEST-NET Addresses 192.0.2.0 to 192.0.2.255 (192.0.2.0 /24) Set aside for teaching and learning purposes. These addresses can be used in documentation and network examples.
13
Private IP Addresses
RFC 1918 10.0.0.0 to 10.255.255.255 (10.0.0.0 /8) 172.16.0.0 to 172.31.255.255 (172.16.0.0 /12) 192.168.0.0 to 192.168.255.255 (192.168.0.0 /16)
The addresses will not be routed in the Internet Need NAT/PAT (next)
Should be blocked by your ISP Allows for any network to have up to 16,777,216 hosts (/8)
14
Introducing NAT and PAT
NAT is designed to conserve IP addresses and enable networks to use private IP addresses on internal networks.
These private, internal addresses are translated to routable, public addresses.
IPv4 addresses are almost depleted. NAT/PAT has allowed IPv4 to be the predominant network protocol, keeping
IPv6 at-bay (for now).
15
NAT Example
128.23.2.2 10.0.0.3 .... Data
DA SA
IP Header
128.23.2.2 179.9.8.80 .... Data
DA SA
IP Header
The translation from Private source IP address to Public source IP address.
1 2
1 2
16
NAT Example
Translation back, from Public destination IP address to Private destination IP address.
179.9.8.80 128.23.2.2 .... Data
DA SA
IP Header
10.0.0.3 128.23.2.2 .... Data
DA SA
IP Header
34
34
17
PAT Example
128.23.2.2 10.0.0.3 80 1331 Data
DA SA
IP Header
DP SP
TCP/UDPHeader
128.23.2.2 10.0.0.2 80 1555 Data
DA SA
IP Header
DP SP
TCP/UDPHeader
128.23.2.2 179.9.8.80 80 3333 Data
DA SA
IP Header
DP SP
TCP/UDPHeader
128.23.2.2 179.9.8.80 80 2222 Data
DA SA
IP Header
DP SP
TCP/UDPHeader
NAT/PAT table maintains translation of:
DA, SA, SP
1 2
18
PAT Example
179.9.8.80 128.23.2.2 3333 80 Data
DA SA
IP Header
DP SP
TCP/UDPHeader
179.9.8.80 128.23.2.2 2222 80 Data
DA SA
IP Header
DP SP
TCP/UDPHeader
10.0.0.3 128.23.2.2 1331 80 Data
DA SA
IP Header
DP SP
TCP/UDPHeader
10.0.0.2 128.23.2.2 1555 80 Data
DA SA
IP Header
DP SP
TCP/UDPHeader
4 3
NAT/PAT table maintains translation of:
SA (DA), DA (SA), DP (SP)
The Subnet Mask and the AND Operation
20
Subnet Mask
The subnet mask is used to separate the network portion from the host portion of the address.
On a host, the subnet mask tells the host what network it belongs to. Why does a host need to know what network it belongs to?
Host: “I’m a host on the 192.168.1.0/24 network.”
21
Subnet Mask
Why does a host need to know what network it belongs to? So, it knows whether to encapsulate the IP packet into an Ethernet
frame with: The Destination MAC Address of the default gateway
Must know the default gateway’s IP address The Destination MAC Address of the host with the Destination IP
address of the packet Later when we discuss Ethernet
Host: “I’m a host on the 192.168.1.0/24 network.”
22
Subnet Mask
Devices such as hosts use the bit-wise AND operation on the: Host IP address Subnet mask
AND operation: 1 AND 1 = 1 0 AND anything = 0
Host IP: 172.16.33.10 10101100.00010000.00100001.00001010
Mask: 255.255.0.0 11111111.11111111.00000000.00000000
-----------------------------------
Net Add: 172.16.0.0 10101100.00010000.00000000.00000000
Network Host
23
Subnet Mask
AND operation: 1 AND 1 = 1 0 AND anything = 0
Host IP: 172.16.33.10 10101100.00010000.00100001.00001010
Mask: 255.255.255.0 11111111.11111111.11111111.00000000
-----------------------------------
Net Add: 172.16.33.0 10101100.00010000.00100001.00000000
Network Host
24
Subnet Mask
AND operation: 1 AND 1 = 1 0 AND anything = 0
Host IP: 172.1.17.9 10101100.00000001.00010001.00001001
Mask: 255.255.240.0 11111111.11111111.11110000.00000000
-----------------------------------
Net Add: 172.1.16.0 10101100.00000001.00010000.00000000
Network Host
25
Subnet Masks: Non-Natural Boundaries
Subnet masks do not have to end on natural octet boundaries
172.1.16.0 10101100.00000001.00010000.00000000
255.255.240.0 11111111.11111111.11110000.00000000
172.1.16.1 10101100.00000001.00010000.00000001
…
172.1.31.254 10101100.00000001.00011111.11111110
172.1.31.255 10101100.00000001.00011111.11111111
(broadcast)
Number of hosts: 212 – 2 = 4,096 – 2 = 4,094 hosts
Subnetting: First Look
27
Subnets and Subnet Masks
Formalized in 1985, the subnet mask breaks a single network in to smaller pieces.
Allows network administrators to divide their network into small networks or subnets.
Advantages will be discussed later.
28
What is subnetting?
Subnetting is the process of borrowing bits from the HOST bits, in order to divide the larger network into small subnets.
Subnetting does NOT give you more hosts, but actually costs you hosts. You lose two host IP Addresses for each subnet, one for the subnet IP address
and one for the subnet broadcast IP address. You lose the last subnet and all of it’s hosts’ IP addresses as the broadcast for
that subnet is the same as the broadcast for the network. In older technology, you would have lost the first subnet, as the subnet IP
address is the same as the network IP address. (This subnet can be used in most networks.)
Network Network Host Host
172 16 0 0
Network Network Subnet Host
29
AnalogyBefore subnetting: In any network (or subnet) we can not use
all the IP addresses for host addresses. We lose two addresses for every network
or subnet.1. Network Address - One address is reserved
to that of the network. For Example: 172.16.0.0 /16
2. Broadcast Address – One address is reserved to address all hosts in that network or subnet. For Example: 172.16.255.255
This gives us a total of 65,534 usable hosts
98 Apples (100 – 2)
30
Analogy
It is the same as taking a barrel of 100 apples and dividing it into 10 barrels of 10 apples each.
10
10
10
1010
10
10
10
10
10
10 barrels x 10 apples = 100 apples
98 Apples (100 – 2)
31
However, in subnetting we will see that we lose two apples per subnet: one for the network address one for the broadcast address
(less 2) (less 2) (less 2)
(less 2) (less 2) (less 2)
(less 2) (less 2) (less 2)
8 8 8
8 8 8
8 8 8
8
10 barrels x 8 apples = 80 apples
2 = 1 network address + 1 broadcast address
98 Apples (100 – 2)
(less 2)
32
In legacy networks, we also lost: The first basket (subnet)
The network address of the first subnet is the network address of the entire network
The last basket (subnet) The broadcast address for the last subnet is the
same as for the entire network.
(less 2) (less 2) (less 2)
(less 2) (less 2) (less 2)
(less 2) (less 2) (less 2)
8 8 8
8 8 8
8 8 8
8
8 barrels x 8 apples = 64 apples
2 = 1 network address + 1 broadcast address
98 Apples (100 – 2)
(less 2)
X
X
33
Subnet Example
Network Network Subnet Host
Network address 172.16.0.0 with /16 Base Network Mask
172 16 0 0
172 16 1 0
172 16 2 0
Using Subnets: Subnet Mask 255.255.255.0 or /24
172 16 3 0
172 16 Etc. 0
172 16 254 0
172 16 255 0
256 Subnets
28
Subnets Addresses
Subnet addresses: All 0’s in host portion
34
Subnet Example
Network Network Subnet Hosts
172 16 0 1
172 16 1 1
172 16 2 1
172 16 3 1
172 16 Etc. 1
172 16 254 1
172 16 255 1
Each subnet has 254 hosts, 28 – 2
254
254
254
254
254
254
Broadcast
Network address 172.16.0.0 with /16 Base Network Mask
Using Subnets: Subnet Mask 255.255.255.0 or /24
255
255
255
255
255
255
254 255
35
With NO subnetting:
Network First Host Last Host Broadcast
172.16.0.0 172.16.0.1 172.16.255.254 172.16.255.255
65,534 host addresses, one for network address and one for broadcast address.
Host IP Address: 172.16.3.50 A host of the 172.16.0.0 /16 network
Host IP Address: 172.16.3.50 A host of the 172.16.3.0 /24 network
36
With subnetting:
Network First Host Last Host Broadcast
172.16.0.0 172.16.0.1 172.16.0.254 172.16.0.255
172.16.1.0 172.16.1.1 172.16.1.254 172.16.1.255
172.16.2.0 172.16.2.1 172.16.2.254 172.16.2.255
172.16.3.0 172.16.3.1 172.16.3.254 172.16.3.255
172.16.4.0 172.16.4.1 172.16.4.254 172.16.4.255
172.16.5.0 172.16.5.1 172.16.5.254 172.16.5.255
172.16.6.0 172.16.6.1 172.16.6.254 172.16.6.255
172.16.7.0 172.16.7.1 172.16.7.254 172.16.7.255
…
172.16.254.0 172.16.254.1 172.16.254.254 172.16.15.255
172.16.255.0 172.16.255.1 172.16.255.254 172.16.255.255
Host IP Address: 172.16.3.50 A host of the 172.16.3.0 /24 network
37
With subnetting:Network First Host Last Host Broadcast
Hosts
172.16.0.0 172.16.0.1 172.16.0.254 172.16.0.255 254
172.16.1.0 172.16.1.1 172.16.1.254 172.16.1.255 254
172.16.2.0 172.16.2.1 172.16.2.254 172.16.2.255 254
172.16.3.0 172.16.3.1 172.16.3.254 172.16.3.255 254
172.16.4.0 172.16.4.1 172.16.4.254 172.16.4.255 254
172.16.5.0 172.16.5.1 172.16.5.254 172.16.5.255 254
172.16.6.0 172.16.6.1 172.16.6.254 172.16.6.255 254
172.16.7.0 172.16.7.1 172.16.7.254 172.16.7.255 254
…
172.16.254.0 172.16.254.1 172.16.254.254 172.16.15.255 254
172.16.255.0 172.16.255.1 172.16.255.254 172.16.255.255 254 ---
65,024
Total address = 256 subnets * (256 hosts – 2)
= 256 * 254
= 65,024
NOTE: It is common for some network administrator to not use the last subnet.
38
With subnetting:Network First Host Last Host Broadcast
172.16.0.0 172.16.0.1 172.16.0.254 172.16.0.255
172.16.255.0 172.16.255.1 172.16.255.254 172.16.255.255
Major Network Address: 172.16.0.0
Major Network Mask: 255.255.0.0
Major Network Broadcast Address: 172.16.255.255
Subnet Mask: 255.255.255.0
First Subnet:
Subnet Address: 172.16.0.0
Subnet Broadcast Address: 172.16.0.255
Last Subnet:
Subnet Address: 172.16.255.0
Subnet Broadcast Address: 172.16.255.255
Subnetting: Step-by-step
40
Determining Network and Subnet Information
Use the Classless Subnetting Worksheet (Excel Spreadsheet) to do the following:
Given any IP address and major network mask we can determine: Major Network Address First host address of the network Last host address of the network Broadcast address of the network Number of usable hosts in the network
If the network is subnetted and we know the subnet mask we can determine: Subnet (network) Address First host address of the subnet Last host address of the subnet Broadcast address of the subnet Number of usable hosts in the subnet Number of usable subnets in this network
41
See these spreadsheets on my website
Worksheet: Classless Subnetting Worksheet (Excel spreadsheet)
Nutshell: Classless Subnetting in a Nutshell (Excel spreadsheet)
42
Part 1: Determine Major Network Information
43
Convert IP Address/Network Mask to Binary
First, let’s determine the Major Network Information. This is the information for the entire network, whether or not there are subnets. Using the Major Network Mask, determine the major network Address, the broadcast
address for the entire network, and the number of hosts for the entire network. The Major Network Mask (or Base Mask, Subnet Mask) is provided by the ISP. Convert these addresses to binary.
Host IP Address:138.101.114.250Major Network Mask: 255.255.0.0 (/16)
44
Determine Network Address
Determine the Network Address by using the AND operation. Perform a bit-wise AND operation on the IP Address and the Subnet Mask Note: 1 AND 1 results in a 1, 0 AND anything results in a 0 Express the result in Dotted Decimal Notation The result is the Major Network Address of this for this host IP Address is
138.101.0.0
45
Determine Network Address A simple way of doing the AND operation:1. In the Network mask locate where the 1’s end and the 0’s begin and draw a line. (I
call this the “Major Network Divide” or “MD” on the worksheet.)2. Now copy all of the bits above the 1 bits in the Network mask, to the Network
address.3. For the rest of the bits in the Network address (the bits below the 0’s in the Network
mask) write all 0’s.
Network Portion Host Portion
Copy the bits from the Host IP Address to the Major Network Address
Write all 0’s below the 0’s in the Major Network Mask
MD
46
Network: Determine First Host, Last Host, Broadcast Addresses Remember that the network mask separates the network portion of the address from
the host portion. Major Network Mask: 255.255.0.0 or /16
The network address has all 0’s in the host portion of the address The broadcast address has all 1’s in the host portion of the address The first host is all 0’s and a 1 in the host portion of the address. The last host is all 1’s and a 0 in the host portion of the address.
Network Portion Host Portion
47
Network: Determine First Host, Last Host, Broadcast Addresses The network address has all 0’s in the host portion of the address The broadcast address has all 1’s in the host portion of the address The first host is all 0’s and a 1 in the host portion of the address. The last host is all 1’s and a 0 in the host portion of the address.
Network Portion Host Portion
48
Network: Determine the number of usable hosts By counting the number of host bits we can determine the total number of usable hosts for this
network (before subnetting).Host bits: 16Total number of hosts:
216 = 65,53665,536 – 2 = 65,534 (Can’t use the all 0’s address, network address, or the all 1’s address, broadcast address.)
Host Portion = 16 bitsNetwork Portion
49
Part 2: Determine Subnet Information
50
Convert IP Address/Subnet Mask to Binary Now we will determine the Subnet Network Information. (Assuming we are subnetted.) This is the information only for that subnet. Using the Subnet Mask, determine the Subnet Address, the broadcast address for the entire network, and the number of hosts for the subnet. The Subnet Mask is determined by the network administrator, depending upon the number of subnets and the number of hosts per subnet that
are needed. Convert these addresses to binary.
Host IP Address: 138.101.114.250Subnet Mask: 255.255.255.192 (/26)
51
Determine Subnet Address Determine the Network Address by using the AND operation. Perform a bit-wise AND operation on the IP Address and the Subnet Mask Note: 1 AND 1 results in a 1, 0 AND anything results in a 0 Express the result in Dotted Decimal Notation The result is the Major Network Address of this for this host IP Address is
138.101.114.192
52
Determine Subnet Address A simple way of doing the AND operation:1. In the Subnet mask locate where the 1’s end and the 0’s begin and draw a line. (I call this the “Subnet
Divide” or “SD” on the worksheet.)2. Now copy all of the bits above the 1 bits in the Subnet mask, to the Network address.3. For the rest of the bits in the Subnet address (the bits below the 0’s in the Network mask) write all 0’s.
Network/Subnet Portion Host Portion
Copy the bits from the Host IP Address to the Major Network Address Write all 0’s below the 0’s in
the Major Network Mask
SD
53
Subnet: Determine First Host, Last Host, Broadcast Addresses Remember that the network mask separates the network portion of the address from
the host portion. Subnet Mask: 255.255.255.192 or /26
The network address has all 0’s in the host portion of the address The broadcast address has all 1’s in the host portion of the address The first host is all 0’s and a 1 in the host portion of the address. The last host is all 1’s and a 0 in the host portion of the address.
Network PortionHost Portion
Subnet Portion
54
Subnet: Determine First Host, Last Host, Broadcast Addresses The subnet address has all 0’s in the host portion of the subnet address The broadcast address has all 1’s in the host portion of the subnet address The first host is all 0’s and a 1 in the host portion of the subnet address. The last host is all 1’s and a 0 in the host portion of the subnet address.
Network PortionHost Portion
Subnet Portion
55
Subnet: Determine the number of usable hosts By counting the number of host bits we can determine the total number of usable hosts for this
subnet.Host bits: 6Total number of hosts:
26 = 6464 – 2 = 62 (Can’t use the all 0’s address, network address, or the all 1’s address, broadcast address.)
Network Portion Host Portion
SD
Subnet Portion
56
Subnet: Determine the number of usable subnets By counting the number of subnet bits we can determine the total number of usable hosts for
this subnet.Subnet bits: 10Total number of hosts:
210 = 1,0241,024 – (0, 1, or 2) = ? 1,024 – 1 = 1,023 usable subnets
The number of usable subnets depends upon whether or not we can use the first and/or last subnets. In today’s networks, both the first and last subnets are generally usable.
In this example, the network administrator has determined the last subnet is not to be used.
Network PortionHost Portion
Subnet Portion
SDMD
57
Overall Visual The subnet address has all 0’s in the host portion of the subnet address The broadcast address has all 1’s in the host portion of the subnet address The first host is all 0’s and a 1 in the host portion of the subnet address. The last host is all 1’s and a 0 in the host portion of the subnet address.
58
Overall VisualThe following information must be provided: IP Address (host or network) Major Network MaskIf subnetted: Subnet Mask Number of usable subnets (less 0, 1, or 2)
59
NotesQuick check First host: 1 more than network/subnet address Last host: 1 less than broadcast Does the host IP address fall in the range of network host
addresses? Of subnet host addresses?
How do hosts view the network? Hosts receive a host IP address and mask. Hosts only see themselves as part of their subnet (or network if not
subnetted). They don’t know or care if they are in a network or subnet. Almost all networks are a subnet of some larger network.
60
See these spreadsheets on my website
Worksheet: Classless Subnetting Worksheet (Excel spreadsheet)
Nutshell: Classless Subnetting in a Nutshell (Excel spreadsheet)
61
Tips
Use worksheets Don’t do short-cuts unless you understand the process we just
discussed and you know what you are doing. Only use a subnet calculator to check your answers.
You must know how to subnet, then you can use the calculator. Interviews, exams, and certification exams do not allow subnet
calculators. Practice, practice, practice!
Chapter 6IPv4 Addresses – Part 2
CIS 81 Networking Fundamentals
Rick Graziani
Cabrillo College
Last Updated: 3/30/2008