IP地址

advertisement
IP寻址
IP Address
深圳职业技术学院计算机系网络专业
© 2006, Shenzhen Polytechnic. All rights reserved.
1
教学目标( Objectives )
1. IP地址概念( Concept of IP Address )
2. IP地址分类 (Class of IP Address)
3. 保留和私有地址( Reserved and Private IP
Address)
4. 网络掩码和子网划分(Network Mask and
Subnetting )
5. 可变长度子网掩码( VLSM )
6. 汇总和CIDR( Summarization and CIDR)
© 2006, Shenzhen Polytechnic. All rights reserved.
.
2
IP地址(IP Address)
IP地址唯一的标识网络上计算机,IP地址就是由
0和1组成的32位字符串。
Each computer in a TCP/IP network must
be given a unique identifier, or IP address.
An IP address is a 32-bit sequence of 1s
and 0s.
© 2006, Shenzhen Polytechnic. All rights reserved.
.
3
IP地址表示(Representation of IP Address)
192
.
168
.
123
.
2
为了容易使用,采用点分十进制格式来表示IP地址
To make the IP address easier to use, the address is
usually written as four decimal numbers separated by
periods
© 2006, Shenzhen Polytechnic. All rights reserved.
.
4
IP地址结构(Structure of IP Address)
© 2006, Shenzhen Polytechnic. All rights reserved.
.
5
IP地址的类别(Class of IP Address)
© 2006, Shenzhen Polytechnic. All rights reserved.
.
6
A类地址(Class A)
地址范围:1~126(127保留)
Address Range:1-126(127 Reserved)
© 2006, Shenzhen Polytechnic. All rights reserved.
.
7
B类地址(Class B)
地址范围: 128~191
Address Range:128-191
© 2006, Shenzhen Polytechnic. All rights reserved.
.
8
C类地址(Class C)
地址范围: 192~223
Address Range:192-223
© 2006, Shenzhen Polytechnic. All rights reserved.
.
9
地址分配(Address Allocating)
分配A类IP:国际网络信息中心NIC
分配B类IP:InterNIC、APNIC、ENIC
分配C类IP:国家或地区的NIC
© 2006, Shenzhen Polytechnic. All rights reserved.
.
10
保留地址(Reserved Address)
保留地址指某些地址不能分配网络上的设备使用
Certain host addresses are reserved and cannot be assigned to
devices on a network.
1.主机部分全0表示网络地址
An IP address that has binary 0s in all host bit positions is reserved
for the network address.
2.主机部分全1表示广播地址
An IP address that has binary 1s in all host bit positions is reserved
for the broadcast address.
3.全0的IP地址,即0.0.0.0。设置缺省路由时使用。
An IP address that has binary 0s in all bit positions is reserved for default
route
4.全1地址255.255.255.255,表示泛洪广播
An IP address that has binary 0s in all bit positions is reserved for flood broadcast
© 2006, Shenzhen Polytechnic. All rights reserved.
.
11
私有地址(Private IP Address)
1. 私有地址可以节省IP地址
Private IP addresses are another solution to the
problem of the impending exhaustion of public IP
addresses.
2. 私有地址不能在Internet上被路由
Private IP addresses are not routed on the Internet
backbone.
© 2006, Shenzhen Polytechnic. All rights reserved.
.
12
Exercise: IP Address Classes
Address
Class
Network
Host
10.2.1.1
128.63.2.100
201.222.5.64
192.6.141.2
130.113.64.16
256.241.201.10
© 2006, Shenzhen Polytechnic. All rights reserved.
.
13
IP Address Classes Exercise Answers
Address
Class
10.2.1.1
A
10.0.0.0
0.2.1.1
128.63.2.100
B
128.63.0.0
0.0.2.100
201.222.5.64
C
201.222.5.0
0.0.0.64
192.6.141.2
C
192.6.141.0
0.0.0.2
130.113.64.16
B
130.113.0.0
0.0.64.16
256.241.201.10
Network
Host
Nonexistent
© 2006, Shenzhen Polytechnic. All rights reserved.
.
14
网络掩码(Network Mask)
A类:255.0.0.0
B类:255.255.0.0
C类:255.255.255.0
© 2006, Shenzhen Polytechnic. All rights reserved.
.
15
网络掩码的作用(Function of Network Mask)
10101100 00010000 00000010 10100000
 11111111 11111111 00000000 00000000
