Files
NE_YuR/8_acl/acl.html
2025-10-23 16:59:51 +08:00

123 lines
22 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html><head>
<title>acl</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="file:///c:\Users\63579\.vscode\extensions\shd101wyy.markdown-preview-enhanced-0.8.15\crossnote\dependencies\katex\katex.min.css">
<style>
code[class*=language-],pre[class*=language-]{color:#333;background:0 0;font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.4;-moz-tab-size:8;-o-tab-size:8;tab-size:8;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:.8em;overflow:auto;border-radius:3px;background:#f5f5f5}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal;background:#f5f5f5}.token.blockquote,.token.comment{color:#969896}.token.cdata{color:#183691}.token.doctype,.token.macro.property,.token.punctuation,.token.variable{color:#333}.token.builtin,.token.important,.token.keyword,.token.operator,.token.rule{color:#a71d5d}.token.attr-value,.token.regex,.token.string,.token.url{color:#183691}.token.atrule,.token.boolean,.token.code,.token.command,.token.constant,.token.entity,.token.number,.token.property,.token.symbol{color:#0086b3}.token.prolog,.token.selector,.token.tag{color:#63a35c}.token.attr-name,.token.class,.token.class-name,.token.function,.token.id,.token.namespace,.token.pseudo-class,.token.pseudo-element,.token.url-reference .token.variable{color:#795da3}.token.entity{cursor:help}.token.title,.token.title .token.punctuation{font-weight:700;color:#1d3e81}.token.list{color:#ed6a43}.token.inserted{background-color:#eaffea;color:#55a532}.token.deleted{background-color:#ffecec;color:#bd2c00}.token.bold{font-weight:700}.token.italic{font-style:italic}.language-json .token.property{color:#183691}.language-markup .token.tag .token.punctuation{color:#333}.language-css .token.function,code.language-css{color:#0086b3}.language-yaml .token.atrule{color:#63a35c}code.language-yaml{color:#183691}.language-ruby .token.function{color:#333}.language-markdown .token.url{color:#795da3}.language-makefile .token.symbol{color:#795da3}.language-makefile .token.variable{color:#183691}.language-makefile .token.builtin{color:#0086b3}.language-bash .token.keyword{color:#0086b3}pre[data-line]{position:relative;padding:1em 0 1em 3em}pre[data-line] .line-highlight-wrapper{position:absolute;top:0;left:0;background-color:transparent;display:block;width:100%}pre[data-line] .line-highlight{position:absolute;left:0;right:0;padding:inherit 0;margin-top:1em;background:hsla(24,20%,50%,.08);background:linear-gradient(to right,hsla(24,20%,50%,.1) 70%,hsla(24,20%,50%,0));pointer-events:none;line-height:inherit;white-space:pre}pre[data-line] .line-highlight:before,pre[data-line] .line-highlight[data-end]:after{content:attr(data-start);position:absolute;top:.4em;left:.6em;min-width:1em;padding:0 .5em;background-color:hsla(24,20%,50%,.4);color:#f4f1ef;font:bold 65%/1.5 sans-serif;text-align:center;vertical-align:.3em;border-radius:999px;text-shadow:none;box-shadow:0 1px #fff}pre[data-line] .line-highlight[data-end]:after{content:attr(data-end);top:auto;bottom:.4em}html body{font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif;font-size:16px;line-height:1.6;color:#333;background-color:#fff;overflow:initial;box-sizing:border-box;word-wrap:break-word}html body>:first-child{margin-top:0}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{line-height:1.2;margin-top:1em;margin-bottom:16px;color:#000}html body h1{font-size:2.25em;font-weight:300;padding-bottom:.3em}html body h2{font-size:1.75em;font-weight:400;padding-bottom:.3em}html body h3{font-size:1.5em;font-weight:500}html body h4{font-size:1.25em;font-weight:600}html body h5{font-size:1.1em;font-weight:600}html body h6{font-size:1em;font-weight:600}html body h1,html body h2,html body h3,html body h4,html body h5{font-weight:600}html body h5{font-size:1em}html body h6{color:#5c5c5c}html body strong{color:#000}html body del{color:#5c5c5c}html body a:not([href]){color:inherit;text-decoration:none}html body a{color:#08c;text-decoration:none}html body a:hover{color:#00a3f5;text-decoration:none}html body img{max-width:100%}html body>p{margin-top:0;margin-bottom:16px;word-wrap:break-word}html body>ol,html body>ul{margin-bottom:16px}html body ol,html body ul{padding-left:2em}html body ol.no-list,html body ul.no-list{padding:0;list-style-type:none}html body ol ol,html body ol ul,html body ul ol,html body ul ul{margin-top:0;margin-bottom:0}html body li{margin-bottom:0}html body li.task-list-item{list-style:none}html body li>p{margin-top:0;margin-bottom:0}html body .task-list-item-checkbox{margin:0 .2em .25em -1.8em;vertical-align:middle}html body .task-list-item-checkbox:hover{cursor:pointer}html body blockquote{margin:16px 0;font-size:inherit;padding:0 15px;color:#5c5c5c;background-color:#f0f0f0;border-left:4px solid #d6d6d6}html body blockquote>:first-child{margin-top:0}html body blockquote>:last-child{margin-bottom:0}html body hr{height:4px;margin:32px 0;background-color:#d6d6d6;border:0 none}html body table{margin:10px 0 15px 0;border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}html body table th{font-weight:700;color:#000}html body table td,html body table th{border:1px solid #d6d6d6;padding:6px 13px}html body dl{padding:0}html body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:700}html body dl dd{padding:0 16px;margin-bottom:16px}html body code{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:.85em;color:#000;background-color:#f0f0f0;border-radius:3px;padding:.2em 0}html body code::after,html body code::before{letter-spacing:-.2em;content:'\00a0'}html body pre>code{padding:0;margin:0;word-break:normal;white-space:pre;background:0 0;border:0}html body .highlight{margin-bottom:16px}html body .highlight pre,html body pre{padding:1em;overflow:auto;line-height:1.45;border:#d6d6d6;border-radius:3px}html body .highlight pre{margin-bottom:0;word-break:normal}html body pre code,html body pre tt{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}html body pre code:after,html body pre code:before,html body pre tt:after,html body pre tt:before{content:normal}html body blockquote,html body dl,html body ol,html body p,html body pre,html body ul{margin-top:0;margin-bottom:16px}html body kbd{color:#000;border:1px solid #d6d6d6;border-bottom:2px solid #c7c7c7;padding:2px 4px;background-color:#f0f0f0;border-radius:3px}@media print{html body{background-color:#fff}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{color:#000;page-break-after:avoid}html body blockquote{color:#5c5c5c}html body pre{page-break-inside:avoid}html body table{display:table}html body img{display:block;max-width:100%;max-height:100%}html body code,html body pre{word-wrap:break-word;white-space:pre}}.markdown-preview{width:100%;height:100%;box-sizing:border-box}.markdown-preview ul{list-style:disc}.markdown-preview ul ul{list-style:circle}.markdown-preview ul ul ul{list-style:square}.markdown-preview ol{list-style:decimal}.markdown-preview ol ol,.markdown-preview ul ol{list-style-type:lower-roman}.markdown-preview ol ol ol,.markdown-preview ol ul ol,.markdown-preview ul ol ol,.markdown-preview ul ul ol{list-style-type:lower-alpha}.markdown-preview .newpage,.markdown-preview .pagebreak{page-break-before:always}.markdown-preview pre.line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}.markdown-preview pre.line-numbers>code{position:relative}.markdown-preview pre.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:1em;font-size:100%;left:0;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-preview pre.line-numbers .line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}.markdown-preview pre.line-numbers .line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}.markdown-preview .mathjax-exps .MathJax_Display{text-align:center!important}.markdown-preview:not([data-for=preview]) .code-chunk .code-chunk-btn-group{display:none}.markdown-preview:not([data-for=preview]) .code-chunk .status{display:none}.markdown-preview:not([data-for=preview]) .code-chunk .output-div{margin-bottom:16px}.markdown-preview .md-toc{padding:0}.markdown-preview .md-toc .md-toc-link-wrapper .md-toc-link{display:inline;padding:.25rem 0}.markdown-preview .md-toc .md-toc-link-wrapper .md-toc-link div,.markdown-preview .md-toc .md-toc-link-wrapper .md-toc-link p{display:inline}.markdown-preview .md-toc .md-toc-link-wrapper.highlighted .md-toc-link{font-weight:800}.scrollbar-style::-webkit-scrollbar{width:8px}.scrollbar-style::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}.scrollbar-style::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,.66);border:4px solid rgba(150,150,150,.66);background-clip:content-box}html body[for=html-export]:not([data-presentation-mode]){position:relative;width:100%;height:100%;top:0;left:0;margin:0;padding:0;overflow:auto}html body[for=html-export]:not([data-presentation-mode]) .markdown-preview{position:relative;top:0;min-height:100vh}@media screen and (min-width:914px){html body[for=html-export]:not([data-presentation-mode]) .markdown-preview{padding:2em calc(50% - 457px + 2em)}}@media screen and (max-width:914px){html body[for=html-export]:not([data-presentation-mode]) .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for=html-export]:not([data-presentation-mode]) .markdown-preview{font-size:14px!important;padding:1em}}@media print{html body[for=html-export]:not([data-presentation-mode]) #sidebar-toc-btn{display:none}}html body[for=html-export]:not([data-presentation-mode]) #sidebar-toc-btn{position:fixed;bottom:8px;left:8px;font-size:28px;cursor:pointer;color:inherit;z-index:99;width:32px;text-align:center;opacity:.4}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] #sidebar-toc-btn{opacity:1}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc{position:fixed;top:0;left:0;width:300px;height:100%;padding:32px 0 48px 0;font-size:14px;box-shadow:0 0 4px rgba(150,150,150,.33);box-sizing:border-box;overflow:auto;background-color:inherit}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar{width:8px}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,.66);border:4px solid rgba(150,150,150,.66);background-clip:content-box}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc a{text-decoration:none}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc .md-toc{padding:0 16px}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc .md-toc .md-toc-link-wrapper .md-toc-link{display:inline;padding:.25rem 0}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc .md-toc .md-toc-link-wrapper .md-toc-link div,html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc .md-toc .md-toc-link-wrapper .md-toc-link p{display:inline}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc .md-toc .md-toc-link-wrapper.highlighted .md-toc-link{font-weight:800}html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{left:300px;width:calc(100% - 300px);padding:2em calc(50% - 457px - 300px / 2);margin:0;box-sizing:border-box}@media screen and (max-width:1274px){html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for=html-export]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{width:100%}}html body[for=html-export]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .markdown-preview{left:50%;transform:translateX(-50%)}html body[for=html-export]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .md-sidebar-toc{display:none}
/* Please visit the URL below for more information: */
/* https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */
/* Please visit the URL below for more information: */
/* https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */
.markdown-preview.markdown-preview.prince {
/*
* Markdown PDF CSS
*/
font-family: "Times New Roman", "Microsoft YaHei", "KaiTi", Georgia, Serif;
}
</style>
<!-- The content below will be included at the end of the <head> element. --><script type="text/javascript">
document.addEventListener("DOMContentLoaded", function () {
// your code here
});
</script></head><body for="html-export">
<div class="crossnote markdown-preview ">
<h1 id="什么是acl如何使用acl---华为">什么是ACL如何使用ACL? - 华为 </h1>
<h2 id="什么是acl">什么是ACL </h2>
<p>访问控制列表ACLAccess Control List是由一条或多条规则组成的集合。所谓规则是指描述报文匹配条件的判断语句这些条件可以是报文的源地址、目的地址、端口号等。<br>
ACL本质上是一种报文过滤器规则是过滤器的滤芯。设备基于这些规则进行报文匹配可以过滤出特定的报文并根据应用ACL的业务模块的处理策略来允许或阻止该报文通过。</p>
<h2 id="为什么使用acl">为什么使用ACL </h2>
<p>ACL作为一个过滤器设备通过应用ACL来阻止和允许特定流量的流入和流出如果没有它任何流量都会自由流入和流出使得网络容易受到攻击。<br>
如下图所示为保证财务数据安全企业在路由设备上应用ACL可以阻止内网内部研发部门主机对财务服务器的访问同时允许总裁办公室访问财务服务器。为了保护企业内网的安全在路由设备上应用ACL可以封堵网络病毒常用的端口防止Internet上的恶意流量入侵。<br>
<img src="https://download.huawei.com/mdl/image/download?uuid=ed136e6e7b1a4fc19114768646780078" alt="img"></p>
<p>ACL可以做什么</p>
<p>借助ACL可以实现以下功能</p>
<ul>
<li>提供安全访问企业重要服务器资源被随意访问企业机密信息容易泄露造成安全隐患。使用ACL可以指定用户访问特定的服务器、网络与服务从而避免随意访问的情况。</li>
<li>防止网络攻击Internet病毒肆意侵略企业内网内网环境的安全性堪忧。使用ACL可以封堵高危端口从而达成为外网流量的阻塞。</li>
<li>提高网络带宽利用率网络带宽被各类业务随意挤占服务质量要求最高的语音、视频业务的带宽得不到保障造成用户体验差。使用ACL实现对网络流量的精确识别和控制限制部分网络流量从而保障主要业务的质量。</li>
</ul>
<h2 id="acl的组成">ACL的组成 </h2>
<p>ACL的每一条规则都会允许或者阻止特定的流量在定义一条合理的ACL规则之前需要了解其基本组成。</p>
<ul>
<li><strong>ACL标识</strong>使用数字或者名称来标识ACL。
<ul>
<li>使用数字标识ACL不同的类型的ACL使用不同的数字进行标识。关于每类ACL编号的详细介绍请参见 ACL的分类。</li>
<li>使用名称标识ACL可以使用字符来标识ACL就像用域名代替IP地址一样更加方便记忆。</li>
</ul>
</li>
<li><strong>规则</strong>:即描述匹配条件的判断语句。
<ul>
<li><strong>规则编号</strong>用于标识ACL规则所有规则均按照规则编号从小到大进行排序。</li>
<li><strong>动作</strong>包括permit/deny两种动作表示设备对所匹配的数据包接受或者丢弃。</li>
<li><strong>匹配项</strong>ACL定义了极其丰富的匹配项。包括生效时间段、IP协议 ICMP、TCP、UDP等、源/目的地址以及相应的端口号21、23、80等</li>
</ul>
</li>
</ul>
<h2 id="acl的分类">ACL的分类 </h2>
<p>随着ACL技术的发展其种类越来越丰富根据其不同的规则和使用场景常用的可分为以下几类</p>
<h3 id="基本acl">基本ACL </h3>
<p>基本ACL规则只包含源IP地址对设备的CPU消耗较少可用于简单的部署但是使用场景有限不能提供强大的安全保障。</p>
<h3 id="高级acl">高级ACL </h3>
<p>相较于基本ACL高级ACL提供更高的扩展性可以对流量进行更精细的匹配。通过配置高级ACL可以阻止特定主机或者整个网段的源或者目标。除此之外还可以使用协议信息IP、 ICMP、TCP、UDP去过滤相应的流量。</p>
<h3 id="二层acl">二层ACL </h3>
<p>在公司的内部网络中想对特定的终端进行访问权限控制这时就需要二层ACL。使用二层ACL可以根据源MAC地址、目的MAC地址、802.1p优先级、二层协议类型等二层信息对流量进行管控。</p>
<h3 id="用户acl">用户ACL </h3>
<p>由于企业内部同部门的工作人员的终端不在同一个网段难以管理需要将其纳入一个用户组并对其用户组进行访问权限管理这时候就需要用户ACL。用户ACL在高级ACL的基础上增加了用户组的配置项可以实现对不同用户组的流量管控。</p>
<h2 id="如何使用acl">如何使用ACL </h2>
<h3 id="使用步骤">使用步骤 </h3>
<p>ACL的使用分为两个步骤</p>
<ol>
<li>设置相应的ACL规则。<br>
为ACL设置相关规则的时候需要了解入口流量与出口流量如下图所示入口流量指的是进入设备以路由器为例接口的流量无论来源是外部Internet还是内部网络同理出口流量指的是从设备接口流出的流量。</li>
</ol>
<p><img src="https://download.huawei.com/mdl/image/download?uuid=018f5f9d9a67476c966e64ec8d80b784" alt="img"></p>
<p>入口流量与出口流量</p>
<p>当外部Internet访问内部网络时通过路由器接口2的入口流量其源IP地址为外部的公网IP而当内部网络需要访问外部网络时通过路由器的接口1的入口流量其源IP地址则为内网的IP。</p>
<ol start="2">
<li>将ACL应用在相应的设备接口的特定方向in/out上。<br>
规则设置完成后需要将ACL应用在设备的接口上才能正常工作。因为所有的路由和转发决策都是由设备的硬件做出的所以ACL语句可以更快地执行。</li>
</ol>
<h3 id="匹配机制">匹配机制 </h3>
<p>设备使用ACL的匹配机制如下图所示。</p>
<p><img src="https://download.huawei.com/mdl/image/download?uuid=6eccf9843bb24fe5965548936bf2abdf" alt="img"></p>
<p>ACL的匹配机制</p>
<p>ACL规则的匹配遵循”一旦命中即停止匹配”的机制。当ACL处理数据包时一旦数据包与某条ACL规则匹配就会停止匹配设备根据该条匹配的语句内容决定允许或者拒绝该数据包。如果数据包内容与ACL语句不匹配那么将依次使用ACL列表中的下一条语句去匹配数据包直到列表的末尾。一般在ACL的列表末尾会有一条隐式的拒绝所有的语句所以数据包与所有的规则都不匹配的情况下会被直接拒绝。此时设备不会将此数据包流入或流出接口而是直接将其丢弃。</p>
<h2 id="acl的应用场景">ACL的应用场景 </h2>
<h3 id="在nat中使用acl">在NAT中使用ACL </h3>
<p>通过NAT的端口映射可使得外网访问内部网络。考虑到内部的网络安全不可能允许所有的外部用户访问内部网络这时可以设置ACL规则并应用在企业路由器上使得特定的外网用户可以访问内部网络。</p>
<p><img src="https://download.huawei.com/mdl/image/download?uuid=ea5831d3c218458099fcb50ccf8efcc5" alt="img"></p>
<p>在NAT中使用ACL</p>
<p>如上图所示,当公网主机想建立与内网主机的通信时,其发向内部网络主机的流量经过 NAT 设备时设备利用ACL对流量进行过滤阻断了PC4对PC2的访问同时允许PC3对PC1的访问。</p>
<h3 id="在防火墙中使用acl">在防火墙中使用ACL </h3>
<p>防火墙用在内外网络边缘处防止外部网络对内部网络的入侵也可以用来保护网络内部大型服务器和重要的资源如数据。由于ACL直接在设备的转发硬件中配置在防火墙中配置ACL在保护网络安全的同时不会影响服务器的性能。</p>
<p><img src="https://download.huawei.com/mdl/image/download?uuid=18fcc117a9034e048e8d8f58a82f904b" alt="img"></p>
<p>在防火墙中使用ACL</p>
<p>如上图所示在防火墙上配置ACL只允许外部特定主机PC A访问内部网络中的数据中心并禁止其他外部主机的访问。</p>
<h3 id="在qos中使用acl限制用户互访">在QoS中使用ACL限制用户互访 </h3>
<p>ACL应用在QoS的流策略中可以实现不同网段用户之间访问权限的限制从而避免用户之间随意访问形成安全隐患。</p>
<p><img src="https://download.huawei.com/mdl/image/download?uuid=4a3ec05a24454398b07a0ccfb8878de0" alt="img"></p>
<p>使用ACL限制不同网段用户的互访</p>
<p>如上图所示某公司为财务部和市场部规划了两个网段的IP地址。为了避免两个部门之间相互访问造成公司机密的泄露可以在两个部门连接Router的接口的入方向上应用绑定了ACL的流策略从而禁止两个部门的互访。</p>
</div>
</body></html>