{"id":514,"date":"2020-10-18T22:36:46","date_gmt":"2020-10-18T22:36:46","guid":{"rendered":"https:\/\/dft.wiki\/?p=514"},"modified":"2021-03-14T18:32:17","modified_gmt":"2021-03-14T18:32:17","slug":"working-with-acls-in-cisco-devices","status":"publish","type":"post","link":"https:\/\/dft.wiki\/?p=514","title":{"rendered":"Working with ACLs on Cisco Devices"},"content":{"rendered":"<p style=\"text-align: left;\">An ACL is a list of rules that can be applied to an interface to make a policy to the traffic.<\/p>\n<p>There are two main types of ACL:<\/p>\n<p><strong>Standard<\/strong>: is usually applied to the outbound interface because it only looks at the source of the package. It is usually identified by numbers between 1 and 99. It is also possible to put a name in it but the syntax is different.<\/p>\n<p><strong>Extended<\/strong>: is usually applied in the inbound interface because it looks at the source and destination IPs and prevents unnecessary traffic in the network. It also looks at the port to restrict or allow based on what type of service. You can name with numbers (between 100 and 199) and names, which makes it much easier to manage.<\/p>\n<p><strong>Standard<\/strong> ACL syntax:<\/p>\n<pre>access-list <strong>10\r\n<\/strong>access-list <strong>10<\/strong> allow 192.168.1.9\r\naccess-list <strong>10<\/strong> deny 10.0.0.0 <strong>0.0.0.255<\/strong><\/pre>\n<p>Note: <strong>10<\/strong> is the identification of the ACL, <strong>0.0.0.255<\/strong> is the wildcard of the network <strong>10.0.0.0<\/strong>, for a single host the wildcard is not necessary.<\/p>\n<p>And apply to one interface:<\/p>\n<pre>interface g0\/0\r\nip access-group <strong>10<\/strong> out<\/pre>\n<p><strong>Extended<\/strong> ACL syntax:<\/p>\n<pre>access-list <strong>100<\/strong> remark Allow HTTP+SSH\r\naccess-list 100 permit tcp host 192.168.10.3 <strong>host<\/strong> 10.2.2.1 <strong>eq<\/strong> 22\r\naccess-list 100 permit tcp any any <strong>eq<\/strong> 80\r\n\r\nip access-list extended <strong>WEB-POLICY<\/strong>\r\npermit tcp 192.168.30.0 0.0.0.255 <strong>host<\/strong> 10.1.1.1 <strong>eq<\/strong> 80\r\npermit tcp 192.168.30.0 0.0.0.255 209.165.200.224 0.0.0.31 <strong>eq<\/strong> 80<\/pre>\n<p>Note: <strong>100<\/strong> and <strong>WEB-POLICY<\/strong> Are the identification of the ACLs. When you inform <strong>host<\/strong> you don&#8217;t have to inform the wildcard because it is known, and <strong>eq<\/strong> stands for equal and <strong>followed by the port<\/strong> you are applying the rule.<\/p>\n<p>Applying to an interface:<\/p>\n<pre>interface g0\/0\r\nip access-group 100 <strong>out<\/strong>\r\n\r\ninterface g0\/1\r\nip access-group WEB-POLICY <strong>in<\/strong><\/pre>\n<p>Altering one rule of the Extended ACL:<\/p>\n<pre>ip access-list extended 100\r\n<strong>30<\/strong> permit ip 192.168.10.0 0.0.0.255 192.168.30.0 0.0.0.255<\/pre>\n<p>Remember! ACLs have always hidden one last rule that means DENY EVERYTHING FROM ANY TO ANY. So, if you want to permit everything else you have to set this command at the end:<\/p>\n<pre>access-list 100 deny icmp any any echo\r\naccess-list 100 deny icmp any any echo-reply\r\naccess-list 100 permit ip any any<\/pre>\n<p>If you want to allow the traffic that was already established, which means <strong>the response to a request<\/strong> adds &#8220;established&#8221; at the end of the rule:<\/p>\n<pre>access-list 100 permit <strong>tcp<\/strong> any any <strong>established<\/strong><\/pre>\n<p>Note: it can be applied to a <strong>tcp<\/strong> but not to an <strong>udp<\/strong> or <strong>ip<\/strong>.<\/p>\n<p>Useful commands (show all ACLs or show only ACL 100):<\/p>\n<pre>show access-lists\r\nshow access-list <strong>100<\/strong><\/pre>\n<p>Removing a rule or modifying it:<\/p>\n<pre>ip access-list extended <strong>100\r\n<\/strong>do show access-list <strong>100\r\n<\/strong>no <strong>30\r\n20<\/strong> xxxxx<\/pre>\n<p>Note: <strong>100<\/strong> is the identifier of the ACL and <strong>30<\/strong> and <strong>20<\/strong> are the numbers of the rule line listed in the second command.<\/p>\n<p>A common errors while creating ACL rules is blocking returning traffic. Double-check these conditions to avoid issues.<\/p>\n<p>Follow how to allow the traffic for already established TCP connections.<\/p>\n<pre>access-list 100 permit tcp any any established\r\naccess-list 100 deny tcp any any eq telnet<\/pre>\n<p>In the example above, the ACL 100 is applied to inbound of a WAN interface, for example. It blocks telnet coming in but allows incoming traffic for TCP established connections coming in that can be a telnet connection.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An ACL is a list of rules that can be applied to an interface to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-514","post","type-post","status-publish","format-standard","hentry","category-ccna"],"_links":{"self":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=514"}],"version-history":[{"count":14,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/514\/revisions"}],"predecessor-version":[{"id":1424,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/514\/revisions\/1424"}],"wp:attachment":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}