Chapter 6 Powerpoint Part Two

advertisement
Chapter 6
IPv4 Addresses – Part 2
CIS 81 Networking Fundamentals
Rick Graziani
Cabrillo College
graziani@cabrillo.edu
Spring 2010
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: graziani@cabrillo.edu
 Web Site: www.cabrillo.edu/~rgraziani
2
Note
 This presentation is not in the order of the book or online curriculum.
 This presentation also contains information beyond the curriculum.
3
Host IP Addresses
Host IP Addresses
172.0.0.0 (net)
255.0.0.0 (SM)
172.0.0.1
172.255.255.254
172.255.255.255
(broadcast)
10101100.00000000.00000000.00000000
11111111.00000000.00000000.00000000
10101100.00000000.00000000.00000001
10101100.11111111.11111111.11111110
10101100.11111111.11111111.11111111
172.16.0.0 (net)
255.255.0.0 (SM)
172.16.0.1
172.16.255.254
172.16.255.255
(broadcast)
10101100.00010000.00000000.00000000
11111111.11111111.00000000.00000000
10101100.00010000.00000000.00000001
10101100.00010000.11111111.11111110
10101100.00010000.11111111.11111111
5
Host IP Addresses
172.1.16.0
255.255.240.0
10101100.00000001.00010000.00000000
11111111.11111111.11110000.00000000
172.1.16.1
…
172.1.31.254
10101100.00000001.00010000.00000001
172.1.31.255
(broadcast)
10101100.00000001.00011111.11111111
10101100.00000001.00011111.11111110
Number of hosts: 212 – 2 = 4,096 – 2 = 4,094 hosts
6
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)
7
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
8
ISP (Internet
Service Providers)
Most companies or
organizations obtain
their IPv4 address
blocks from an ISP.
 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
9
ISP (Internet
Service Providers)
Most companies or
organizations obtain
their IPv4 address
blocks from an ISP.
 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
10
ISP (Internet
Service Providers)
Most companies or
organizations obtain
their IPv4 address
blocks from an ISP.
 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
11
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.
12
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)
13
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).
14
NAT Example
1
2
DA
128.23.2.2
1
DA
SA
10.0.0.3
IP Header
....
128.23.2.2
Data
2
SA
179.9.8.80
....
Data
IP Header
The translation from Private source IP address to Public source IP address.
15
NAT Example
4
3
DA
SA
10.0.0.3
128.23.2.2
4
IP Header
DA
....
Data
179.9.8.80
3
SA
128.23.2.2
....
Data
IP Header
Translation back, from Public destination IP address to Private destination IP
address.
16
PAT Example
NAT/PAT table
maintains translation
of:
DA, SA, SP
DA
128.23.2.2
1
DA
128.23.2.2
SA
10.0.0.3
IP Header
SA
10.0.0.2
IP Header
DP
80
SP
1331
DA
Data
TCP/UDP
Header
DP
80
1555
TCP/UDP
Header
128.23.2.2 179.9.8.80
2
SP
DA
Data
SA
IP Header
SA
128.23.2.2 179.9.8.80
IP Header
DP
80
SP
3333
Data
TCP/UDP
Header
DP
80
SP
2222
TCP/UDP
Header
Data
17
PAT Example
NAT/PAT table maintains
translation of:
SA (DA), DA (SA), DP (SP)
DA
10.0.0.3
SA
128.23.2.2
IP Header
4
DA
SA
10.0.0.2
128.23.2.2
IP Header
DP
SP
1331
80
DA
Data
TCP/UDP
Header
DP
1555
80
TCP/UDP
Header
179.9.8.80 128.23.2.2
3
SP
DA
Data
SA
179.9.8.80
IP Header
SA
128.23.2.2
IP Header
DP
3333
SP
80
Data
TCP/UDP
Header
DP
2222
SP
80
TCP/UDP
Header
Data
18
The Subnet Mask and the AND
Operation
Subnet Mask
Host: “I’m a host on the 192.168.1.0/24 network.”
 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?
20
Subnet Mask
Host: “I’m a host on the 192.168.1.0/24 network.”
 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
21
Subnet Mask
Network
Host
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
 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
22
Subnet Mask
Network
Host
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
 AND operation:
 1 AND 1 = 1
 0 AND anything = 0
23
Subnet Mask
Network
Host IP: 172.1.17.9
Mask: 255.255.240.0
Net Add: 172.1.16.0
Host
10101100.00000001.00010001.00001001
11111111.11111111.11110000.00000000
----------------------------------10101100.00000001.00010000.00000000
 AND operation:
 1 AND 1 = 1
 0 AND anything = 0
24
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
…
172.1.31.254
10101100.00000001.00010000.00000001
172.1.31.255
(broadcast)
10101100.00000001.00011111.11111111
10101100.00000001.00011111.11111110
Number of hosts: 212 – 2 = 4,096 – 2 = 4,094 hosts
25
Subnetting: First Look
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.
27
What is subnetting?
Network Network
172
16
Network Network
Host
Host
0
0
Subnet
Host
 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.)
28
Analogy
98 Apples
(100 – 2)
Before 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
29
Analogy
98 Apples
(100 – 2)
10 barrels x 10 apples = 100 apples
10
10
10
10
10
10
10
10
10
10
 It is the same as taking a barrel of 100 apples and
dividing it into 10 barrels of 10 apples each.
30
2 = 1 network address + 1 broadcast address
10 barrels x 8 apples = 80 apples
8
8
(less 2)
98 Apples
(100 – 2)
8
8
(less 2)
8
(less 2)
8
8
(less 2)
8
(less 2)
(less 2)
(less 2)
8
(less 2)
 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)
