# Extended and Named ACLs

In this guide we will configure a numbered extended ACL and a named extended ACL. Not shown in this guide is the configuration of static routes between routers, and the configuration of SSH. Refer to our other guides for those configuration steps.

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2FO8PmxZBnGfydbQP7eH0I%2Fextended_acl_network_diagarm.png?alt=media&#x26;token=5636877f-e3ba-4eb7-9ea7-584237136b5a" alt=""><figcaption><p>Extended ACL Network Diagram</p></figcaption></figure>

## Configuration

#### Security standards we need to configure

* Users from VLAN 10 and VLAN 20 should not be able to telnet or make http connections to the web server
* Only users from the ENG VLAN 20 should have SSH access to R2

#### First lets figure where to apply the ACL. Standard ACLs should be as close to the destination as possible.

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2FWtJkMEk7wBNrJsMkxNdE%2Fextended_acls_placement.png?alt=media&#x26;token=aeb57336-26bc-404c-b39f-d99c2ace3a7f" alt=""><figcaption><p>Extended ACL Network Diagram Placement</p></figcaption></figure>

## CLI Configuration

#### Extended Numbered

`R1(config)#access-list 130 [ permit | deny ] [ protocol ] [ source IP or Protocol ] [ destination IP or Protocol] eq [ application | protocol]` # This syntax/command is just a simple overview of how to configure an Access Control Entry in an Extended ACL. There is a LOT more options you can configure on an extended ACL

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2FAkVXPdFJoiwkpbO3HRps%2Fextended_acl_config_example.png?alt=media&#x26;token=40735f1d-90fd-4c76-a23f-fbba864c23be" alt=""><figcaption><p>Extended ACL configuration</p></figcaption></figure>

`R1(config-if)#ip access-group [ Number | Name] [ in | out]` # This command will apply the ACL inbound or outbound on the desired interface

`R1(config-line)#ip access-class [ Number | Name ] [ in | out]` # This command will apply the ACL inbound or outbound on the VTY lines of the Cisco network deviced

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2FWvMQ2W6kCxtpcEdR0QZq%2Fnamed_acl_example.png?alt=media&#x26;token=9fda542c-278d-41d8-9adc-c410c25f0eff" alt=""><figcaption><p>Named ACL Configuration</p></figcaption></figure>

#### Named Configuration

`R1(config)#ip access-list [ standard | extended] [ number | name]` # This command creates a named ACL. Named ACL's have administrative advantages. You can be specific with the name and purpose of ACL, and you edit/order the Access Control Entries easier with **"named"** ACLs.

`R1(config-ext-nacl)#[ permit | deny ] [ protocol ] [ source IP or Protocol ] [ destination IP or Protocol] eq [ application | protocol]` # This command/syntax is just a simple overview of how to configure an Access Control Entry in a named extended ACL.

## Full Configuration

#### - Security standard 1 - Named ACL

`R1(config)#ip access-list extended DENY_HTTP_TELNET` # This command creates an extended named ACL

`R1(config-ext-nacl)#deny tcp 10.10.10.0 0.0.0.255 10.10.9.0 0.0.0.255 eq www`

`R1(config-ext-nacl)#deny tcp 10.10.20.0 0.0.0.255 10.10.9.0 0.0.0.255 eq www`

`R1(config-ext-nacl)#deny tcp 10.10.10.0 0.0.0.255 10.10.9.0 0.0.0.255 eq 23`

`R1(config-ext-nacl)#deny tcp 10.10.20.0 0.0.0.255 10.10.9.0 0.0.0.255 eq 23` # These Access Control entries deny telnet and http access from the SALES and ENG VLANs

`R1(config-ext-nacl)#permit tcp any any log` # This command allows all other traffic to the servers

`R1(config)#interface eth0/0.10` # This command brings us into the sub-interface configuration mode

`R1(config-if)#ip access-group DENY_HTTP_TELNET in` This command applies the ACL inbound under the sub-interface

#### Full configuration is shown below

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2Ff7ZGzz4dsvprO4ng6j8O%2Fextended_acl_config_01.png?alt=media&#x26;token=0685fe30-6b2d-4a75-b6c2-d3d1b7fe7c0e" alt=""><figcaption><p>Named Extended ACL configuration</p></figcaption></figure>

#### Security Standard 2 - numbered ACL

`R1(config)#access-list 130 permit tcp 10.10.20.0 0.0.0.255 any eq 22` # This command will create ACL 130 and the first Access Control Entry

`R1(config)#line vty 0 4` # This command will bring us into the line vty sub-configuration

`R1(config-line)#access-class 130 in` # This command will apply the ACL in bound on the VTY lines

