zoukankan      html  css  js  c++  java
  • CCNA-ACL

    ACL Access Control list

    Why Use ACLs?     
    1.Filtering:Manage IP traffic by filtering packets passing throuth a router 通过过滤通过路由器的数据包来管理IP流量
    策略需要对网络的流量进行过滤,可以选择让一些流量是丢弃或着通过路由器
    2.Classification:Identify traffic for special handing 识别特殊的流量
    把不同部门、不同级别、不同应用进行分类

    过滤单独使用,可以当成一个基础简单的防火墙
    分类是和别的协议或程序配合使用。别的程序需要分类,则调用ACLs的

    ACL Applications:

    Filtering
    1.Permit or deny packets moving through the router
    2.Permit or deny vty access to or from the router
    3.Without ACLs, all packets could be transmitted to all parts of your network.
    当过滤使用,可以看成是一个基础的防火墙/包过滤防火墙
    [防火墙:包过滤防火墙、内容/应用防火墙(可以检查到第七层,当你访问某些网站的时候,流量中存在某些关键字的时候,过滤)等]
    对于ACL 来说,可以到达OSI的第四层TCP/UDP/协议的端口号的过滤,操作只有 允许/通过和拒绝/丢弃
    当ACL 当做过滤器使用的时候,必须要挂载在某一个接口上。并且有两个方向(入/出),原则:一个接口上最多可以挂两个 ACL,一个方向一个ACL,在一个ACL上,可以有很多ACL规则条目


    A List of Tests:Deny of Permit
    在一个ACL 上可以绑定多个判定条件或者可以称为多个ACL 条目
    当一个数据包从这个ACL 经过的时候,必要要跟上面的ACL条目,逐一的去匹配,看是否满足这个条目,每个条目后面都跟着一个动作(permit/deny),只要匹配上一个,就立即执行,后续就不再匹配。所有条目都不匹配,默认是丢弃(永远在所有条目后都加一条拒绝所有)。

    ACL Applications:

    Classification
    Special handing for traffic based on packet tests
    通常为其他协议、应用提供分类服务的。

    Type of ACLs

    1.Standard ACL(标准ACL,判定较少,速度快,IPv4 number range 1~99,1300~1999)
    ①Checks source address 检查源IP
    ②Generally permits or denies entire protocol suite 通常允许或拒绝整个协议
    2.Extended ACL(扩展ACL,判定多,速度慢, IPv4 number range 100~199, 2000~2699)
    ①Checks source and destination address 检查源IP和目标IP
    ②Generally permits or denies specific protocols and applications可以允许或拒绝特殊的协议和应用

    3.Two methods used to identify standard and extended ACLs: 两种方式标识标准ACL和扩展ACL
    ①Numbered ACLs use a number for identification 使用数字进行标识
    ②Named ACLs use a descriptive name or number for identification 使用描述名字或者数字进行标识
    4.反码:和子网掩码相反,0表示要匹配,1标识无所谓
    如:xxx.xxx.xxx.xxx 0.0.0.0 表示精确匹配xxx.xxx.xxx.xxx ,也可简写成host xxx.xxx.xxx.xxx
           0.0.0.0 255.255.255.255 表示匹配任意 ,也可以简写成any
           xxx.xxx.xxx.xxx 0.0.0.255 表实匹配前24位
    特殊的例子:172.30.16.0 0.0.15.255
    将15分为二进制,为00001111,则第三位的16匹配前四个即为0001(16的为00010000)
    则低于16的(前四位为0000)都不匹配,高于32(包括32)(前四位001...)的就不匹配

    Numbered Standard IPv4 ACL Configuration
    1.配置ACL 条目

    Router(config) # access-list access-list-number {permit | deny | remark} source [mask]

    ①Uses 1 to 99 for the access-list-number
    ②The first entry is assigned a sequence number of 10, and successsive entries are incremented by 10.
    ③Default wildcard mask is 0.0.0.0(only standard ACL)
    ④removes the entire ACL.

    Router(config) #no access-list access-list-number

    ⑤remark lets you add a description to the ACL.
    2.在端口上启用ACL

    Router(config-if) #ip access-group access-list-number { in | out }

    ①Activates the list on an interface.
    ②Sets inbound or outbound testing.
    ③removes the ACL from the interface.

    Router(config) #no ip access-group access-list-number {in | out}

    Testing Packets with Numbered Extended IPv4 ACLs

    1.Sets parmeters for this list entry

    Router(config) #access-list access-list-number {permit | deny} protocol source source-wildcard [operator port] destination desination-wildcard [operator port] [established] [log]

    Uses 100 to 199 for the access-list-number
    例子1:拒绝所有从1.1.1.1 到2.2.2.2 的ping 包

    Router(config) #access-list 100 deny icmp host 1.1.1.1 host 2.2.2.2

    例子2:拒绝所有1.1.1.0/24 到2.2.2.0/24 的http(tcp,80)流量

    Router(config) #access-list 100 deny tcp 1.1.1.0 0.0.255 2.2.2.0 0.0.0.255 eq 80

    2.Activates the extended list on an interface
    Router(config-if) #ip access-group access-list-number {in | out}
    注意:
    1.编号的访问控制列表没法单独删除其中的一个条目,如果要删除则会删除整个表。所以一般现在记事本上把所有条目写好,再复制到命令行中。
    2.ACL 的顺序很重要,如下面的列子:

    Router(config) #access-list 1 deny 1.1.1.0 0.0.0.255
    Router(config) #access-list 1 permit 1.1.1.1 0.0.0.0

    按照上面的例子,第二个条目永远不会生效。需要调换一下位置,才能达到想要的结果。

    Named IP ACL Configuration
    1.Alphanumeric字母数字 name string must be unique

    Router(config) #ip access-list {standard | extened} name

    2.If not configured, sequence numbers are generated automatically starting at 10 and incrementing by 10
    3.no sequence number removes the specific test from the named ACL

    Router(config- {std |ext}-nacl) # [sequence-number] {permit | deny} {ip access list test conditions} {permit | deny} {ip access list test confitions}

    4.remove ACL rule

    Router(config-{std|ext}-nacl) #no {deny | permit} {ip access list test conditions}

    5.Creates a named ACL comment

    Router(config-{std|ext}-nacl) # remark remark-infomation

    OR

    Router(config) # access-list access-list-number remark remark-infomation

    6.Activates the named IP ACL on an interface

    Router(config-if) #ip access-group name {in | out}

    7.Monitoring ACL statements

    Router #show access-lists {access-lis t number| name}

    8.Displays all ACLs

    Router # show access-lists

    9.通过查看端口信息可以看到是否挂载有ACL information

    Router #show ip interface fastetherent0
    ...
    Outgoing access list is not set
    Inbound access list is 1
    ...

    关于acl sequence number问题
    本节课,老师没有说任何ACL条目的序列号问题,在网上搜了一下,说是从10开始,并且按10渐增的。默认第一条ACL 条目的序列号10,第二条是20,依此类推。按照网上的说法,可以跟据指定序列号,选择性插入到ACL条目的某个位置,并且,在删除条目的话,如果指定序号,则删除该条目,不指定,则删除整个ACL。这点和老师将的不太一样,老师说的是只有命名ACL表才能删除指定一条的条目。有知道的大佬可以在下面留言指教,先提前拜谢!

    ACL 实验部分配置
    1.标准访问控制列表应当放到尽量靠近目标的地方,因为偶标准的访问控制列表只能基于源IP进行过滤。为了防止源目标到其他网络的流量被限制
    2.扩展访问控制列表应当放到尽量靠近源的地方
    在路由器上开启telnet,telnet 端口占用是23,ftp端口是21和22:
    ①配置模式下创建

    Router(config) #line vty 0 871

    ②设置密码

    Router(config-line) #password xxxx

    ③开启登录

    Router(config-line) #login

    3.通过telnet 连接其他路由器

    Router #telnet ip

    在生产环境一般都是配置扩展访问列表,更精细

  • 相关阅读:
    Python爬虫_分布式爬虫
    Python爬虫_selenium
    Python爬虫_scrapy框架
    Python爬虫_高性能爬取
    Python爬虫_三种数据解析方式
    Python爬虫_requests模块
    Django
    Python爬虫相关基础概念
    MySQL 多表结构的创建与分析
    mysql
  • 原文地址:https://www.cnblogs.com/yungiu/p/12809889.html
Copyright © 2011-2022 走看看