8
(less 2)
31
2 = 1 network address + 1 broadcast address
8 barrels x 8 apples = 64 apples
8
X
8
(less 2)
98 Apples
(100 – 2)
8
8
(less 2)
8
(less 2)
8
8
(less 2)
8
(less 2)
(less 2)
(less 2)
8
(less 2)
 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)
X
8
(less 2)
32
Subnet Example
Network address 172.16.0.0 with /16 Base Network Mask
Using Subnets: Subnet Mask 255.255.255.0 or /24
Subnet addresses: All 0’s in host portion
Network Network
Subnet
Host
172
172
16
16
0
1
0
0
172
172
172
172
16
16
16
16
2
3
Etc.
254
0
0
0
0
172
16
255
0
Subnets
Addresses
256
Subnets
28
33
Subnet Example
Network address 172.16.0.0 with /16 Base Network Mask
Using Subnets: Subnet Mask 255.255.255.0 or /24
Network Network
Subnet
Hosts
Broadcast
172
172
16
16
0
1
1
1
254
254
255
255
172
172
172
172
16
16
16
16
2
3
Etc.
254
1
1
1
1
254
254
254
255
255
255
172
16
255
1
254
254
255
255
Each subnet has 254 hosts, 28 – 2
34
Host IP Address: 172.16.3.50
 A host of the 172.16.3.0 /24 network
With NO subnetting:
Network
172.16.0.0
First Host
172.16.0.1
Last Host
172.16.255.254
Broadcast
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
35
With subnetting:
Network
172.16.0.0
172.16.1.0
172.16.2.0
172.16.3.0
172.16.4.0
172.16.5.0
172.16.6.0
172.16.7.0
…
172.16.254.0
172.16.255.0
Host IP Address: 172.16.3.50
 A host of the 172.16.3.0 /24 network
First Host
172.16.0.1
172.16.1.1
172.16.2.1
172.16.3.1
172.16.4.1
172.16.5.1
172.16.6.1
172.16.7.1
Last Host
172.16.0.254
172.16.1.254
172.16.2.254
172.16.3.254
172.16.4.254
172.16.5.254
172.16.6.254
172.16.7.254
Broadcast
172.16.0.255
172.16.1.255
172.16.2.255
172.16.3.255
172.16.4.255
172.16.5.255
172.16.6.255
172.16.7.255
172.16.254.1
172.16.255.1
172.16.254.254
172.16.255.254
172.16.15.255
172.16.255.255
36
With subnetting:
Network
172.16.0.0
172.16.1.0
172.16.2.0
172.16.3.0
172.16.4.0
172.16.5.0
172.16.6.0
172.16.7.0
…
172.16.254.0
172.16.255.0
First Host
172.16.0.1
172.16.1.1
172.16.2.1
172.16.3.1
172.16.4.1
172.16.5.1
172.16.6.1
172.16.7.1
172.16.254.1
172.16.255.1
Last Host
172.16.0.254
172.16.1.254
172.16.2.254
172.16.3.254
172.16.4.254
172.16.5.254
172.16.6.254
172.16.7.254
Broadcast
172.16.0.255
172.16.1.255
172.16.2.255
172.16.3.255
172.16.4.255
172.16.5.255
172.16.6.255
172.16.7.255
172.16.254.254
172.16.255.254
172.16.15.255
172.16.255.255
Hosts
254
254
254
254
254
254
254
254
254
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.
37
With subnetting:
Network
172.16.0.0
172.16.255.0
First Host
172.16.0.1
172.16.255.1
Last Host
Broadcast
172.16.0.254
172.16.0.255
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
38
Subnetting: Step-by-step
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
40
See these spreadsheets on my website
Nutshell: Classless
Subnetting in a Nutshell
(Excel spreadsheet)
Worksheet: Classless
Subnetting Worksheet (Excel
spreadsheet)
41
Part 1: Determine Major Network Information
42
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.250
Major Network Mask: 255.255.0.0 (/16)
43
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
44
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.
MD
Network Portion
Copy the bits from the Host IP Address
to the Major Network Address
Host Portion
Write all 0’s below the 0’s in
the Major Network Mask
45
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
46
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
47
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: 16
Total number of hosts:
216 = 65,536
65,536 – 2 = 65,534 (Can’t use the all 0’s address, network address, or the all 1’s
address, broadcast address.)
Network Portion
Host Portion = 16 bits
48
Part 2: Determine Subnet Information
49
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.250
Subnet Mask:
255.255.255.192 (/26)
50
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
51
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.
SD
Network/Subnet Portion
Copy the bits from the Host IP
Address to the Major Network
Address
Host
Portion
Write all 0’s below the 0’s in
the Major Network Mask
52
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 Portion
Subnet Portion
Host
Portion
53
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 Portion
Subnet Portion
Host
Portion
54
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: 6
Total number of hosts:
26 = 64
64 – 2 = 62 (Can’t use the all 0’s address, network address, or the all 1’s
address, broadcast address.)
SD
Network Portion
Subnet Portion
Host
Portion
55
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: 10
Total number of hosts:
210 = 1,024
1,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.
MD
Network Portion
Subnet Portion
SD
Host
Portion
56
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.
57
Overall Visual
The following information must be provided:
 IP Address (host or network)
 Major Network Mask
If subnetted:
 Subnet Mask
 Number of usable subnets (less 0, 1, or 2)
58
Notes
Quick 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.
59
See these spreadsheets on my website
Nutshell: Classless
Subnetting in a Nutshell
(Excel spreadsheet)
Worksheet: Classless
Subnetting Worksheet (Excel
spreadsheet)
60
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!
61
Chapter 6
IPv4 Addresses – Part 2
CIS 81 Networking Fundamentals
Rick Graziani
Cabrillo College
graziani@cabrillo.edu
Last Updated: 3/30/2008
Download