#### Full configuration is shown below

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2Fw4OrGjJnE5O5tp7YLyiJ%2Fextended_acl_config_02.png?alt=media&#x26;token=85c4dcbf-43a1-49e9-8a21-2b65492fba03" alt=""><figcaption><p>Extended ACL configuration</p></figcaption></figure>

## Testing / Verification

#### Now lets do some testing. For this testing we will remove the ACL, check connectivity and then apply the ACL and test again. In this guide we will just demonstrate security standard 1.

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2FP0dWPwDeoTaJuJLuFIXw%2Ftest_telnet_without_acl.png?alt=media&#x26;token=6d1f6a35-8a6d-47d3-b735-c8ba11e99265" alt=""><figcaption><p>Testing Telnet</p></figcaption></figure>

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2FM7p0foBVBUJx8DyBSeLG%2Ftest_http_without_acl.png?alt=media&#x26;token=245d0280-3068-4612-a8f3-ee404b10d6df" alt=""><figcaption><p>Testing HTTP</p></figcaption></figure>

#### As we can see telnet and HTTP connections are successful to our web server in the 10.10.9.0/24 subnet. Now lets apply our ACL inbound on sub-interface 0/0.10.

`R2(config-subif)ip access-group DENY_TELNET_HTTP in`

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2FEu52XnMiotvDXhEM3zKx%2Ftest_with_acl.png?alt=media&#x26;token=857e8082-e9ba-439c-a5c7-210662305b92" alt=""><figcaption><p>Telnet Test After Applying ACL</p></figcaption></figure>

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2FraOFIVbrEpxSE2pKSPQa%2Fsyslog_filter_message.png?alt=media&#x26;token=380c56e8-50e6-4416-ac3a-646db0c1a296" alt=""><figcaption><p>syslog Message of Filtering Traffic Based on ACL</p></figcaption></figure>

#### Just from the CLI we can see that our traffic is getting blocked. On R2 we also get a syslog message alerting us that one of one Access Control Entries has a match.

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2FQnLopt9ALrbonxuahLrp%2Fwireshark_telnet_receive.png?alt=media&#x26;token=ed2d7f68-6bc9-4427-a24f-854ce1d2fece" alt=""><figcaption><p>Wireshark Telnet Capture</p></figcaption></figure>

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2FwLW3UrFZGHFLB9INIA64%2Fwireshark_telnet_unavailable_message.png?alt=media&#x26;token=e278ab01-0b68-4b12-920c-5cb2f9b369e0" alt=""><figcaption><p>Wireshark Telnet Capture with ACL Filtering</p></figcaption></figure>

#### - Looking at our wireshark capture we can see that our interface does recieve the telnet request, but replies with an ICMP unavailable messages. In the ICMP message we see the **"Communication administratively filtered"** message.

## Editing ACLs

#### Editing Names ACLs is simple. We go into the ACL named sub-configuration mode, and then we can resequence our Access Control Entries, or delete an Access Control Entry.

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2FLxz1gR9ygkS2nGUxIIjO%2Fshow_extended_acl_log_matches.png?alt=media&#x26;token=1284a678-a58f-49cb-b52d-43602e9e86e0" alt=""><figcaption><p>show access-list command and output showing matches</p></figcaption></figure>

`R1(config-ext-nacl)#no 10 deny tcp 10.10.10.0 0.0.0.255 10.10.9.0 0.0.0.255 eq telnet log` # This command deletes the Access Control Entry.

`R1(config-ext-nacl)#5 deny tcp 10.10.30.0 0.0.0.255 10.10.9.0 0.0.0.255 eq telnet log` # This command will place this Access Control Entry before all the other entries.

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2FFEMtdbxfMbqVCQy8tCLv%2Fedit_named_acl.png?alt=media&#x26;token=ab990642-5304-4374-b5f3-d1a792b23987" alt=""><figcaption><p>Editing a Named ACL</p></figcaption></figure>

<figure><img src="https://2373667134-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8zF1bBBRr6t1PCyfuXHu%2Fuploads%2FOF7NS9DeBC48vQ6sJyXj%2Fshow_extended_acl_after_edit.png?alt=media&#x26;token=cd35ef22-244a-4909-9c0d-92db49b66191" alt=""><figcaption><p>Show access-list after editing</p></figcaption></figure>

#### Editing numbered ACLs is not as simple as a named ACL. To edit a numbered ACL we must copy and paste the ACL to a text editor, make our changes there, delete the ACL, and then re-paste the ACL configuration. This will not be shown in this giude, but will be demonsrated in the corresponding videos.
