ACL  Telent 实验报告
1.实验拓扑
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

1.2 完成标准

(1) 按照拓扑图要求连接路由器,在R1  R2R3 间配置相应的接口 IP地址,在R1 R3 配置默认路由.
(2) 检查路由表,所有路由器间都能通信。
(3)设置ACL

1.R1 可以ping  r3,R3不可以ping  R1

2. R1 可以 telent R3  R3不可以 telent R1
 
1.3详细实验步骤:
Step 1

路由器 R1 配置如下:

router(config)#ho r1

r1(config)#int e0/0
r1(config-if)#ip add <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />10.0.0.1 255.0.0.0
r1(config-if)#no shut
r1(config-if)#end
//配置默认路由 下一跳 10.0.0.2
r1(config)#ip route 0.0.0.0 0.0.0.0 10.0.0.2

路由器 R2 配置如下:

router(config)#ho r2
r2(config)#int e0/0
r2(config-if)#ip add 10.0.0.2 255.0.0.0
r2(config-if)#no shut

 

r2(config-if)#int e0/1
r2(config-if)#ip add 20.0.0.1 255.0.0.0
r2(config-if)#no shut
r2(config-if)#exit
r2(config)#
路由器 R3 配置如下:
router(config)#ho r3
r3(config)#int e0/0
r3(config-if)#ip add 20.0.0.2 255.0.0.0
r3(config-if)#no shut
r3(config-if)#exit
// 配置默认路由 下一跳 20.0.0.1
r3(config)#ip route 0.0.0.0 0.0.0.0 20.0.0.1

 
验证:

r1#ping 10.0.0.2

 

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/89/152 ms
 
r1#ping 20.0.0.2

 

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 20.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 88/144/220 ms

 

r3#ping 10.0.0.1

 

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 48/132/192 ms
setp 2 设置Telent
路由器 R1 配置如下:

r1(config)#line vty 0 4
r1(config-line)#password bent
r1(config-line)#login
r1(config-line)#exit
路由器 R3 配置如下:

r3(config)#line vty 0 4
r3(config-line)#password cisco
r3(config-line)#login
r3(config-line)#end
r3#
验证
 
r1#20.0.0.2
Trying 20.0.0.2 ... Open

 

 

User Access Verification

 

Password:
 
r3#show users
    Line       User       Host(s)              Idle       Location
*  0 con 0                idle                 00:00:00
 130 vty 0                idle                 00:00:32 10.0.0.1

 

  Interface    User               Mode         Idle     Peer Addrd
r3#10.0.0.1
Trying 10.0.0.1 ... Open

 

User Access Verification
 

 

Password:
 
r1#show users
    Line       User       Host(s)              Idle       Location
*  0 con 0                idle                 00:00:00
 130 vty 0                idle                 00:09:55 20.0.0.2

 

  Interface    User               Mode         Idle     Peer Address

 

r1#clear line 130
[confirm]
 [OK]
Step 3: 配置ACL

(1)     配置 R1 e0/0 接口 IN 方向的 ACL

 

r1#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

r1(config)#ip access-list extended benet                          // 扩展访问控制列表命名为 benet

r1(config-ext-nacl)#deny icmp host 20.0.0.2 host 10.0.0.1 echo

// 拒绝从 20.0.0 .2 主机到 10.0.0.1 主机的 icmp 协议数据包消息

r1(config-ext-nacl)#per

r1(config-ext-nacl)#permit ip any any   // 允许其余所有 ip 地址数据包转发

r1(config-ext-nacl)#exit

r1(config)#int e0/0

r1(config-if)#ip access-group benet in                             // 将命名为 benet 的扩展访问控制列表应用到接口 e0/0 in 方向

r1(config-if)#end

 

r1#show access-list  // 显示访问列表

Extended IP access list benet

    10 deny icmp host 20.0.0.2 host 10.0.0.1 echo

20 permit ip any any

(2)     检查网络连通性

 

r1#ping 20.0.0.2

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 20.0.0.2, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 88/154/264 ms

//r1 仍然正常 ping r3

 

r3#ping 10.0.0.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds:

U.U.U //r3 无法正常 ping r1 ,显示 U 即为 ACL 生效

Success rate is 0 percent (0/5)

r1#

 

r1#conf t

r1(config)#access-list 102 deny tcp host 20.0.0.2 host 10.0.0.1 eq 23

// 拒绝从20.0.0.2主机到10.0.0.1主机的telent 登陆上

r1(config)#access-list 102 permit ip any any  // 允许其余所有 ip 地址数据包转发

r1(config)#int e0/0

r1(config-if)#ip access-group 102 in

r1(config-if)#end

r1#  // 显示访问列表

*Mar  1 01:07:30.683: %SYS-5-CONFIG_I: Configured from console by console

r1#show access-list

Extended IP access list 102

    10 deny tcp host 20.0.0.2 host 10.0.0.1 eq telnet (78 matches)

    20 permit ip any any

Extended IP access list benet

    10 deny icmp host 20.0.0.2 host 10.0.0.1 echo (11 matches)

    20 permit ip any any (69 matches)

3. 检查 telnet

 

r1#telnet 20.0.0.2

Trying 20.0.0.2 ... Open

 

 

User Access Verification

password:

r3>enable

Password:

 

r3#

r3#

r3#

[Connection to 20.0.0.2 closed by foreign host]

r3#show users

    Line       User       Host(s)              Idle       Location

*  0 con 0                idle                 00:00:00

 130 vty 0                idle                 00:00:32 10.0.0.1

 

  Interface    User               Mode         Idle     Peer Address

//r1 仍然正常 telent r3

 

r3#tel 10.0.0.1

Trying 10.0.0.1 ...

% Destination unreachable; gateway or host down

 

r3#tel 10.0.0.1

Trying 10.0.0.1 ...

% Destination unreachable; gateway or host down

//r3 无法正常 telent r1 ,显示 % Destination unreachable; gateway or host down

即为 ACL 生效

r1#

 

r1#show users

    Line       User       Host(s)              Idle       Location

*  0 con 0                idle                 00:00:00

 

  Interface    User               Mode         Idle     Peer Address

3.实验总结

     访问控制列表(Access Control List, ACL)基本原理是:使用包过滤技术,在路由器上读取OSI 7层模型的第3层及第4层包头中的信息,根据预先定义好的规则,对包进行过滤,从而达到访问控制的目的。其基本知识点有:

 ACL

两种基本类型:标准访问控制列表(Standard)和扩展访问列表(Extended

AC   ACL的主要用途归纳为:提供网络访问的基本安全手段;可用于QoSQuality of Server,服务质量)对数据流量进行控制;提供对通信流量的控制手段。

ACL是一组判断语句的集合,对入站接口进入和出站接口离开路由器的数据包进行检测并控制

标准访问控制列表根据数据包的源IP地址来允许或拒绝数据包,列表号范围1~99

扩展访问控制列表通过启用基于源和目的地址、传输层协议和应用端口号的过滤来提供更高程度的控制。利用这些特性,可基于网络的应用类型来限制数据流。列表号范围101~199