首页 理论教育配置标准ACL-网络设备配置与实训

配置标准ACL-网络设备配置与实训

【摘要】:实训目的通过以下案例的配置,掌握路由器上编号的标准IP访问列表规则及配置,实现不同网段间互相访问的安全控制。公司的经理部、财务部门和销售部门分属不同的3个网段,三部门之间用路由器进行信息传递。实训步骤首先按实训拓扑图连接各设备,然后按以下步骤进行功能配置。

实训目的

通过以下案例的配置,掌握路由器上编号的标准IP访问列表规则及配置,实现不同网段间互相访问的安全控制。

公司的经理部、财务部门和销售部门分属不同的3个网段,三部门之间用路由器进行信息传递。为了安全起见,公司领导要求销售部门不能对财务部门进行访问,但经理部可以对财务部门进行访问。PC 1代表经理部的主机,PC 2代表销售部门的主机,PC 3代表财务部门的主机,如图5-6所示。

图5-6 配置标准ACL

拓扑图中各设备和接口地址为:

PC 1:192.168.1.2/24

PC 2:192.168.2.2/24

PC 3:192.168.4.2/24

Router 1 S 1/2:192.168.3.1/24

F 1/0:192.168.1.1/24

F 1/1:192.168.2.1/24

Router 2 S 1/2:192.168.3.2/24

F 1/0:192.168.4.1/24

实训设备

R1762路由器2台,V.35线缆2条(一条DCE,一条DTE),直连线或交叉线3条。

实训步骤

首先按实训拓扑图连接各设备,然后按以下步骤进行功能配置。

1.Router 1基本配置

Red-Giant>enable

Red-Giant#configure terminal

Red-Giant(config)#hostname Router1

Router1(config)# interface fastEthernet1/0

Router1(config-if)#ip add 192.168.1.1 255.255.255.0

Router1(config-if)#no shutdown

Router1(config-if)#exit

Router1(config)# interface fastEthernet1/1

Router1(config-if)#ip add 192.168.2.1 255.255.255.0

Router1(config-if)#no shutdown

Router1(config-if)#exit

Router1(config)#interface serial 1/2

Router1(config-if)#ip add 192.168.3.1 255.255.255.0

Router1(config-if)#clock rate 64000

Router1(config-if)#no shutdown

Router1(config-if)#end

2.测试接口状态

Router1#show ip int brief

!观察接口状态

Interface IP-Address(Pri)OK?Status

serial 1/2 192.168.3.1/24 YES UP

serial 1/3 no address YES DOWN

FastEthernet1/0 192.168.1.1/24 YES UP

FastEthernet1/1 192.168.2.1/24 YES UP

Null 0 no address YES UP

3.Router 2基本配置

Red-Giant>enable

Red-Giant#configure terminal

Red-Giant(config)#hostname Router2

Router2(config)# interface fastEthernet1/0

Router2(config-if)#ip add 192.168.4.1 255.255.255.0

Router2(config-if)#no shutdown

Router2(config-if)#exit

Router2(config)#interface serial 1/2

Router2(config-if)#ip add 192.168.3.2 255.255.255.0

Router2(config-if)#no shutdown

Router2(config-if)#end

4.测试接口状态

Router2#show ip int brief

!观察接口状态

Interface IP-Address(Pri)OK?Status

serial 1/2 192.168.3.2/24 YES UP

serial 1/3 no address YES DOWN

FastEthernet1/0 192.168.4.1/24 YES UP

FastEthernet1/1 no address YES DOWN

Null 0 no address YES UP

5.配置静态路由

Router1(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2

Router2(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1

Router2(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1

6.测试路由信息(www.chuimin.cn)

Router1#show ip route

!查看路由表信息

Codes:C-connected,S-static,R-RIP

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

*-candidate default

Gateway of last resort is no set

C 192.168.1.0/24 is directly connected,FastEthernet1/0

C 192.168.1.1/32 is local host.

C 192.168.2.0/24 is directly connected,FastEthernet1/1

C 192.168.2.1/32 is local host.

C 192.168.3.0/24 is directly connected,serial 1/2

C 192.168.3.1/32 is local host.

S 192.168.4.0/24 is directly connected,serial 1/2

Router2#show ip route

Codes:C-connected,S-static,R-RIP

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

*-candidate default

Gateway of last resort is no set

S 192.168.1.0/24 is directly connected,serial 1/2

S 192.168.2.0/24 is directly connected,serial 1/2

C 192.168.3.0/24 is directly connected,serial 1/2

C 192.168.3.2/32 is local host.

C 192.168.4.0/24 is directly connected,FastEthernet1/0

C 192.168.4.1/32 is local host.

7.配置标准IP访问控制列表

Router2(config)#access-list1 deny 192.168.2.0 0.0.0.255

!拒绝来自192.168.2.0网段的流量通过

Router2(config)#access-list1 permit 192.168.1.0 0.0.0.255

!允许来自192.168.1.0网段的流量通过

8.验证ACL配置信息

Router2#show access-lists 1

Standard IP access list1 includes 2 items:

deny 192.168.2.0,wildcard bits 0.0.0.255

permit192.168.1.0,wildcard bits 0.0.0.255

9.在接口下应用访问控制列表

Router2(config)# interface fastEthernet1/0

Router2(config-if)#ip access-group 1 out

!在接口下访问控制列表出栈流量调用

10.查看访问列表在接口上的应用

Router2#show ip interface fastEthernet1/0

FastEthernet1/0

IP interface state is:UP

IP interface type is:BROADCAST

IP interface MTU is:1500

IP address is:

192.168.4.1/24(primary)

IP address negotiate is:OFF

Forward direct-boardcast is:ON

ICMPmask reply is:ON

Send ICMP redirect is:ON

Send ICMP unreachabled is:ON

DHCP relay is:OFF

Fast switch is:ON

Route horizontal-split is:ON

Help address is:0.0.0.0

Proxy ARP is:ON

Outgoing access list is 1.

Inbound access list is not set.

验证测试

ping 192.168.2.0网段的主机,不能ping通172.16.4.0网段的主机;172.16.1.0网段的主机能ping通192.168.4.0网段的主机。

知识拓展

通配符掩码

通配符掩码是一个32位的数字串,它被用点号分成4个8位组,每组包含8位。在通配符掩码中,0表示“检查相应的位”,1表示“不检查相应的位”。通配符掩码与IP地址是成对出现的,但通配符掩码和子网掩码工作原理不同。在子网掩码中,数字1和0用来决定是网络、子网,还是相应主机的IP地址。如172.16.0.0这个网段,使用的通配符掩码应为0.0.255.255。

在ACL的判别条件中,使用一个IP地址与通配符来指定匹配的范围。通配符中为“0”的位,代表被检测的数据包中的地址位必须与前面的IP地址相应位一致,才被认为满足了匹配条件。而通配符中为“1”的位,代表被检测的数据包中的地址位无论是否与前面的IP地址相应位一致,都认为满足了匹配条件。如果想指定匹配所有地址,可使用IP地址与通配符为0.0.0.0 255.255.255.255,其中IP地址0.0.0.0代表所有网络地址,而通配符255.255.255.255代表不管数据包中的IP地址是什么都满足匹配条件,所以0.0.0.0 255.255.255.255意为接受所有地址并且可简写为any。如果要对特定主机进行匹配,则需要匹配IP地址中所有位,所以通配符为0.0.0.0,代表必须匹配 所 有 位 才 满 足 匹 配 条 件。例 如172.30.16.29 0.0.0.0,可 表 示 为host172.30.16.29。