动态ACL(1)

 

 

 

 

 

(1)实验目标
          通过在R1的f0/0端口配置动态ACL,实现让C1能够临时的访问2.2.2.1/24(换句话说是让
          R1能够临时围C1开通去往2.2.2.1/24的一条路)
          说明:图中的C1我和真机的loopback口连接了起来,方便于测试!!!!

(2)实验内容

  • R1上端口的基本配置

          R1#show ip interface brief
               Interface                  IP-Address      OK? Method Status                Prot
               FastEthernet0/0            1.1.1.2         YES manual up                    up
               e1/0                             2.2.2.1                  YES manual up                    up

  • R1上配置两个 用于测试的用户
    R1#show running-config | section username
    username cisco password 0 cisco
    username test password 0 test
  • 开启用于telnet时的line链路
    R1(config)#line vty 0 4
    R1(config-line)#login local  //开启本地认证功能,当上面两个用户远程telnet的时候。
    R1(config)#username cisco autocommand access-enable host time 10//将用户“Cisco”和动态ACL绑定,方便动态ACL临时为用户cisco授权。
  • R1上配置动态ACL
    R1#show access-lists 100
    Extended IP access list 100
        10 permit tcp host 1.1.1.1 host 1.1.1.2 eq teln
        20 Dynamic mxm permit ip any host 2.2.2.1
    R1(config)#interface f0/0
    R1(config-if)#ip access-group 100 in //将此ACL应用在f0/0的入口方向
  • 测试
    (a)   没加访问控制列表之前,C1访问2.2.2.1的现象,很明显是可以ping通的
    C:\Users\Administrator>ping 2.2.2.1
    正在 Ping 2.2.2.1 具有 32 字节的数据:
    来自 2.2.2.1 的回复: 字节=32 时间=431ms TTL=235
    来自 2.2.2.1 的回复: 字节=32 时间=430ms TTL=235
    来自 2.2.2.1 的回复: 字节=32 时间=430ms TTL=235
    来自 2.2.2.1 的回复: 字节=32 时间=436ms TTL=235
    (b)    C1没有telnet R1之前,动态ACL show之后的结果是
    Extended IP access list 100
        10 permit tcp host 1.1.1.1 host 1.1.1.2 eq tel
        20 Dynamic mxm permit ip any host 2.2.2.1
    (c)  用C1去telnet  1.1.1.2
    User Access Verification
    Username: cisco
    Password:
    遗失对主机的连接
    (d)  此时再show 动态ACL,发现
    Extended IP access list 100
        10 permit tcp host 1.1.1.1 host 1.1.1.2 eq telnet (60 matches)
        20 Dynamic mxm permit ip any host 2.2.2.1
          permit ip host 1.1.1.1 host 2.2.2.1
    跟telnet 之前比较的话,多了一条语句“ permit ip host 1.1.1.1 host 2.2.2.1”,这就是R1临时为C1的授权,好了有了这个权限,我们再去ping 2.2.2.1,发现
    C:\>ping 2.2.2.1
    正在 Ping 2.2.2.1 具有 32 字节的数据:
    来自 2.2.2.1 的回复: 字节=32 时间=435ms TTL=235
    来自 2.2.2.1 的回复: 字节=32 时间=431ms TTL=235
    来自 2.2.2.1 的回复: 字节=32 时间=430ms TTL=235
    来自 2.2.2.1 的回复: 字节=32 时间=430ms TTL=235
  • 但我们之前在创建用户时候,多的那个“test”用户是干嘛的呢?
    因为我们授权给了cisco用户,所以如果C1是网络管理员,那么这个时候他不能够对R1进行网管,但是如果我们telnet的时候用没有绑定的test用户的话,我们发现
    User Access Verification
    Username: test
    Password:
    R1>
    这时,我们既能够ping通2.2.2.1,也能够网管R1路由器。
  • 如果你想将"permit ip host 1.1.1.1 host 2.2.2.1"这个临时授权在绝对超时时间到来之前提前拿掉的话,可以使用命令:R1#clear access-template 100 mxm host 1.1.1.1 host 2.2.2.1
    ***********************************************************************
     
  • 实验结束!!!!!!!!!!


       

          

 

你可能感兴趣的:(动态ACL)