10101100 00010000 00000000 00000000
172.16.2.160
255.255.0.0
172.16.0.0
Network ID
© 2006, Shenzhen Polytechnic. All rights reserved.
.
16
子网划分(Subnetting)
为了克服有限的IP地址,所有类别网络
可以被划分为更小的子网。
To efficiently manage a limited supply of
IP addresses, all classes can be
subdivided into smaller subnetworks.
© 2006, Shenzhen Polytechnic. All rights reserved.
.
17
划分子网原因(Reasons for Subnetting)
1. 提供灵活的编址
Provides addressing flexibility Provides
2. 提供广播抑制
Broadcast Containment
3. 为LAN提供低水平的安全
Low-level security on the LAN.
© 2006, Shenzhen Polytechnic. All rights reserved.
.
18
介绍子网划分(Introduction to Subnetting)
划分子网要从主
机位借位
Host bits must
are reassigned
(or “borrowed”)
as network bits.
3 bits borrowed allows 23-2 or 6 subnets
5 bits borrowed allows 25-2 or 30 subnets
12 bits borrowed allows 212-2 or 4094 subnets
© 2006, Shenzhen Polytechnic. All rights reserved.
.
19
介绍子网划分(Introduction toSubnetting)
不考虑子网
网络号码
主机号码
网络掩码
网络号码
考虑子网化
主机号码
子网掩码
网络号码
子网号码
主机号码
扩充的网络号码
© 2006, Shenzhen Polytechnic. All rights reserved.
.
20
Comparison between decimal and binary
© 2006, Shenzhen Polytechnic. All rights reserved.
.
21
实例1:C类地址2位子网化
( E.g1 Two Bits Subnetting for Class C )
子网号(Subnet)
地址范围(range)
00 000000
0
00000001~00111111
1~62
其中:0为网络地址,63为广播地址
01 000000
64
01000001~01111111
65~127
其中:64为网络地址,127为广播地址
10 000000
128
10000001~10111111
129~191
其中:128为网络地址,191为广播地址
11 000000
192
11000001~11111111
193~255
其中:192为网络地址,255为广播地址
© 2006, Shenzhen Polytechnic. All rights reserved.
.
22
实例2:C类地址4位子网化
( E.g2 4 Bits Subnetting for Class C )
组合
子网号
地址范围
0000 0000
0
00000001~00001111
1~15
0001 0000
16
00010001~00011111
17~31
0010 0000
32
00100001~00101111
33~47
0011 0000
48
00110001~00111111
49~63
0100 0000
64
01000001~01001111
65~79
0101 0000
80
01010001~01011111
81~95
0110 0000
96
01100001~01101111
97~111
0111 0000
112
01110001~01111111
113~127
1000 0000
128
10000001~10001111
129~143
1001 0000
144
10010001~10011111
145~159
1010 0000
160
10100001~10101111
161~175
1011 0000
176
10110001~10111111
177~191
1100 0000
192
11000001~11001111
193~207
1101 0000
208
11010001~11011111
209~223
1110 0000
224
11100001~11101111
225~239
1111 0000
240
11110001~11111111
241~255
其中:15为广播地址
其中:31为广播地址
其中:47为广播地址
其中:63为广播地址
其中:79为广播地址
其中:95为广播地址
其中:111为广播地址
其中:127为广播地址
其中:143为广播地址
其中:159为广播地址
其中:175为广播地址
其中:191为广播地址
其中:207为广播地址
其中:223为广播地址
其中:239为广播地址
其中:255为广播地址
© 2006, Shenzhen Polytechnic. All rights reserved.
.
23
可用的子网和主机数
(Number of Usable Subnets and Hosts )
usable subnets=
(2 power of borrowed bits)–2
usable hosts=
(2 power of remaining host bits)–2
© 2006, Shenzhen Polytechnic. All rights reserved.
.
24
C类地址划分子网情况汇总
(Summary of Class C Subnetting)
© 2006, Shenzhen Polytechnic. All rights reserved.
.
25
Written Exercise: Subnet Masks
Address
Subnet Mask
172.16.2.10
255.255.255.0
10.6.24.20
255.255.0.0
172.30.36.12
255.255.255.0
Class
Subnet
202.30.36.82 255.255.255.192
© 2006, Shenzhen Polytechnic. All rights reserved.
.
26
Subnet Mask Exercise Answers
Address
Subnet Mask
Class
Subnet
172.16.2.10
255.255.255.0
B
172.16.2.0
10.6.24.20
255.255.240.0
A
10.6.16.0
10.30.36.12
255.255.255.0
A
10.30.36.0
© 2006, Shenzhen Polytechnic. All rights reserved.
.
27
Written Exercise: Broadcast Addresses
Address
Subnet Mask
201.222.10.60
255.255.255.248
15.16.193.6
255.255.248.0
128.16.32.13
255.255.255.252
153.50.6.27
255.255.255.128
Class
Subnet
Broadcast
© 2006, Shenzhen Polytechnic. All rights reserved.
.
28
Broadcast Addresses Exercise Answers
Address
Subnet Mask
Class
Subnet
Broadcast
201.222.10.60 255.255.255.248
C
201.222.10.56
201.222.10.63
15.16.193.6
255.255.248.0
A
15.16.192.0
15.16.199.255
128.16.32.13
255.255.255.252
B
128.16.32.12
128.16.32.15
153.50.6.27
255.255.255.128
B
153.50.6.0
153.50.6.127
© 2006, Shenzhen Polytechnic. All rights reserved.
.
29
Case Study:Subnet Programming
30 hosts per subnet
Class C address:
201.222.5.0
Other
subnets
© 2006, Shenzhen Polytechnic. All rights reserved.
.
30
可变长度子网掩码(Variable-Length Subnet Mask)
HQ
172.16.0.0/16
© 2006, Shenzhen Polytechnic. All rights reserved.
.
31
可变长度子网掩码(Variable-Length Subnet Mask)
HQ
HQ
172.16.0.0/16
© 2006, Shenzhen Polytechnic. All rights reserved.
.
32
可变长度子网掩码(Variable-Length Subnet Mask)
172.16.14.32/27
A
172.16.14. 64/27
B
HQ
HQ
172.16.0.0/16
172.16.14.96/27
C
• 将子网172.16.14.0/24划分为更小的子网,首先掩码长度为27
• Subnet 172.16.14.0/24 is divided into smaller subnets:
– Subnet with one mask at first (/27)
© 2006, Shenzhen Polytechnic. All rights reserved.
.
33
可变长度子网掩码(Variable-Length Subnet Mask)
172.16.14.32/27
A
172.16.14. 64/27
B
HQ
HQ
172.16.0.0/16
172.16.14.96/27
C
• 将没有使用的掩码长度为27的子网进一步划分为掩码长度为30
– Subnet with one mask at first (/27)
– Further subnet one of these subnets not used elsewhere
(/30)
© 2006, Shenzhen Polytechnic. All rights reserved.
.
34
计算VLSM(Calculating VLSMs)
Subnetted Address: 172.16.32.0/20
In Binary 10101100. 00010000.00100000.00000000
© 2006, Shenzhen Polytechnic. All rights reserved.
.
35
计算VLSM(Calculating VLSMs)
Subnetted Address: 172.16.32.0/20
In Binary 10101100. 00010000.00100000.00000000
VLSM Address: 172.16.32.0/26
In Binary 10101100. 00010000.00100000.00000000
© 2006, Shenzhen Polytechnic. All rights reserved.
.
36
计算VLSM(Calculating VLSMs)
Subnetted Address: 172.16.32.0/20
In Binary 10101100. 00010000.00100000.00000000
VLSM Address: 172.16.32.0/26
In Binary 10101100. 00010000.00100000.00000000
1st subnet:
10101100 . 00010000 .0010 0000.00 000000=172.16.32.0/26
Network
Subnet VLSM
subnet
Host
© 2006, Shenzhen Polytechnic. All rights reserved.
.
37
计算VLSM(Calculating VLSMs)
Subnetted Address: 172.16.32.0/20
In Binary 10101100. 00010000.00100000.00000000
VLSM Address: 172.16.32.0/26
In Binary 10101100. 00010000.00100000.00000000
1st subnet: 10101100 . 00010000
2nd subnet:
172
.
16
3rd subnet:
172
.
16
172
.
16
4th subnet:
172
.
16
5th subnet:
Network
.0010
.0010
.0010
.0010
.0010
0000.00
0000.01
0000.10
0000.11
0001.00
Subnet VLSM
Subnet
000000=172.16.32.0/26
000000=172.16.32.64/26
000000=172.16.32.128/26
000000=172.16.32.192/26
000000=172.16.33.0/26
Host
© 2006, Shenzhen Polytechnic. All rights reserved.
.
38
练习:使用VLSM规划网路
(Exercise:Design Network Using VLSM )
Derived from the 172.16.32.0/20 Subnet
(62 Hosts)
(62 Hosts)
(62 Hosts)
(62 Hosts)
© 2006, Shenzhen Polytechnic. All rights reserved.
.
39
练习答案(Exercise Answer)
Derived from the 172.16.32.0/20 Subnet
172.16.32.0/26
172.16.33.0/30
172.16.33.4/30
172.16.32.64/26
172.16.33.8/30
172.16.32.128/26
172.16.33.12/30
172.16.32.192/26
Derived from the
172.16.33.0/26 Subnet
30-Bit Mask
(2 Hosts)
26-Bit Mask
(62 Hosts)
© 2006, Shenzhen Polytechnic. All rights reserved.
.
40
路由汇总(Route Summarization)
172.16.25.0/24
172.16.26.0/24
A
172.16.27.0/24
Routing table
172.16.25.0/24
172.16.26.0/24
172.16.27.0/24
© 2006, Shenzhen Polytechnic. All rights reserved.
.
41
路由汇总(Route Summarization)
172.16.25.0/24
I can route to the
172.16.0.0/16 network.
172.16.26.0/24
A
172.16.27.0/24
Routing Table
172.16.25.0/24
172.16.26.0/24
172.16.27.0/24
B
Routing Table
172.16.0.0/16
• 路由协议能够将几条路由条目汇总成一条
• Routing protocols can summarize addresses of several
networks into one address
© 2006, Shenzhen Polytechnic. All rights reserved.
.
42
在一个位组内汇总
(Summarizing within an Octet)
172.16.168.0/24 = 10101100 . 00010000 . 10101 000 . 00000000
172.16.169.0/24 =
172
.
16
. 10101 001 .
0
172.16.170.0/24 =
172
.
16
. 10101 010 .
0
172.16.171.0/24 =
172
.
16
. 10101 011 .
0
172.16.172.0/24 =
172
.
16
. 10101 100 .
0
172.16.173.0/24 =
172
.
16
. 10101 101 .
0
172.16.174.0/24 =
172
.
16
. 10101 110 .
0
172.16.175.0/24 =
172
.
16
. 10101 111 .
0
相同的位数为21(Number of Common Bits = 21)
不同位数11位(Noncommon Bits = 11)
汇总:172.16.168.0/21(Summary: 172.16.168.0/21)
© 2006, Shenzhen Polytechnic. All rights reserved.
.
43
汇总练习(Summarization Example)
192.168.8.0/24
192.168.9.0/24
A
B
192.168.9.0/24
192.168.15.0/24
????
HQ
H
© 2006, Shenzhen Polytechnic. All rights reserved.
.
44
练习答案(Exercise Answer)
192.168.8.0/24
192.168.9.0/24
A
B
192.168.9.0/24
192.168.15.0/24
192.168.8.0/21
HQ
H
• 8条路由条目被汇总成一条
• Networks 192.168.8.0/24 through 192.168.15.0/24 are
summarized by in one advertisement 192.168.8.0/21
© 2006, Shenzhen Polytechnic. All rights reserved.
.
45
思考题(Questions)
1.什么是IP地址?
2.什么是网络掩码?
3.IP地址通常分为哪几类?范围是怎样的?
4.RFC1918的地址是怎样的?
5.为什么进行子网划分?
6.子网划分的思想是什么?
7.什么是VLSM?
8.什么是汇总?
9.192.168.0.0~192.168.7.0汇总后的结果是什么?
10.对于给定的C类地址,需要划分5个子网,子网掩码
应该是什么?
© 2006, Shenzhen Polytechnic. All rights reserved.
.
46
Download
Related flashcards
Create Flashcards