网络已经成为了我们生活中不可或缺的一部分,它连接了世界各地的人们,让信息和资源得以自由流动。随着互联网的发展,我们可以通过网络学习、工作、娱乐,甚至是社交。因此,学习网络知识和技能已经成为了每个人都需要掌握的重要能力。
本课程博主将带领读者深入了解网络的基本原理、结构和运作方式,帮助读者建立起对网络的全面理解。我们将介绍网络的发展历程、网络的分类和组成、网络的安全和隐私保护等内容,帮助读者掌握网络知识,提高网络素养。
通过学习本篇博客,读者将能够更好地利用网络资源,提高工作效率,拓展人际关系,甚至是保护自己的网络安全。网络世界充满了无限的可能,希望本课程能够帮助读者更好地驾驭网络,享受网络带来的便利和乐趣。
访问控制列表(ACL)是一种基于包过滤的访问控制技术,它可以根据设定的条件对接口上的数据包进行过滤,允许其通过或丢弃。访问控制列表被广泛地应用于路由器和三层交换机,借助于访问控制列表,可以有效地控制用户对网络的访问,从而最大程度地保障网络安全。
标准IP访问列表
一个标准IP访问控制列表匹配IP包中的源地址或源地址中的一部分,可对匹配的包采取拒绝或允许两个操作。编号范围是从1到99的访问控制列表是标准IP访问控制列表。
扩展IP访问
扩展IP访问控制列表比标准IP访问控制列表具有更多的匹配项,包括协议类型、源地址、目的地址、源端口、目的端口、建立连接的和IP优先级等。编号范围是从100到199的访问控制列表是扩展IP访问控制列表。
命名的IP访问
所谓命名的IP访问控制列表是以列表名代替列表编号来定义IP访问控制列表,同样包括标准和扩展两种列表,定义过滤的语句与编号方式中相似。
标准IPX访问
标准IPX访问控制列表的编号范围是800-899,它检查IPX源网络号和目的网络号,同样可以检查源地址和目的地址的节点号部分。
扩展IPX访问
扩展IPX访问控制列表在标准IPX访问控制列表的基础上,增加了对IPX报头中以下几个字段的检查,它们是协议类型、源Socket、目标Socket。扩展IPX访问控制列表的编号范围是900-999。
命名的IPX访问
与命名的IP访问控制列表一样,命名的IPX访问控制列表是使用列表名取代列表编号。从而方便定义和引用列表,同样有标准和扩展之分。
理解扩展IP访问控制列表的原理及功能;
掌握编号的扩展IP访问控制列表的配置方法;
实验背景
你是公司的网络管理员,公司的员工要上网,但是公司不允许访问该服务器的Web服务器的网页,你该如何去做呢?
PC代表所有的员工,Server代表Web服务器,
技术原理
访问列表中定义的典型规则主要有以下:源地址、目标地址、上层协议、时间区域;
扩展IP访问列表(编号100-199、2000、2699)使用以上四种组合来进行转发或阻断分组;可以根据数据包的源IP、目的IP、源端口、目的端口、协议来定义规则,进行数据包的过滤。
扩展IP访问列表的配置包括以下两部:
新建Packet Tracer拓扑图
(1)分公司出口路由器与外路由器之间通过V.35电缆串口连接,DCE端连接在R2上,配置其时钟频率64000;主机与路由器通过交叉线连接。
(2)配置PC机、服务器及路由器接口IP地址。
(3)在各路由器上配置静态路由协议,让PC间能相互ping通,因为只有在互通的前提下才涉及到访问控制列表。
(4)在R2上配置编号的IP扩展访问控制列表。
(5)将扩展IP访问列表应用到接口上、。
(6)验证主机之间的互通性。
PC 1台;Server-PT 1台; Router-PT 3台;交叉线;DCE串口线(NM/4A/S)
PC基础配置
PC:
IP 地址:192.168.1.1
子网掩码:255.255.255.0
网 关:192.168.1.254
DNS 解析:8.8.8.8
Server DNS解析:
IP 地址:8.8.8.8
子网掩码:255.255.255.0
网 关:8.8.8.1
R1 ,R2 ,R3基础配置
R1:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#h R1
R1(config)#int f0/0
R1(config-if)#ip add 192.168.1.254 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int s1/0
R1(config-if)#clock r 64000
R1(config-if)#ip add 10.0.1.1 255.255.255.0
R1(config-if)#no shut
R2:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#h R2
R2(config)#int s1/0
R2(config-if)#ip add 10.0.1.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int s1/1
R2(config-if)#clock r 64000
R2(config-if)#ip add 10.0.2.1 255.255.255.0
R2(config-if)#no shut
R3:
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#h R3
R3(config)#int s1/0
R3(config-if)#ip add 10.0.2.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int f0/0
R3(config-if)#ip add 8.8.8.1 255.255.255.0
R3(config-if)#no shut
R1 ,R2 路由配置
R1:
R1(config)#rout ospf 1
R1(config-router)#net 192.168.1.0 0.0.0.255 area 0
R1(config-router)#net 10.0.1.0 0.0.0.255 area 0
R2:
R2(config)#router ospf 1
R2(config-router)#net 10.0.1.0 0.0.0.255 area 0
R2(config-router)#net 10.0.2.0 0.0.0.255 area 0
R3:
R3(config)#router ospf 1
R3(config-router)#net 10.0.2.0 0.0.0.255 area 0
R3(config-router)#net 8.8.8.0 0.0.0.255 area 0
Show R1 ,R2 ,R3路由表
R1:
R1(config)#do show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
8.0.0.0/24 is subnetted, 1 subnets
O 8.8.8.0/24 [110/129] via 10.0.1.2, 00:00:35, Serial1/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C 10.0.1.0/24 is directly connected, Serial1/0
L 10.0.1.1/32 is directly connected, Serial1/0
O 10.0.2.0/24 [110/128] via 10.0.1.2, 00:02:01, Serial1/0
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, FastEthernet0/0
L 192.168.1.254/32 is directly connected, FastEthernet0/0
R2:
R2(config)#do show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
8.0.0.0/24 is subnetted, 1 subnets
O 8.8.8.0/24 [110/65] via 10.0.2.2, 00:00:57, Serial1/1
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 10.0.1.0/24 is directly connected, Serial1/0
L 10.0.1.2/32 is directly connected, Serial1/0
C 10.0.2.0/24 is directly connected, Serial1/1
L 10.0.2.1/32 is directly connected, Serial1/1
O 192.168.1.0/24 [110/65] via 10.0.1.1, 00:02:17, Serial1/0
R3:
R3(config)#do show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
8.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 8.8.8.0/24 is directly connected, FastEthernet0/0
L 8.8.8.1/32 is directly connected, FastEthernet0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O 10.0.1.0/24 [110/128] via 10.0.2.1, 00:01:14, Serial1/0
C 10.0.2.0/24 is directly connected, Serial1/0
L 10.0.2.2/32 is directly connected, Serial1/0
O 192.168.1.0/24 [110/129] via 10.0.2.1, 00:01:14, Serial1/0
打开Server的DNS服务并配置
PC浏览器访问www.kxybz.com网站
PC Ping Server
R2:
R2(config)#access-list 100 deny udp 192.168.1.0 0.0.0.255 8.8.8.0 0.0.0.255 ?
dscp Match packets with given dscp value
eq Match only packets on a given port number
gt Match only packets with a greater port number
lt Match only packets with a lower port number
neq Match only packets not on a given port number
precedence Match packets with given precedence value
range Match only packets in the range of port numbers
/*dscp匹配指定dscp值的数据包
只匹配给定端口号上的数据包
gt只匹配端口号较大的数据包
lt只匹配端口号较低的数据包
只匹配非给定端口号的数据包
precedence匹配具有给定优先级值的数据包
range只匹配端口号范围内的报文
*/
R2(config)#access-list 100 deny udp 192.168.1.0 0.0.0.255 8.8.8.0 0.0.0.255 eq domain
//这里我们要控制DNS的包无法流通,所以限制domain 53
R2(config)#access-list 100 permit ip any any
//其他包放行
R2(config)#int s1/0
R2(config-if)#ip acc 100 in //运用到端口
PC Ping Server
PC 访问 Server的www.kxybz.com服务器网站
PC Ping Server | 通 |
---|---|
PC 访问 www.kxybz.com | 不通 |
扩展acl要靠近源 ,标准acl靠近目标地址 进入设备前处理的ACL起作用设为in,进入设备后处理的ACL起作用的设为out