Pages

Tuesday, 4 May 2021

Access Control Lists (ACLs)

Contents

  1. Introduction and Overview
  2. Standard ACLs
  3. Extended ACLs
  4. Time-based ACLs
  5. Infrastructure ACLs
  6. Reflexive ACLs
  7. Dynamic ACLs
  8. Other ACL Features
  9. IPv6

Introduction and Overview

An Access Control List (ACL) is a sequential list of rules containing permit or deny statements, that are used to match packets. When applied to interfaces, ACLs are used to perform a network control service. Each rule in the ACL is known as an Access Control Entry (ACE); sometimes referred to as ACL statements. Each ACE can permit or deny specific traffic. Depending on the type of ACL, each ACE contains match criteria that packets transiting the device are subjected to such as:

  • Source and destination IP address
  • IP protocols such as TCP, UDP, ICMP, OSPF, EIGRP etc
  • TCP/UDP source and destination port numbers

The original intent when introducing ACLs was packet filtering. ACLs have since been deployed to provide multiple network functions such as:

  • Quality of Service (QoS) operations such as queueing, traffic classification for policing
  • Policy-based routing (PBR)
  • Route maps
  • Network identification in routing protocols
  • Route modification/filtering
  • Management plane restrictions
  • Object tracking

Processing of ACLs

The following description of ACLs applies to ACLs in packet filtering. Reference may be made to the application of ACLs in other features supported by routers or multi-layer switches.

The most common application of ACLs, in enterprise networks, is in packet filtering. By default, routers do not filter traffic; they examine the destination IP address of an IPv4/IPv6 packet and refer to the routing table to determine the egress interface. When an ACL is applied to a router interface:

  1. It evaluates all transiting packets
  2. Determines if a packet is permitted or denied based on the ACEs.
A router processing an ACL checks the header of each packet to determine whether it matches the criteria specified in any ACE of an ACL. If a match is found, the packet is forwarded or dropped as specified in the ACE (permit or deny) and further processing of the ACL ends:
  • A permit action allows the packet through.
  • A deny action results in a dropped packet.
Sequence numbers have a default increment of 10; with the first ACE having a sequence number of 10, 2nd 20, 3rd 30 and so on. ACL entries are processed sequentially from top to bottom of the list. By default, ACLs have an implicit deny added at the bottom of the ACL and these ACLs are used for through-the-box access rules. Management ACLs control to-the-box traffic; these ACLs do not have the implicit deny at the end of the ACL.

ACLs can be applied in the inbound or outbound directions from the perspective of the router. An inbound ACL filters packets coming into an interface but before any route processing takes place. An outbound ACL filters packets after route processing. If a packet matches any of the ACEs in an ACL, the action (permit or deny) is applied and the router immediately stops processing the ACL. The first match ends the processing of an ACL regardless of whether subsequent ACEs in the ACL match the packet. Because of this, when configuring ACLs, the ordering of the ACEs is extremely important.

Note: ACLs for traffic filtering do not block local router generated traffic in the egress direction.

Ordering of ACEs

When defining network ranges to be permitted or denied by an ACL, the more specific address entries should be configured before the general entries. The most specific network address entry is that defining a specific interface IP address using the keyword host or wildcard bit 0.0.0.0. These should then be followed by the more general wildcard bits. An illustrative example is:

  • deny host 192.168.1.1
  • permit 192.168.1.0 0.0.0.127
  • deny 192.168.1.0 0.0.0.255

If the more specific addresses are entered after the more general addresses which overlap the more specific address i.e., the more specific address is a subset of the more general address, IOS will display an error message.

R2(config-std-nacl)#5 deny 192.168.3.0 0.0.0.255
% Access rule can't be configured at lower sequence num as Host at sequence 10 is part of the given address block

Wildcard Bits

ACLs use wildcard bits and not subnet masks to match binary 0s and 1s of the IP address. Unlike subnet masks, wildcard masks use 0 = match, 1 = ignore. Wildcard bits allow for more specific matching of traffic compared to subnet masks. The bits that are set to zero in a wildcard bit must match. For example; 172.16.1.1 0.15.255.255 matches addresses in the range 172.16.1.1 172.31.255.255. Wildcard bits use the following rules to match binary 0s and 1s:

  • Wildcard bit 0: Match the corresponding bit value in the address.
  • Wildcard bit 1: Ignore the corresponding bit value in the address (do not care).

Unlike wildcard masks used in OSPF, EIGRP, wildcard bits do not have to be contiguous; they can be on or off anywhere to represent sections of the IP address that have to match and sections that do not have to match. To determine the wildcard bits to use when configuring an ACL, subtract the subnet mask value (in dotted decimal notation) from the broadcast subnet mask i.e., 255.255.255.255 (/24).

Matching Subnets

Example 1

If an IP address 192.168.1.0 has a subnet mask of 255.255.255.0, then the wildcard bits can be determined as follows:

Example 2

Given an IP address 192.168.1.30 with a subnet mask of 255.255.255.224 (/27), the wildcard bits can be determined as follows:

Example 3

Given six hosts:

  1. A with IP address 172.31.3.2
  2. B with IP address 172.31.28.128
  3. C with IP address 172.31.29.2
  4. D with IP address 172.31.30.10
  5. E with IP address 172.31.31.10
  6. F with IP address 172.31.33.3
If an ACL with ACE access-list 100 permit ip any 172.31.1.0 255.255.254.254 log is applied to an interface in the ingress direction:
  • The first and second octets of the wildcard bit indicates do not match anything. Therefore, all hosts A, B, C, D, E, and F match this criteria.
  • The third octet of the wildcard bit indicates match an odd number. This is because it has one bit set but the address it is matching has one(1) in the third octet. Hosts A, C, E, and F match this third octet.
  • The fourth octet of the wildcard bit matches an even number. Hosts A, C, and E match this 4th octet.
  • IOS will save the above ACL as 10 permit ip any 0.0.1.0 255.255.254.254 log.
Hosts A, C, and E will be permitted through as their IP addresses match this ACE.

Matching Hosts

To match a specific host's IP address, ACLs use three approaches:

  1. A wildcard bit with all 0 bits: permit 192.168.1.1 0.0.0.0
  2. The host keyword: permit host 192.168.1.1
  3. The full host IP address without a wildcard mask: permit 192.168.1.1

Matching any/all hosts

To match any IP address, ACLs use two approaches:

  • using the 255.255.255.255 wildcard bit
  • the any keyword. The any keyword denotes the IP address and wildcard bits of 0.0.0.0 0.0.0.0.

An example can be access-list 1 permit 0.0.0.0 255.255.255.255.

ACL Best Practices

The following are best practices to consider when configuring ACLs:

  • Optimize ACL order: most frequent matches should be placed at the top of the ACL minimize ACL processing time.
  • Placement:
    • The recommendation for placement of ACLs is for one ACL, per interface per direction (ingress or egress), per protocol (IPv4 or IPv6).
    • The best location for the placement of ACLs is as close to the source of the traffic as possible. This helps with saving network bandwidth by blocking traffic before it consumes network bandwidth. However, this may depend on the network design and type of ACL:
      • Extended ACLs are usually placed near the source; undesirable traffic is denied close to the source. This minimizes the waste of available network bandwidth with traffic that will be subsequently dropped.
      • Standard ACLs are usually placed near the destination of the traffic because standard ACLs match against the source IP address and do not specify destination addresses. This reduces the possibility of inadvertently blocking traffic that should be permitted.
    • Additional factors that may determine the placement of ACLs include:
      • The available network bandwidth
      • Ease of configuration
      • Scope of administrative control over the network

When applying an ACL to filter traffic, the following keywords are used:

  • Interface: ip access-group [acl-name | acl-number] [in | out]
  • VTY Line: access-class [acl-name | acl-number] [in | out]

Named ACL Recommendations

ACLs may be named or numbered. If an ACL is to be defined using an ACL name, the ACL naming recommendations are advised to be used when defining the ACL name. The ACL naming recommendations include the following:

  • Name cannot contain spaces or punctuation marks.
  • ACL name cannot begin with a number
  • ACL name must be unique; ACLs of different types cannot have the same name
  • ACL name can have alphanumeric characters
  • Recommended that the ACL name be written in capital letters
  • ACL names are locally significant. Multiple routers on the network can be configured to have the same name
  • Choose names that identify the function of the ACL

Types of ACLs

There are several types of ACLs:

  • Standard
  • Extended ACLs
  • Infrastructure
  • Transit
  • Time-based
  • Dynamic
  • IP Named
  • Reflexive
  • Context-based

The ACLs that are discussed in this post are: standard ACLs, extended ACLs, time-based ACLs, reflexive ACLs, and Dynamic ACLs.

Standard Access Control Lists

A standard ACL filters traffic based on source IP address of the packet. Standard ACLs can be named or numbered. If an ACL number is used to define the ACL, standard ACLs have two numbered ranges; 1-99 and 1300-1999 (expanded).

Named Standard ACLs

Named standard ACLs can be uniquely identified by the name. The name of the ACL is guided by the ACL naming recommendations previously discussed.

Using the network diagram above, an ACL is configured to deny packets sourced from the network 192.168.8.0/22 i.e., IP addresses in the network 192.168.8.0/24, 192.168.9.0/24, 192.168.10.0/24. 192.168.11.0/24. All other packets will be permitted. To configure a named standard ACL:

  1. Define the ACL using the command ip access-list standard <ACL-name>

    R2(config)#ip access-list standard ACL_DENY_192.168.8.0/22

  2. Define the ACE: specify the permit or deny statement using the command [permit | deny] {<ip-address> <wildcard-mask> | any}. [permit | deny] host <ip-address>

    R2(config-std-nacl)#10 deny 192.168.8.0 0.0.3.255
    R2(config-std-nacl)#permit any

  3. Apply the ACL: for traffic filtering, the ACL is applied to an interface using the interface mode command ip access-group <ACL-NAME> [in | out].

    R2(config)#interface g0/0
    R2(config-if)#ip access-group ACL_DENY_192.168.8.0/22 in

Numbered Standard ACLs

Numbered standard ACLs have ACL ID numbers ranging from 1 � 99 and in the expanded range 1300 � 1999. If configuring numbered ACLs using the classical approach (using command access-list <1-99|1300-1999>) any ACL whose ACL-ID matches can be considered as an ACE that is part of the same ACL with the specific matching number.

To configure a numbered standard access control list:

  1. Configure the ACL: in global configuration mode using the command ip access-list standard <1-99 | 1300-1999>

    R2(config)#ip access-list standard 1300

    A descriptive message can be added to the ACL using the command remark <descriptive-text>. This helps with the documentation of the ACL.

    R2(config-std-nacl)#remark deny host 192.168.3.1/24

    Numbered ACLs can also be configured using the command access-list <1-99> [permit | deny] <ip-address> <wildcard bit>.

    R2(config)#access-list 1300 permit host 192.168.3.1
    R2(config)#access-list 1300 permit 192.168.3.0 0.0.0.255
    R2(config)#access-list 1300 remark Deny network 192.168.3.0/24

  2. Apply the ACL to the interface: using interface mode command ip access-group <acl-number> [ in | out ]. When applying the ACL to the interface, the direction of operation should be stated:

    R2(config)#interface g1/0
    R2(config)#ip access-group 1300 out

Editing Numbered ACLs

Delete Numbered ACL

To delete a standard numbered ACL, use the command no access-list <acl-number>. This deletes the entire ACL including all its ACEs.

If an ACL has been associated with an interface, and the ACL is subsequently deleted as demonstrated; however, the interface still references the ACL in its configuration. The traffic filtering behaviour of the interface may become unpredictable. It is recommended that when deleting an ACL, the ACL first be disassociated with the interface using the command no ip access-group [acl-number | acl-name], thereafter the ACL can be deleted.

Modifying Existing ACE

Only a numbered ACL created using the command ip access-list standard <acl-id | acl-name> can have its ACEs modified. To modify a standard numbered ACL:

  1. Display the ACE sequence numbers using the command show access-lists <acl-number>.
  2. Enter into the ACL editing mode using the command ip access-list standard <acl-number>
  3. Remove the ACE that is to be modified by referencing its sequence number using the ACL mode command no <acl-number>.
  4. Enter the new ACE specifying its sequence number to replace the recently deleted ACE with the same sequence number.

Adding a new ACE

To add a new ACE, to a named standard ACL:

  1. Display the ACL details to determine where to add the new ACE using the command show access-lists <acl-number>
  2. Enter the ACL configuration mode using the command access-list <acl-number> or ip access-list standard <acl-number>.
  3. Configure the new ACE with a desired sequence number to the existing ACL using the command <1-99> [permit | deny] <ip-address> <wildcard-mask>.

Matching a default Route

All routing protocols have a mechanism through which a default route can be advertised. The default route has an IP address of 0.0.0.0 and subnet mask of 0.0.0.0. To match against the default route in a standard ACL, use the ACE access-list 10 permit 0.0.0.0.

Verification of Standard ACLs

show access-lists / show ip access-lists

The command show access-lists or similar alternative show ip access-lists displays configured ACLs. If any ACEs are configured with the log option, a summary of matches is included in the display.

R2#show ip access-lists
Standard IP access list 1300
    10 deny   192.168.3.1 log (10 matches)
    20 permit any (10 matches)
Standard IP access list ACL_DENY_192.168.8.0/22
    10 deny   192.168.8.0, wildcard bits 0.0.3.255 (50 matches)
    20 permit any (253 matches)

In the output of this command, the host statements are listed first in order to be efficiently processed by the IOS keeping the original sequence numbers. The range statements are listed after the host statements, in the order that they were configured along with their original sequence number. This is regardless of whether they may have a lower sequence number.

show ip interface <interface-id>

Displays any configured interfaces and the traffic filtering direction i.e., whether inbound or outbound.

R2#show ip interface g0/0
GigabitEthernet0/0 is up, line protocol is up
  Internet address is 192.168.12.2/30
  Broadcast address is 255.255.255.255
  Address determined by non-volatile memory
  MTU is 1500 bytes
  Helper address is not set
  Directed broadcast forwarding is disabled
  Multicast reserved groups joined: 224.0.0.9
  Outgoing access list is not set
  Inbound access list is ACL_DENY_192.168.8.0/22
  Proxy ARP is enabled
  Local Proxy ARP is disabled
  Security level is default
  Split horizon is enabled
  ICMP redirects are always sent
  ICMP unreachables are always sent
  ICMP mask replies are never sent
  IP fast switching is enabled
  IP fast switching on the same interface is disabled
  IP Flow switching is disabled
  IP CEF switching is enabled
  IP CEF switching turbo vector
  IP CEF turbo switching turbo vector
  IP multicast fast switching is enabled
  IP multicast distributed fast switching is disabled
  IP route-cache flags are Fast, CEF
  Router Discovery is disabled
  IP output packet accounting is disabled
  IP access violation accounting is disabled
  TCP/IP header compression is disabled
  RTP/IP header compression is disabled
  Policy routing is disabled
  Network address translation is disabled
  BGP Policy Mapping is disabled
  Input features: Access List, MCI Check
  IPv4 WCCP Redirect outbound is disabled
  IPv4 WCCP Redirect inbound is disabled
  IPv4 WCCP Redirect exclude is disabled

Extended Access Control Lists

Extended ACLs provide granular control over packet matching than standard ACLs. Extended ACLs match packets based on the following parameters:

  • Protocol type i.e., IP, ICMP, EIGRP, OSPF, TCP, UDP etc.
  • Source IP address
  • Destination IP address
  • Source port number (TCP or UDP)
  • Destination port number (TCP or UDP)

Extended ACLs can be numbered or named. Numbered extended ACLs are configured with an ACL number in the range from 100 - 199 and 2000 - 2699.

Extended ACLs support many layer 3 and layer 4 protocol names. The protocols are defined using the protocol name or number. Some supported protocol names include: eigrp, esp, ip, ospf, tcp, udp, icmp, gre. The supported protocol numbers are in the range 0 - 255. TCP has a protocol number of 6, UDP 17, OSPF 89.

With named extended ACLs, an ACE can be added or deleted within the ACL using the sequence number of the ACE. When modifying an existing ACE, it should first be deleted using the command no <sequence-number>. Then the new ACE can be entered with the same sequence number as the deleted one. Adding a new ACE without indicating the sequence number adds it to the bottom of the ACL by generating the highest sequence number for the ACE.

Configuration

To configure an extended ACL:

  1. Classic numbered extended ACL: using the command:
    1. access-list <100-199 | 2000-2699>
    2. [permit | deny] <protocol> <source-ip> <wildcard> [ <operator> source-port] <destination-ip> <wildcard> [ <operator> destination-port]
  2. Modern extended ACL:
    1. ip access-list extended <name | 100-199 | 2000-2699>
    2. [permit | deny] <protocol> <source-ip> <wildcard> [<operator> source-port] <destination-ip> <wildcard> [<operator> destination-port]

    The operator can be any of the following:

    • eq: match one specific port
    • range: to match a specified range of ports
    • gt: match ports greater than
    • lt: match ports less than

    R2(config)#ip access-list extended ACL_DENY_172.31.33.3 R2(config-ext-nacl)#deny ip 192.168.12.0 0.0.0.3 host 172.31.33.3
    R2(config-ext-nacl)#permit tcp 192.168.12.0 0.0.0.3 host 172.31.33.3 eq www
    R2(config-ext-nacl)#permit ip any any

A optional remark can be added to an ACL to describe the purpose of the ACL.

Accessing Layer 3 Options

Layer-3 options are accessed using the ip keyword as the top-level protocol. These options include:

  • dscp: matches packets with given dscp value
  • fragments: Check non-initial fragments
  • log: Log matches against this entry
  • options: matches packets with a given IP Options value
  • precedence: matches packets with a given precedence value

Accessing Layer 4/5 ACL Options

Extended ACLs provide the ability to match on Layer-4 and/or Layer-5 information using the TCP or UDP keywords as the top-level protocol. The UDP header is very basic and does not have many options. The TCP header is extensive with several options:

  • ack: Match the ACK-bit
  • established: Match established connections.
  • fin: match the FIN bit
  • fragments: Check non-initial fragments
  • gt: Match only packets with a greater port number
  • log:
  • ttl: match packets with a specific TTL value.

Matching on TCP/UDP Port Numbers

Matching on TCP/UDP port numbers also matches Layer 3 (IP) options as well. When matching TCP or UDP ports keywords can be used such as www, telnet, ftp, ftp-data or port numbers. However, not all port numbers have keywords associated with them. When matching TCP/UDP, the source and/or destination port numbers are optional. If the port numbers are not specified, then all protocol traffic will be permitted or denied depending on the configured action. Session-layer(Layer-5) port numbers may be matched in a variety of ways:

  • eq <port-number>: matching on an exact port number that "equals" the supplied value
  • lt <port-number>: matching on any value less than the supplied value.
  • gt <port-number>: matching on any value greater than the supplied value.
  • neq <port-number>: matching on any value not equal to the supplied value.
  • range <lower-upper>: matching on any value in the supplied range of values.

When matching against port numbers, the destination port follows the destination IP address and the source port follows the source IP address. If you specify the protocol, source and destination IP addresses, source and destination port, etc, for a packet to match the ACE, all these parameters have to be the same as the configured values for the ACE to be registered as a match.

Extended ACLs and Packet Fragmentation

When a packet is fragmented by a router, the first fragment of the packet contains the layer-3 and layer 4 header details. With subsequent fragments, the layer 3 header is copied from the first fragment; they do not contain the layer 4 header. The TCP/UDP header is maintained only in the first fragment.

From an ACL perspective, matching on the TCP header fields matches on the first fragment of a packet. Subsequent fragments of the packet are not matched by this. If the TCP header has the fragment offset value of 0(zero), then the packet is considered the first fragment or not a fragment at all. If a packet contains a value greater than zero in the fragment offset field, then this can be considered as being a fragment. If a packet has a non-zero value for fragment offset, the router will permit the packet if the ACL is checking for packets with specific TCP header values. This can be used in suppressing DoS attacks where fragmented packets are sent without sending the first fragment.

The fragments keyword is a layer 3 feature that can be used to query fragments.

Extended ACLs and TCP handshake

The TCP three-way handshake, when initiating a TCP connection, consists of the following exchanges:

  • Sender sets the SYNC flag
  • Receiver sets ACK flag
  • Sender sets ACK
All subsequent traffic will contain ACK flags or the RESET flag set. With this in mind, the traffic to a specific network/host can be permit to be initiated from a specific host/network and blocked if it is initiated from a different network/host. The two potential solutions include:
  1. Matching on the ACK and RESET flag.
  2. Matching on the established keyword
The two options do the same thing.

The following configuration permits HTTP traffic initiated by host 192.168.12.1 to host 192.168.23.2. HTTP traffic initiated by host 192.168.23.2 to 192.168.12.1 is denied.

R2(config-ext-nacl)#do show ip access-lists ACL_DENY_HTTP_192.168.23.2
Extended IP access list ACL_DENY_HTTP_192.168.23.2
    10 permit tcp host 192.168.23.2 host 192.168.12.1 eq www established (9 matches)
    15 permit tcp host 192.168.23.2 host 192.168.12.1 ack fin (24 matches)
    30 permit ospf any any (182 matches)
    40 permit icmp host 192.168.12.1 host 172.31.33.3
    50 permit icmp host 172.31.33.3 host 192.168.12.1 echo-reply (10 matches)
    100 deny ip any any log (11 matches)

Extended ACLs in Routing Protocols

Interior Gateway Protocols

When applied to interior gateway protocols for prefix filtering during redistribution, advertising etc., source fields identify the network and destination fields identify the smallest prefix length in that network range.

When matching networks in IGPs:

  • permit ip any any : permits all networks
  • permit ip host 10.1.0.0 host 255.240.0.0 : Permits all networks in the range 10.1.0.0/12
  • permit ip host 10.1.0.0 host 255.255.0.0 : Permits all networks in the 10.1.0.0/16 range
  • permit host 10.1.1.1 : Permits only the 10.1.1.1/32 host

BGP

For BGP network selection, source fields identify the network and destination fields identify the network mask.

  • permit ip 10.1.0.0 0.0.0.0 255.255.0.0 0.0.0.0 : Permits only the 10.1.0.0/16 network
  • Permit ip 10.1.0.0 0.0.255.0 255.255.255.0 0.0.0.0 : Permits any 10.1.any.0 network with a /24 prefix
  • Permit ip 10.1.0.0 0.0.255.255 255.255.255.0 0.0.0.255 : Permits any 10.1.any.any network with a /24 - /32 prefix
  • permit ip 10.1.0.0 0.0.255.255 255.255.255.128 0.0.0.127 : Permits any 10.1.any.any network with a /25 - /32 prefix

Packet Filtering using ACLs

ACLs are applied to an interface in a given direction; ingress or egress. Ingress is when traffic is entering a router interface and egress is when traffic is exiting the router through an interface. To apply the ACL to an interface, you need to indicate the direction of traffic flow that the device should implement the ACL. Pinging a destination that is blocked by an ACL results in ICMP unreachable output indicated by U.U.U.U.

Matching a default Route

To match against the default route in an extended ACL, use the ACE access-list 100 permit ip host 0.0.0.0 host 0.0.0.0.

In a prefix-list, to match a default route, use the command ip prefix-list 10 permit 0.0.0.0/0.

Time-based ACLs

Time-based ACLs are only active during a specified time range. The time-range configured on a router references the router�s clock. Time-based ACLs consist of ACEs that are activated during configured time periods. The time periods are a feature that is separate from ACLs and are defined using the global configuration command time-range. This configured time period is then applied to an extended ACLs making it a time-based ACL. The time configured using the time-range command can be periodic or absolute:

  • Periodic: the ACE is activated at the scheduled time periods such as daily, specific days of the week, weekly, monthly, hourly, etc. The ACL gets re-activated based on the configured time.
  • Absolute: ACE gets activated for a specific duration and this occurs only once.

When configuring a time-based ACL, it is important to ensure the accuracy of the device clock. It is recommended to use NTP to set the system clock.

It can be set to be periodic where it becomes active or inactive at specific times of the day or on specific days of the week e.g. every Wednesday from 10am � 2pm or absolute where there is a specific starting and stopping date and time.

You cannot create time-based rules that have the exact same protocol, source, destination, and service criteria of a rule that does not include a time range object. The non-time-based rule always overrides the duplicate time-based rule, as they are redundant.

Configuration of Time-based ACLs

  1. Ensure that the clock is accurate: it is important to ensure that the system clock is accurate when configuring time-based ACLs. The clock can be set manually or preferrably through NTP:

    • Manually configuring clock: using the privileged mode command clock set hh:mm:ss dd month year
    • Using NTP: A list of NTP servers can be configured using the global configuration command ntp server <server-ip> [prefer] [version]. Current NTP version is 4. The optional prefer keyword indicates that this specific NTP server is preferred to other configured NTP servers.

  2. Configure the time-range:
    1. Define the time-range: using the command global configuration command time-range <name>:

      R1(config)#time-range TIME-RANGE_WORK-WEEK

    2. Time-range type: Decide on absolute or periodic type. Absolute activates the ACE only once for the defined duration and does not repeat. Periodic occurs repeatedly where the ACE is activated on the specified period and for the defined duration. Time values are defined in 24-hour clock.
      • Absolute: R1(config-time-range)#absolute start <hh:mm> <1-31> <Jan-Dec> <yyyy> end <hh:mm> <1-31> <Jan-Dec> <yyyy>

        R1(config-time-range)#absolute start 12:00 06 Jun 2022 end 00:00 31 Jan 2035

      • Periodic: periodic [Monday | Tuesday | Wednesday | Thursday | Friday | daily | weekdays | weekend] <hh:mm> to <hh:mm>. If the periodic value configured is a day of the week, it is possible to set the value to a series of days periodic Monday Wednesday Friday <hh:mm> to <hh:mm>.

        R1(config-time-range)#periodic weekdays 00:00 to 23:30

      Curiously, IOS permits the configuration of periodic and absolute parameters values on the same ACL.

      R1#show time-range
      time-range entry: TIME-RANGE_WORK-WEEK (inactive)
         absolute start 12:00 06 June 2026 end 00:00 31 January 2035
         periodic weekdays 0:00 to 23:30

      The show time-range command will display �inactive� if the current time is not within the range of the configured time.

  3. Apply the time-range to the ACL: using the keyword time-range <name_of_time-range> of the ACE ACL configuration.

    R1(config-ext-nacl)#permit ip 192.168.23.0 0.0.0.3 host 192.168.12.1 time-range TIME-RANGE_WORK_WEEK
    R1(config-ext-nacl)#permit tcp 172.16.33.0 0.0.0.255 192.168.8.0 0.0.0.255 eq www time-range TIME-RANGE_WEEKEND

  4. Apply the ACL to the interface:

    R1(config)#interface g0/0
    R1(config-if)#ip access-group 100 in

Infrastructure ACLs

An infrastructure ACL is an extended ACL applied to layer 3 devices residing at the edge of an enterprise network. The primary purpose is to prevent malicious traffic from entering the enterprise. It is usually applied inbound on the interface connecting to the external network. Typical ACEs configured in infrastructure ACLs include tracking TCP fragments, blocking TCP connections initiated by outside users.

R1(config)#ip access-list extended INFRASTRUCTURE
R1(config-ext-nacl)#deny tcp any any fragments

Reflexive ACLs (IP Session Filtering)

Reflexive ACLs enable a router to implement stateful filtering that firewalls implement where return traffic for established sessions is dynamically allowed. A network is labelled an inside network and another network labelled as an outside (and considered unsafe). Connections initiated by hosts in the inside network to hosts in the outside network are permitted. Also permitted is return traffic. Traffic initiated by hosts in the outside network is denied. Reflexive ACLs permit outbound traffic and limit inbound traffic in response to sessions that originate from the inside network. Reflexive ACLs make the edge routers operate similar to a stateful firewall protecting internal users from external threats. Internal users are permitted to access external resources but external users cannot initial connections to internal resources.

Reflexive ACLs monitor for permitted, outgoing data of any type; they can be configured to track any protocol whether TCP, UDP, ICMP. The type of expected traffic is defined e.g., SSH, HTTPS. Reflexive ACLs are defined only with extended named IP ACLs. However, to improve the security posture of the network, they can be used in conjunction with other standard and static extended ACLs. An ACL is configured to permit the defined traffic types and the keyword reflect is added to this ACL.

Reflexive ACLs have create a mirror-image of transmitted traffic which will be permitted upon return. The reflexive ACL creates a dynamic ACL on-the-fly where it is expecting and permitting a return packet. Return traffic is permitted because it matches the return traffic. The reflex keyword of an extended ACL causes the router to remember the traffic that matches the permitted traffic such as HTTPS session(source and destination, port numbers, IP protocol field), and monitor all return traffic. The reflexive ACLs create a mirror-image of transmitted traffic which will be permitted upon return; the return traffic is then expected to have the source and destination ports, source and destination IP addresses reversed. What was the source port in the original traffic will be the destination port in the return traffic.

Traffic that matches the implicit deny statement of the ACL does not trigger the creation of the reflexive ACL. Only permit statements create the reflexive ACLs

Reflexive ACLs should be applied on the interface connecting to the untrusted network/host.

Configuration of Reflexive ACLs

  1. Configure a named extended ACL: Reflexive ACLs can only be used with named extended ACLs. The following error message is displayed when an attempt is made to configure reflexive ACL using a numbered extended ACL: % Reflexive ACLs are allowed on named ACLs only.

    R2(config)#ip access-list extended ACL_REFLEXIVE_EGRESS
    R2(config-ext-nacl)#permit ip host 192.168.12.1 host 172.31.30.10 reflect MIRROR

    The dynamic ACL MIRROR reflects the permitted traffic swapping the source IP address with destination IP address, source port with destination port of the original traffic.

  2. Create a named extended ACL for monitoring ingress traffic from untrusted sources: create a new extended named ACL and include the keyword evaluate referencing the previously configured reflexive ACL name.

    R2(config)#ip access-list extended ACL_REFLEXIVE_INGRESS
    R2(config-ext-nacl)#evaluate MIRROR

    The name must match the name previously supplied after the "reflect" keyword.
  3. Apply both ACLs to interface facing untrusted networks:

    R2(config)#interface g1/0
    R2(config-if)#ip access-group ACL_REFLEXIVE_EGRESS out
    R2(config-if)#ip access-group ACL_REFLEXIVE_INGRESS in

To permit another protocol such as ICMP, adding the command permit icmp any any does not permit the traffic. ICMP traffic has to be tracked on the ACL using the command permit icmp any any reflect Mirror.

Timeout Values

Reflexive entries expire after configurable timeout value. When this happens, that same TCP, UDP return traffic that was previously permitted will be denied on the interface. Reflexive ACLs have a timeout value that expires. This value can be configured. After the expiry of the timeout value, the dynamic reflexive entry is removed and that same TCP and UDP information is no longer permitted on the interface.

The timeout value expire under the following conditions:

  1. Graceful end of TCP session messages are received; (2 segments seen with FIN flags). The default timeout is 5 seconds.
  2. TCP reset message is received (RST). The default timeout is immediate.
  3. TCP messages no longer seen: the default timeout value is 300 seconds.
  4. For UDP, ICMP and all other protocols, the default timeout value is 300 seconds after last seen packet

Timeout values for graceful end of TCP session and TCP session reset can not be modified. The timeout values for non-receipt of TCP messages and other protocols such as UDP, ICMP can be modified in two ways:

  1. Globally: using the global configuration command ip reflexive-list timeout <1-2147483>
  2. Modifying within ACE Entries:

    R2(config)#ip access-list extended ACL_REFLEXIVE_EGRESS
    R2(config-ext-nacl)#10 permit host 192.168.12.1 host 172.31.30.10 reflect MIRROR timeout 250
    R2(config-ext-nacl)#20 permit host 192.168.8.1 host 172.31.30.10 reflect MIRROR timeout 150
    R2(config-ext-nacl)#permit host 192.168.10.1 host 172.31.30.10 reflect MIRROR timeout 120

The global reflexive ACL timeout values take precedence over the ACE specific timeout values.

The mirror ACL should be active for a defined period of time. If it is indefinite, this could become a security loophole; though the default timeout values are enforced if explicit timeout values are not configured.

Verification

show ip access-lists

The reflexive ACL created by the traffic can be verified using the command show ip access-list. This is used to determine if the reflexive ACL is in effect or not. Command displays the matched hosts even if the keyword "any" was used in the ACL.

R2#show ip access-list
Extended IP access list ACL_REFLEXIVE_EGRESS
    10 permit ip host 192.168.12.1 host 172.31.30.10 reflect MIRROR (31 matches)
    20 permit ospf any any
Extended IP access list ACL_REFLEXIVE_INGRESS
    10 evaluate MIRROR
    20 permit ospf any any (128 matches)
Reflexive IP access list MIRROR
     permit tcp host 172.31.30.10 eq www host 192.168.12.1 eq 63366 (5 matches) (time left 297)

R2#        

Using the log keyword when defining the ACL will create Syslog messages that will indicate when the ACL was created.

debug ip access-list data-plane

Running the command debug ip access-list data-plane is not recommended as it generates a lot of traffic on the network. To determine the timestamp when the reflexive ACL was created:

  1. Disable logging to the console no logging console.
  2. Send logs with severity of debugging to the logging buffer using the command logging buffer debug
  3. Increase buffer size: logging buffer 100000
  4. Debug ACL: debug ip access-list data-plane

    R2#debug ip access-list data-plane
    R2#
    *Jun 23 05:25:06.155: IPACL-DP: ACL check is not done due to either of invalid input interface or output interface doesnt have any acl attached or locally generated traffic
    R2#
    *Jun 23 05:25:10.375: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:25:10.375: IPACL-DP: Pkt matched permit it
    *Jun 23 05:25:10.379: IPACL-DP: Pkt is permitted in process path: interface GigabitEthernet1/0 inbound direction
    *Jun 23 05:25:11.643: IPACL-DP: Reflexive ACL: Punt the packet as we are in interrupt context
    *Jun 23 05:25:11.643: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_EGRESS seq: 10 Action: Deny
    *Jun 23 05:25:11.643: IPACL-DP: Pkt matched punt/drop it
    *Jun 23 05:25:11.643: IPACL-DP: ipaccess_fib_acl_check_inline : Pkt is punted to process path from cef path: interface GigabitEthernet1/0 outbound direction
    *Jun 23 05:25:11.651: IPACL-DP: New Reflexive acl entry created for the flow
    *Jun 23 05:25:11.651: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_EGRESS seq: 10 Action: Permit
    *Jun 23 05:25:11.651: IPACL-DP: Pkt matched permit it
    *Jun 23 05:25:11.651: IPACL-DP: Pkt is permitted in process path: interface GigabitEthernet1/0 outbound
    R2# direction
    *Jun 23 05:25:11.663: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 10 Action: Permit
    *Jun 23 05:25:11.663: IPACL-DP: Pkt matched permit it
    *Jun 23 05:25:11.663: IPACL-DP: ipaccess_fib_acl_check_inline : Pkt is permitted in cef path: interface GigabitEthernet1/0 inbound direction
    *Jun 23 05:25:11.675: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_EGRESS seq: 10 Action: Permit
    *Jun 23 05:25:11.675: IPACL-DP: Pkt matched permit it
    *Jun 23 05:25:11.675: IPACL-DP: ipaccess_fib_acl_check_inline : Pkt is permitted in cef path: interface GigabitEthernet1/0 outbound direction
    *Jun 23 05:25:11.679: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_EGRESS seq: 10 Action: Permit
    *Jun 23 05:25:11.679: IPACL-DP: Pkt matched permit it
    *Jun 23 05:25:11.679: IPACL-DP: ipaccess_fib_acl_check_inline : Pkt is permitted in cef path: interface GigabitEthernet1/0 outbound direction
    *Jun 23 05:25:11.899: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 10 Action: Permit
    *Jun 23 05:25:11
    R2#.899: IPACL-DP: Pkt matched permit it
    *Jun 23 05:25:11.899: IPACL-DP: ipaccess_fib_acl_check_inline : Pkt is permitted in cef path: interface GigabitEthernet1/0 inbound direction
    R2#
    *Jun 23 05:25:15.431: IPACL-DP: ACL check is not done due to either of invalid input interface or output interface doesnt have any acl attached or locally generated traffic
    R2#
    *Jun 23 05:25:20.031: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:25:20.031: IPACL-DP: Pkt matched permit it
    *Jun 23 05:25:20.031: IPACL-DP: Pkt is permitted in process path: interface GigabitEthernet1/0 inbound direction
    R2#
    *Jun 23 05:25:25.155: IPACL-DP: ACL check is not done due to either of invalid input interface or output interface doesnt have any acl attached or locally generated traffic
    R2#

  5. To view the ACL creation timestamp: show log | include REFLEXIVE

    R2#show log | include REFLEXIVE
    *Jun 23 05:25:29.391: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:25:38.551: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:25:48.283: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:25:57.987: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:26:06.979: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:26:11.687: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 10 Action: Permit
    *Jun 23 05:26:11.707: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_EGRESS seq: 10 Action: Permit
    *Jun 23 05:26:16.051: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:26:25.503: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:26:35.391: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:26:44.627: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:26:54.431: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:27:04.231: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:27:11.727: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 10 Action: Permit
    *Jun 23 05:27:11.743: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_EGRESS seq: 10 Action: Permit
    *Jun 23 05:27:13.699: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:27:23.415: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:27:32.779: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:27:41.851: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit
    *Jun 23 05:27:51.403: IPACL-DP: Pkt matched ACL: ACL_REFLEXIVE_INGRESS seq: 20 Action: Permit

Dynamic Access Lists

Dynamic ACLs are used to restrict network access to only authenticated users. Dynamic ACLs provide support for permitting access based on an authentication server. Every authentication request to a device is offloaded to a central authentication database. This might require manual configuration of each device. The device sends out an authentication request to the host before permitting access, e.g. SSH access to a network device.

When attempting to access a network service such as HTTP server, a dynamic ACL forces the unauthenticated user to first Telnet the authentication service which may be configured on a router; SSH support can alternatively be enabled. After successful authentication, the Telnet session is closed and a dynamic ACL is created on the interface permitting access to the host with the network service.

The dynamic ACL is removed from the interface after a configurable absolute-timeout or idle-timeout value expires. Reflexive ACLs do not have absolute timeouts where regardless of activity or inactivity, traffic is denied at the absolute timeout interval.

Components of a dynamic access list inclide the following:

  • Connection used for authentication: Telnet, SSH
  • Extended Acces Control List (ACL) configured with dynamic entries
  • Autocommand with access-enable option: this is implemented at the user, or line level:
    • Autocommand: once authentication is successful, disconnect from the device. Autocommand then executes access-enable.
    • Access-enable: ensures that the dynamic part of the ACL gets activated.

One use case for implementing sdynamic ACLs, if individuals require temporary access to a network device e.g., Telnet access to a router for a specified period.

Dynamic ACL Rules

The following guiding principles apply to the configuration and operation of dynamic ACLs:

  • Dynamic ACLs cannot be used to provide different access rights to different users.
  • Dynamic ACLs may use either an idle-timeout or absolute timeout value.
  • Autocommand access-enable may be configured either: at the username level or within the VTY line.
  • Dynamic ACLs are configured with named or numbered extended ACLs only.
  • Standard ACLs do not support dynamic ACLs.

Configuration

  1. Create a local account: using the command username <name> password <password>

    R2(config)#username admin password cisco

    The access can be enabled through the following methods:

    • Under the local user account: using the command username <username> autocommand access-enable timeout <value>. This command temporarily present the username and password prompt.

      R2(config)#username admin autocommand access-enable timeout 5
      • autocommand: If they authenticate successfully or fail to authenticate three times unsuccessfully, close the authentication page.
      • access-enable: implement dynamic access list.
      • timeout: idle timeout value.

    • Add the autocommand directly under the VTY lines:

      R2(config)#line vty 0 4
      R2(config-line)#autocommand enable-access timeout 5

    The autocommand under the VTY line affects all users while the command under the username applies only to that specific user and not others.

  2. Create the access list: using named or numbered extended access-lists.
    1. Define the dynamic ACE:

      R2(config)#ip access-list extended 101
      R2(config-ext-nacl)#10 dynamic ACL_DYNAMIC_TELNET timeout 15 permit ip any any

      The timeout specified here is the absolute timeout value. Both timeout values can be specified. There is no default timeout value; if none of the timeout values is not defined, then there is no timeout value for the dynamic ACL resulting in access is granted in indefinitely.

      Only one ACE in an ACL can have the dynamic keyword. Typing a second one triggers an error message.

    2. Create the ACE permitting the traffic to the router:

      R2(config-ext-nacl)#30 permit tcp host 192.168.12.1 host 172.31.30.10 eq telnet

  3. Enable VTY local login:

    R2(config)#line vty 0 4
    R2(config-line)#login local

  4. Apply it to the interface pointing to the host that initiates the connection in the inbound direction: A dynamic ACL is always in the inbound direction.

    R2(config-line)#interface g0/0
    R2(config-if)#ip access-group ACL_DYNAMIC_TELNET in

Timeout

Two timeout parameters can be configured:

  • Idle timeout: One is enabled through the access-enable host command with the timeout keyword where the value specified is in seconds.
  • Absolute timeout: specified with the dynamic entry

Clearing a Dynamic ACL

If a dynamic ACL is in place and you intend to delete it, use the command clear ip access-template <acl-name|acl-number> <dynamic-ACL-name> <source> <destination> .

If a dynamic ACL is cleared in the when a user has Telnet/SSH access, this access is disabled.

Extending Dynamic ACL Entries

IOS allows users to extend the life of their dynamic ACE by an additional 6 mminutes. Using the command access-list dynamic-extended, the user Telnets back into the router and receives the additional time. The extended value of 6 minutes is currently fixed and cannot be adjusted.

Additional ACL Features

Object Groups

Originally designed for ASA firewalls, object groups is a feature in extended ACLs that simplify ACL management by grouping similar "objects" together e.g., pubilc_web_servers group. It allows for more modular changes; a change to an object group dynamically affects all ACEs referencing that group. Command syntax is slightly different on IOS routers than ASA firewalls.

Traditionally, when modifying an existing ACL, the port that it is applied to is shutdown, and the ACEs of the ACL are modified. Then the port is re-enabled. Usually, this configuration is carried out during out-of-office hours. With object groups, the ACEs reference the object group. The object group can be modified and after completion, the ACL gets updated without disabling a port that references the ACL.

On Cisco routers, there are two types of object groups:

  1. Network group: for defining IP address-related objects for example host or subnet section of an ACE can be replaced by an object group and the ACE references the object group.
  2. Service group: for defining protocols and ports such as high-level protocol, TCP/UDP port numbers,

Configuration

In this configuration, different object groups are configured for clients, servers and protocols.

R2#configure terminal
R2(config)#object-group network CLIENTS
R2(config-network-group)#host 192.168.8.1
R2(config-network-group)#192.168.3.0 /24
R2(config-network-group)#192.168.12.0 0.0.0.3

Servers

R2(config)#object-group network SERVERS
R2(config-network-group)#host 172.31.30.10
R2(config-network-group)#172.31.33.3 /24

Protocols

R2(config)#object-group service NETWORK_SERVICES
R2(config-service-group)#tcp eq telnet
R2(config-service-group)#tcp eq www

Configuring the ACL to reference the object groups in the following order:

  1. Service object group
  2. Source object group
  3. Destination object group
permit object-group <protocol-object-group> object-group <source-object-group> object-group <destination-object-group>

R2(config)#ip access-list extended 101
R2(config-ext-nacl)#permit object-group NETWORK_SERVICES object-group CLIENTS object-group SERVERS

Verification

show object-group

Displays the configuration of the object group.

R2#show object-group

Network object group CLIENTS
  host 192.168.8.1
  192.168.3.0 255.255.255.0
  192.168.12.0 255.255.255.252
          
Service object group NETWORK_SERVICES
  tcp  eq telnet
  tcp  eq www
  ip    
          
Network object group SERVERS
  host 172.31.30.10
  172.31.33.0 255.255.255.0

Sequence Numbers

When a new ACE is added to an ACL, by default, the first configured ACE is assigned a sequence number of 10. Subsequent ACEs have their sequence numbers generated in increments of 10 with the second ACE having sequence number 20, third ACE 30 and so on.

It is possible to modify the starting sequence number of an existing ACE as well as change the sequence number increment value using the command ip access-list resequence <acl-id> <starting-seq-number> <increment>. This feature is available for all ACLs.

R2#show ip access-lists 101
Extended IP access list 101
    10 Dynamic Project permit ip any any
    20 permit tcp any host 172.31.30.10 eq telnet
    30 permit ospf any any (676 matches)
    40 permit object-group NETWORK_SERVICES object-group CLIENTS object-group SERVERS

R2#ip access-list resequence 101 1000 50
R2#show ip access-lists 101
Extended IP access list 101
    1000 Dynamic Project permit ip any any
    1050 permit tcp any host 172.31.30.10 eq telnet
    1100 permit ospf any any (684 matches)
    1150 permit object-group NETWORK_SERVICES object-group CLIENTS object-group SERVERS

Logging

ACE entries can be appended with logging-related keywords: log and log-input. These commands cause log messages to be generated if a packet matches the ACE providing hit-counts and evidence of ACL activity. Logging forces packets matching the ACE entries to be process-switched resulting in increased CPU load. Additionally, printing out Syslogs increase the CPU load.

With log:

  • Timestamp information is displayed
  • ACL number
  • Protocol
  • Source and destination address
  • Interface ACL is applied to (0/0)
  • Number of packets matched

With log-input, additional information is displayed particularly the MAC address; this is the most recent MAC address.

An additional descriptive text can be added to the ACE to describe the particular role of the ACE e.g. access-list 101 permit icmp any host 2.2.2.2 log-input EmailServer. This tags the ACE for traffic to the email server.

Log Interval

Individual ACEs can have the "log" or "log-input" keywords. When an ACL is applied to an interface, syslogs are generated:

  • Once every 5 minutes for packets matching a particular ACE. The summary of the number of packets that were matched over the last 5 minutes is displayed.
  • If any log-enabled ACE in any ACL on any interface matches a packet within one second of the initial log message, the match or matches aggregated statistics for 5 minutes are then reported.

If you want logs for ACEs to be displayed more frequently than every 5 minutes, use the command ip access-list log-update threshold <0-2147483647> with the value being the number of hits; display a syslog after x number of packets match the ACE. This applies to all ACEs of an ACL.

This increases the CPU Load. Even though logs for individual ACEs are only displayed every 5 minutes, every packet that matches the ACE must be process-switched.

To reduce this; use the command ip access-list logging interval <0-214748367> . The value is in milliseconds; for all the packets that match the ACE, send packets to the CPU every nth (configured) interval.

Filtering on Log Output

ACL syslogs have different identifiers depending on type of traffic that triggered the log.

LOG-CODES

When sending ACL syslogs to logging buffer, one can filter one these identifiers:

  1. Severity: 0-7: logging buffer <severity>
  2. Filter the log output based on the applicable protocol: show log | include RP filters for TCP and UDP generated logs. This displays permitted or denied Syslogs.

Verification and Troubleshooting

Some key commands include:

  • show access-lists: displays configured ACLs
  • show ip interface: displays any ACLs configured on a port.
  • debug ip packet <acl_num>: debugs packets matching an ACL

IPv6 ACLs

By default, IPv6 access-lists add permit statements that are necessary for IPv6 to function. IPv6 ACls are only named extended ACLs. They offer similar features to IPv4 extended ACLs. IPv6 ACLs use the prefix length instead of wildcard masks to match. The host keyword can also be used with IPv6 ACLs.

They include an implicit deny statement at the end. IPv6 will automatically add the following statements to any access-list (does not show up in configuration):

  • permit icmp any any nd-na
  • permit icmp any any nd-ns
  • permit icmp any any router-advertisement
  • permit icmp any any router-solicitation

The above statements allow the router to participate in the IPv6 equivalent of ARP for IPv4.

If using an explicity deny, make sure to manually include the ICMP traffic with permit statements.

IPv6 ACLs do not support wildcard bits; instead prefix-length is used.

Configuration

  1. Define the ACL: using the command ipv6 access-list <ACL-NAME>
  2. Configure the ACE: using the command [permit | deny] <protocol> [<source-address/prefix-length> | any | host <source-address] [operator <port-number>] [<destination-address/prefix-length> | any host <destination-addres>] [operator <port-number>] where:
    • deny | permit specifies whether to permit or deny traffic
    • protocol protocol name or number
    • source-ipv6-prefix|prefix-length
    • any: is an abbreviation for IPv6 prefix ::/0 that matches all addresses
    • host: specific IPv6 host address
    • operator: (optional) an operand that compares the source or destination ports of the specified protocol. Operands include:
      • lt: less than
      • gt: greater than
      • eq: equal to
      • neq: not equal to
      • range: range of protocol numbers
  3. Apply the ACL to the interface: using the command ipv6 traffic-filter <ACL-NAME> [in | out]

Verification

show ipv6 interface <interface-id>

show access-lists

R2#show access-lists
IPv6 access list ACL6_DENY1::2
    deny tcp any eq www host 1::2 sequence 10
    permit icmp any any (57 matches) sequence 20
    permit 89 any any (425 matches) sequence 30
    permit tcp any eq www host 1::1 sequence 40
    permit tcp host 3::3 host 1::1 eq www (23 matches) sequence 50

Wednesday, 10 March 2021

Logging, Debugging, Timestamps, Sequence Numbers

Introduction and Overview

Logging aims to answer the three questions: what, when, who? Log messages are generated by the various services and protocols running on a network device. By default, output from system messages and debug commands is sent to a logging process. The logging process controls the distribution of logging messages to various destinations, such as the logging buffer, terminal lines, syslog server. Messages are also sent to the console. These are then viewed using syslog, local logging, debugs, conditional debugs.

Logging can be used for fault identification, security auditing and network forensics; for monitoring the network and performance of network devices. Additional purposes include regulatory compliance.

Log messages include a timestamp that indicates the time when the log was generated. It is important to note that the time must be accurate. This can be done by configuring NTP to provide accurate datetime values. The time must be consistent across all network devices; troubleshooting can be difficult if you cannot correlate timestamps across devices.

Logging Messages

Syslog messages can be output to the console, local buffer or remote syslog server. The messages follow this format:

%FACILITY-SUBFACILITY-SEVERITY-MNEMONIC: message text

Where:

  • FACILITY-SUBFACILITY: protocol, module or process that generated the message.
  • SEVERITY: This is a level from 0 - 7 that specifies how important the message is. The following table displays all the logging severity levels available:

    Level Number Severity Description Syslog Definition
    0 Emergencies System is unusable LOG_EMERG
    1 Alerts Action must be taken immediately LOG_ALERT
    2 Critical Critical conditions LOG_CRIT
    3 Errors Error conditions LOG_ERR
    4 Warnings Warning conditions LOG_WARNING
    5 Notifications Normal but significant conditions LOG_NOTICE
    6 Informational Informational messages LOG_INFO
    7 Debugging Debug-level messages LOG_DEBUG

    When you enable logging for a specific level, it also enables all levels above it. For example, if you enable level 4(warnings), it also will enable levels 0 - 3.

  • MNEMONIC: a code that identifies the action reported
  • Message text: A plain text description of the event

Local Logging

By default, logging on the console includes all severity levels 7 - 0. Logging on the console can be disabled using the command no logging. By default, monitor and buffer logging display messages with severity levels of debugging and lower.

Logging Console

To enable logging to console, use the command logging console. By default, the logging severity level for console is debugging. To control the logging options, use the command logging console <level>.

Logging Buffer

For local logging, Cisco IOS can save syslog messages to an internal buffer i.e., all the logs are saved on the device itself. You can display these messages by using the show logging command.

These messages are lost when the device is rebooted. The default buffer size is 8192 bytes. When the buffer is full, the older logs get overwritten by the newer ones. The size of the buffer can be increased using the command: logging buffered <size>.

Logging Monitor

By default, the log messages do not appear in the login session of a remote connection through SSH or telnet. To enable logging to remote logins via SSH or telnet, use the command terminal monitor. The default logging severity for the command terminal monitor is debugging. To change the logging severity level of a remote login session, use the command logging monitor <level>.

Logging messages can be disabled from a vty login session using the command terminal no monitor.

Logging Synchronous

By default, logging messages in a login session are displayed in the console session or VTY session as soon as they are generated. This can be a nuisance as the log messages distract a user who is typing at the command line from a console or VTY session as the log messages get displayed inline. The command logging synchronous [level <severity-level>|all] | limit <0-2147483647> enables synchronous logging of messages; where log messages are displayed at the login session but a new line is created for the logging messages so the logging messages do not appear in the middle of a typing session; the command being typed is placed into a new line below the displayed log message. The optional values:

  • level: indicates that messages with a severity level equal to or lower are printed asynchronously. The default is 2.
  • limit: specifies the number of buffers to be queued for the terminal after which new messages are dropped. The default is 20.

Logging Flash

Logs can be stored as files on flash memory. This is accomplished using the command logging file flash:<file-name> <max-file-size> <min-file-size> <severity-level> where:

  • The maximum file size is in the range 4096 - 2147483647 bytes.
  • The default size is 4096.
  • The minimum file-size is in the range 1024 - 2147483647 bytes.
  • The severity-level is in the range 0 - 7.
The command logging file flash:log_message.txt 40960 4096 3 stores log messages in a file in a flash memory.

Debug

Debugging is a powerful tool for troubleshooting complex network issues. It displays detailed information about all events in real-time. Use the debug command with caution on production networks as it is a resource intensive tool and may impact operations. Debugging can disrupt operations under high-CPU load conditions because it is processed by the CPU.

Best practices when using debugging include the following:

  • show process cpu sorted: helps understand current CPU utilization. If the router is already loaded, debugging may impact the router.
  • Consider output volume and time before enabling debug. If output is voluminous, this may impact router performance.
  • Excessive console logging can cause the network device to hang as its CPU prioritizes this output. Use vty terminal monitor or logging buffered instead.
  • Disable debug commands after troubleshooting using no debug all or undebug all.

Debugging messages can be enabled using the command debug <command>. The debugging messages can then be sent to a logging service, in this case the console using the command logging console.

Debug using IP Access Lists

Debugging by referencing an IP ACL allows debugging information that matches a configured IP access control list.

access-list 100 permit ip any 192.168.1.1 0.0.0.0
debug ip packet 100

Any debugs that do not match the access control list are not logged.

Conditional Debugs

Conditional debugs generate detailed information about a specific object such as matching a specific interface, username, MAC address, VLAN, etc. Conditional debugs limit the number of debugging messages punted to the CPU. Conditional debugs are configured using the command debug condition <interface>. Conditional debugs can be stacked as such that the debugging messages that are displayed match all conditions in the stack.

debug condition gigabitethernet1/0
debug condition ip 192.168.1.1
debug ip ospf hello

The above configuration will generate debug messages if they match all three commands.

To log debug messages for packets matching an ACL and specific interface: debug interface <interface-id>. Verify with show debug.

With conditional debugs, you can attach an access-list to filter debug traffic to permitted traffic in the access-list.

Verification

show debug

To view the debugging messages, use the command show debug. After disabling the debug, ensure that the debug condition is disabled as well.

Syslog

Logs generated by a device can be sent to the logging buffer whose size can be modified, or an off-box syslog collector. Syslog listens for log messages on UDP port 514. Syslog is the standard for computer message logging. It allows the separation of software which generates messages from the systems that store it and the software that analyzes and reports it. It can be used for the security auditing and system management, debugging messages and analysis. The syslog is supported by a wide range of devices, including routers and receivers over multiple platforms. The syslog is used to integrate the log data from many various types of systems into the central repository.

A rate-limit can be configured for syslogs to limit the rate of messages per second.

The syslogs can be forwarded to a syslog server using the following process

  1. Specify the syslog server: logging host <ip-address>.
  2. Specify the type of messages: the message type to be logged is specified using the command logging trap <severity>.

Filtering Logs

Logging Discriminator

A logging discriminator can be used to filter generated logs based on the text in the log. Log discriminators can be used to filter out specific logs that are repeatedly generated consuming the device log buffer. Some logs have a high severity level but are not so consequential such as up-down messages. It can be applied to the console, monitor, buffer or syslog server.

When creating a log discriminator, be as specific as possible and test the discriminator extensively before deploying it in a production environment. This will minimize the risk of filtering important messages.

To configure a logging discriminator:

  1. Configure the logging discriminator name and filtering options using the command logging discriminator <discriminator-name> <facility> <mnemonics> <message-body> <includes> <severity> <rate-limit> where:
    • facility: (Optional) Message sub-filter for the facility pattern in an event message.
    • mnemonics: (Optional) Message subifilter for the mnemonic pattern in an event message.
    • msg-body: (Optional) Message sub-filter for the msg-body pattern in an event message.
    • drops: Drops messages that match the pattern, including the specified regular expression.
    • includes: Delivers messages that match the pattern, including the specified regular expression string.
    • string: (Optional) Expression used for message filtering.
    • severity: (Optional) Message sub-filter by severity level or group.
    • sev-num: (Optional) Integer that identifies the severity level or multiple levels. Multiple levels must be separated with a comma (,)/
    • rate-limit: (Optional) Specifies a number of messages to be processed within a unit of time.
    • msglimit: (Optional) Integer in the range of 1 to 10000 that identifies the number of messages not to be exceeded.

    logging discriminator msg-body drops Configured from console by console

  2. Application:
    • To apply the logging discriminator to the console, use the command logging console discriminator <discriminator-name>
    • To apply the logging discriminator to the monitor, use the command logging monitor discriminator <discriminator>.

Verification

Configured logging settings can be viewed using the command show logging.

Timestamps

Timestamps are controlled by the service timestamps command. This command by itself enables the adding of timestamps to debug messages and, by default, sets the timestamps to uptime.

Having logs and debug messages timestamped is extremely important when troubleshooting particularly across different devices. To enable timestamps on logging and debug messages:

  • Debugging messages: the command service timestamps debug datetime msec adds timestamps to debug messages including milliseconds. The datetime option includes the date and the time.
  • Log messages: the command service timestamps log datetime msec adds the timestamps to logging messages. Options include:
    • datetime: This option alone enables the date (day of month and month) and time(hours, minutes and seconds). Additional options include:
      • localtime: use the local timezone for timestamps.
      • msec: include milliseconds in the timestamp.
      • show-timezone: add timezone information to the timestamp.
      • year: include the current year in the timestamp.
    • uptime: does not include additional options as does datetime.

Sequence Numbers

Sequence numbers can be added to log messages based on the time that they were generated. The sequence numbers increment from 1, 2, onwards. If there is more than one log message with the same time stamp, you can display messages with sequence numbers to view these messages. By default, sequence numbers are not added to log messages. Sequence numbers can be added to log messages using the command service sequence-numbers. When enabled, they are prepended to the log message appearing at the start of a log message.

Monday, 1 March 2021

IPv6 First Hop Security

Introduction and Overview

As IPv4 public addresses get depleted, the number of IPv6 deployments has increased exponentially. This exponential increase in the adoption of IPv6 can also be attributed to introduction of Internet of Things (IoT).

With all these devices gaining access to networks, security concerns are growing in IPv6 deployments. It is important that these IPv6 deployments are secured for optimum operation of these networks. A critical part of the network that needs to be considered when implementing security mechanisms is at the local links (Layer 2) where hosts are connected to the network.

First hop is the network segment between the end hosts and their default gateway i.e., the access layer. Security at the first hop aims to prevent against internal threats at the access layer such as a man-in-the-middle(MiM) attack. In IPv4, security at the access layer is implemented through DHCP snooping, IP source guard and dynamic ARP inspection. Most IPv6 first-hop security features are implemented on a layer 2 device(switch).

In IPv6, ICMPv6 ND/NDP replaces IPv4 ARP. ARP uses two messages: request and reply. With ICMPv6 ND uses four messages:

  1. Neighbor Solicitation (NS): a device requests for information about a neighbor.
  2. Neighbor Advertisement (NA): a device advertises its information to other neighbors.
  3. Router Solicitation (RS): a device requests for information about local routers i.e., routers in the network segment.
  4. Router Advertisement (RA): a device advertises itself as an active router.

When a host is added to a network:

  1. The host chooses a link-local address; usually FE80::/10 for the network segment of the address. The host segment of the address is generated using EUI-64.
  2. The host then checks to confirm that the link-local address is unique by sending an NS on the local link to the solicited node multicast address (FF02:0:0:0:0:1:FF00::/104 + 24 low-order bits from the EUI-64). If no response is received for the NS, then the link-local address is confirmed as unique.
  3. The host then sends a NA to the "all hosts multicast address" FF02::1 (similar to 255.255.255.255 in IPv4) announcing itself as a host.
  4. Router discovery is then attempted by sending RS messages to FF02::2 (all routers multicast address).
  5. A local router replies with RA that contains the router's IPv6 address and MAC address along with prefix information for SLAAC.
  6. The host chooses a global prefix for SLAAC where the address is generated using the RA advertised prefix and EUI-64 for the host part of the address. The host performs DAD to verify that the global prefix address is unique. If unique, the host sends a NA for the global prefix.

IPv6 First Hop Attack Surface

IPv6 features such as ICMPv6 Neighbor Discovery’s Neighbor Solicitation (NS), Neighbor Advertisement (NA) messages and Router Discovery Router Solicitation (RS) and Router Advertisement (RA) introduce attack options that were previously not possible in IPv4. IPv6 first hop security concerns on the local links are usually associated with router discovery, neighbor discovery, duplicate address detection(DAD), stateless address autoconfiguration(SLAAC) and DHCPv6.

This process presents several attack surfaces that can be exploited in some of the following ways:

  • Spoof the router: a rogue device can send gratuitous RA to announce itself as the router. Spoofing the router is a MiM attack or a basic DoS attack
  • Spoof DHCPv6 server: a rogue device can respond with bogus DHCPv6 messages. Spoofing the DHCPv6 server is a form of DoS attack or MiM if it is combined with RA spoofing.
  • Poison the router's ND cache: a rogue device can send gratuitous NA messages with other device's addresses. Poisoning the router's ND cache is a MiM or DoS attack.
  • Overload the router's ND cache: a rogue device sends packets to the entire /64 prefix range. This results in the DoS attack as router is overwhelmed trying to respond with NS messages.

RA Guard

Router discovery is a means for hosts to locate routers that reside on a local link. Security concerns with router discovery include attacks on ICMPv6 Router Discovery (RD) and host address allocation using SLAAC (Stateless Address Autoconfiguration). RD attacks are categorized as man-in-the-middle attacks.

Attack

One of the several ways that an RD attack may take place follows this sequence:

  • Host A sends a Router Solicitation (RS) message on its local link to discover local routers connected to its link.
  • A legitimate router R1 responds with a Router Advertisement (RA) with lifetime X to the RS from Host A. Host A installs R1 as its default gateway for duration X.
  • An intruder Rx inserts itself in the local link by connecting to one of the switchports on the local link switch or connecting to the wireless network common to R1 and Host A. Rx can then spoof R1’s RA messages and sends R1’s RA messages with a shorter lifetime Y.
  • When duration X is about to elapse, Host A request a renewal of the prefix lease.
  • Rx then sends new RA messages with lifetime Z. Host A will receive these RA messages and install Rx as its default gateway.
  • Host A starts to direct traffic to remote networks through Rx as its gateway. Rx can then monitor traffic from Host A.
  • The above sequence of events is an example of a man-in-the-middle (MiTM) attack on IPv6 local links.

    IPv6 RA Guard

    Router advertisements should enter a network through an authorized switchport and from an authorized source. RA Guard protects against router spoofing and prefix spoofing on the segment. This is accomplished by blocking or rejection of rogue or unwanted router advertisements that are received on certain ports.

    Deploying RA Guard involves configuration of a policy and attaching the policy to a specific VLAN or switchport. Traffic is permitted on the ports that comply with the policy and blocked/dropped on non-compliant ports.

    Configuration

    When configuring RA Guard policies, device roles are specified for each of the ports that the policy will be applied. The configurable device roles include:

    • host: attached device is a end-user host device. In host mode, all RA redirect messages are disallowed on the port.
    • router: attached device is a router. RA and RS messages are to be expected from this port. Additionally, switchports with routers can be configured as trusted ports.
    • monitor: for attached devices that have network monitoring features or are network sniffers.
    • switch: attached device is a switch.

    When configuring RA Guard, two policies are usually configured; one policy for ports where routers are attached and a separate policy for ports where hosts are attached.

    1. Configure the RA Guard Policy:

      Defining a policy for hosts:

      1. Define the RA guard policy: ipv6 nd raguard policy <policy-name>

        SW1(config)#ipv6 nd raguard policy HOSTS

      2. Specify the device role: The device role can be host or router: device-role host.

        SW1(config-nd-raguard)#device-role host

      Creating a second policy for routers:

      1. Define the RA guard policy: ipv6 nd raguard policy <policy-name>

        SW1(config)#ipv6 nd raguard policy ROUTERS

      2. Specify the device role: The device role is router: device-role router.

        SW1(config-nd-raguard)#device-role router

      3. Configure the port as trusted: trusted-port

        SW1(config-nd-raguard)#trusted-port

      4. Enable of O flag/bit: other-config-flag on. The O bit indicates to the client additional information is to be extracted from another source such as a DHCP or DNS server.

        SW1(config-nd-raguard)#other-config-flag on

      5. All optional features are bypassed if not configured. They include:

        • hop limit <maximum | minimum> <number>: (Optional) Enable verification of advertised hop count limit.
        • managed-config-flag <on | off>: (Optional) Enable verification that the advertised managed address configuration flag is on.
        • match ipv6 access-list alc
        • match ra prefix-list ipv6_prefix_list: (Optional) Verification of the advertised prefixes in inspected messages from configured prefix-list.
        • other-config-flag <on | off> : (Optional) Verification of advertised other-config parameter
        • router-preference maximum < high | low | medium > : (Optional) Verification that the advertised default router preference parameter value is lower than or equal to a specified limit
        • match ipv6 access-list <acl>: (Optional) Enable verification of the sender’s IPv6 address in inspected messages from the configured authorized device source access-list

    2. Apply the RA Guard policy to the switchport or VLAN:
      • VLAN:

        SW1(config)#vlan configuration 1
        SW1(config-vlan-config)#ipv6 nd raguard attach-policy HOSTS

      • interface: Apply IPv6 RAGuard feature to a specified interface using the command ipv6 nd raguard attach-policy <policy-name> [vlan <add|except|none|remove|all> vlan <vlan1, vlan2 … vlan n>]

        SW1(config)#interface g0/0
        SW1(config-if)#ipv6 nd raguard attach-policy ROUTERS

    Verification

    The following commands verify RA Guard configuration and operation:

    • show ipv6 snooping policies: RA guard will appear as one of the snooping policies configured
    • show ipv6 nd raguard policy <policy-name>
    • debug ipv6 snooping raguard <filter | interface | vlanID>
    • show ipv6 snooping capture-policy interface <interface-id>: for configured interfaces

    Restrictions for IPv6 RA guard

    • IPv6 RA guard does not offer protection when IPv6 traffic is tunneled.
    • RA guard is supported on hardware when the TCAM is programmed.
    • RA Guard can be configured on a switchport interface in the ingress direction.
    • Supports host and router mode.
    • Not supported in etherchannel and etherchannel port members.
    • Not supported on trunk ports with merge mode.
    • Is supported on auxiliary VLANs and private VLANs (PvLANs). Primary VLAN features are inherited and merged with port features.
    • Packets dropped by IPv6 RA guard can be spanned.
    • RA guard cannot be configured if the following command is configured platform ipv6 acl icmp optimize neighbor-discovery

    SLAAC

    SLAAC is a mechanism that enables an IPv6 host to obtain an IPv6 address prefix from its local router through one of its local links without the use of all DHCPv6 features. Unlike DHCPv6, due to the stateless nature of SLAAC, address assignments are not verified before addresses are issued.

    Steps involved in a SLAAC attack:

    1. Host A sends a Router Solicitation (RS) message on its local link to discover local routers connected to its link.
    2. A legitimate router R1 responds with a Router Advertisement (RA) that provides the IPv6 prefix. 2001:DB8:C0FF:EE::/64 with lifetime X.
    3. Host A configures the address 2001:DB8:COFF:EE::2/128 and checks the availability of the address using Duplicate Address Detection (DAD) and begins using this address.
    4. An intruder Rx inserts itself in the local link by connecting to one of the switchports on the local link switch or connecting to the wireless network common to R1 and Host A. Rx can then spoof R1’s RA messages and sends R1’s RA messages with a shorter lifetime Y.
    5. Host A’s IPv6 address will then expire at the lapse of duration Y.
    6. Rx can then send a new RA with a new prefix 2001:DB9:COFF:EA::/64.
    7. Upon receiving the new prefix, Host A will configure the address 2001:DB9:COFF:EA::09/128 with R1 still being retained as the default gateway. R1 may block Host A’s network traffic due to the fact that it is from an unknown network.
    8. R1 may drop Host A’s traffic resulting in black-holing all network traffic from Host A.

    DHCPv6 Guard

    DHCPv6 assigns hosts IPv6 prefixes and other configuration options. DHCPv6 is both a stateful and stateless protocol. A rogue DHCPv6 server could be inserted into a network. The attackers can then deploy man-in-the-middle attacks ,traffic interception or blackhole traffic.

    DHCPV6 Attacks

    DHCPv6 does not assign a default router like DHCP in IPv4 environments. Th default router is learned through SLAAC from RA messages.

    DHCPv6 Guard prevents the spoofing of the DHCPv6 server by blocking DHCPv6 messages that come from unauthorized / rogue DHCPv6 servers and relay agents. Client messages or messages sent by replay agents from clients are not blocked. When implementing DHCPv6 Guard, devices are categorized as server and client. DHCPv6 server messages are only processed if the device role is set to server.

    Configuration

    The configuration of the DHCPv6 Guard is similar to that of the RA Guard. A DHCPv6 Guard policy is configured for the DHCPv6 clients and a separate policy for the servers. The policy is then applied to a VLAN or interface.

    1. Configure the DHCPv6 policy:

      Policy for servers:

      1. SW1(config)#ipv6 dhcp guard policy SERVERS
        SW1(config)#device-role server
        SW1(config)#trusted-port

        Additional configuration options exist for attached DHCPv6 servers:

        • Authorized DHCPv6 servers: DHCPv6 messages can be permitted to be transmitted if they originate from authorized DHCPv6 servers. To enable this feature:
          1. Configure an IPv6 access control list with the IPv6 addresses of the authorized DHCPv6 servers: ipv6 access-list <acl-name> permit host <ipv6-address> 128.
          2. Enable verification of the advertised DHCP server and relay address in inspected messages from the configured authorized server ACL. An empty ACL is treated as a permit. match server access-list <acl-name>.
        • IPv6 Addresses in Authorized Range: DHCPv6 Guard can be configured to permit DHCPv6 advertised prefixes are in the permitted IPv6 range:
          1. Create an entry in an IPv6 prefix-list; ipv6 prefix-list <prefix_list_name> permit <ipv6_prefix> 128.
          2. Enable verification of advertised prefixes in DHCP reply messages from the configured authorized prefix-list. An empty ACL is treated as a permit.

      Policy for clients:

      1. SW1(config)#ipv6 dhcp guard policy CLIENTS
        SW1(config)#device-role client

      Other optional DHCPv6 features include:

      • preference min limit : Enable verification that the advertised preference (in preference option) is greater than the specified limit
      • preference max limit : Enable verification that the advertised preference is less than the specified limit

    2. Apply the DHCPv6 Guard policy:
      1. Interface:

        SW1(config)#interface g0/0
        SW1(config-if)#ipv6 dhcp guard attach-policy SERVERS

      2. VLAN:

        SW1(config)#vlan configuration 1
        SW1(config-vlan-config)#ipv6 dhcp guard attach-policy CLIENTS

    Verification

    The operational state of DHCPv6 Guard can be verified using these commands:

    • show ipv6 dhcp guard policy <policy-name>.
    • show ipv6 snooping policies.

    Restrictions

    DHCPv6Guard is not supported on etherchannel ports.

    Binding Table

    The binding table is a database of IPv6 neighbors connected to a device and is created from informational sources such as ND snooping, DHCP gleaning. It contains information such as the link-layer address, the IPv4 or IPv6 address, and the prefix binding i.e., it can be considered to be a mapping of layer 2 addresses to IPv6 addresses. It is used by various IPv6 guard features to prevent spoofing and redirect attacks.

    The binding table supports features that can be leveraged to provide first hop security:

    • Limits can be set for the number of IPv6 addresses that a MAC address can have.
    • The binding table recovery mechanism feature enables the binding table to recover in the event of a device reboot. The recovery mechanism will block any data traffic sourced from an unknown source (a source that is not in the binding table).
    • The binding table introduces the capacity to provide a prefix-list that is matched before the recovery is attempted for both DHCP and NDP. If an address does not match the prefix-list associated with the protocol, the recovery of the binding table entry will not be attempted with that protocol.

    IPv6 Snooping

    IPv6 snooping bundles several IPv6 first-hop security features such as ND inspection, IPv6 device tracking, IPv6 address glean, IPv6 binding table recovery. IPv6 ND inspection operates at Layer 2 or between Layer 2 and Layer 3. IPv6 snooping mitigates vulnerabilities in the ICMPv6 ND mechanisms for example attacks on DAD, address resolution, device discovery and neighbor cache/table. IPv6 snooping learns and secures binding for SLAAC addresses in Layer 2 neighbor tables and analyses ND messages in order to build a trust binding table. An ND message is considered trustworthy if its IPv6-to-MAC mapping is verifiable. The IPv6 first-hop security binding table recovery mechanism enables the binding table to recover in the event of a device reboot.

    The binding table is a database of IPv6 neighbors connected to the device and is created from sources such as ND snooping. It is used by various IPv6 guard features to validate link-layer addresses, IPv4 or IPv6 addresses prefix-binding of neighbors to prevent spoofing and redirect attacks.

    Configuration

    To configure an IPv6 snooping policy;

    1. Configure the snooping policy:

      SW(config)#ipv6 snooping policy SNOOP_POLICY

    2. Attach the snooping policy to an interface:

      SW(config)#interface g0/0
      SW(config-if)#ipv6 snooping attach-policy SNOOP_POLICY

    Verification

    • show ipv6 snooping capture-policy interface <interface_number>: To display snooping ND messages and capture policies
    • show ipv6 snooping counter interface <interface_name_number> : To display information about the packets counted by the interface counter
    • show ipv6 snooping features : To display information about snooping features configured on a device
    • show ipv6 snooping policies : To display information about configured policies and interfaces that they are attached to
    • debug ipv6 snooping : Debugging of IPv6 snooping information

    Restriction

    IPv6 snooping is not supported on etherchannels.

    Source Guard

    If a device starts transmitting on a network segment without IPv6 host discovery messages such as NS, NA, DHCPv6 message exchange, source guard enables the switch to drop such traffic from an unfamiliar IPv6 source address.

    IPv6 source guard relies on IPv6 snooping cache to create the IPv6 neighbor binding table. It creates an automatic IPv6 port ACL(PACL) to filter sources based on neighbor binding table.

    Configuration

    1. Configure the source guard policy:

      SW(config)#ipv6 source-guard policy SG_POLICY
      SW(config-sisf-sourceguard)#permit link-local
      SW(config-sisf-sourceguard)#deny global-autoconf
      SW(config-sisf-sourceguard)#trusted

    2. Apply the configured source guard policy to the VLAN or interface:
      • On the VLAN:

        SW(config)#vlan configuration 1
        SW(config-vlan-config)#ipv6 source-guard attach-policy SG_POLICY

      • On the interface:

        SW(config)#interface g0/0
        SW(config-if)#ipv6 source-guard attach-policy SG_POLICY

    Verification of Source Guard

    The following command is used to verify IPv6 source guard: show ipv6 snooping policies.

    Neighbor Discovery Attacks

    Similar to RA messages ND messages are used to discover other hosts on the local link. It replaces ARP in IPv6. ND performs DAD and address resolution, neighbor unreachability and redirection. Neighbor discovery messages are mainly Neighbor Solicitation (NS) and Neighbor Advertisement (NA). ND Attacks usually involve Address Resolution, Duplicate Address Detection and Neighbor Cache attacks.

    Address Resolution Attacks

    Address resolution is the process that a host (Host A) follows when it wants to send network traffic to another host (Host B) on the local link when it does not know its Layer 2 address (MAC address in Ethernet networks). Host A resolves the IPv6 address of Host B into a MAC address and forwards the packet with Host B’s MAC address as the destination address of the Layer 2 frame.

    Stages in IPv6 address resolution attacks include the following;

    1. Host A sends a Neighbor Solicitation message on the local link requesting for Host B’s link local address. Host B sends a Neighbor Advertisement (NA) message on the local link containing its MAC address which Host A stores in its neighbor table binding the MAC address with the IPv6 address.
    2. If a malicious Host X inserts itself into the local network, it can masquerade as Host B and intercept all packets sent to Host B. Without effective IPv6 first-hop security, Host X can perform a Man-in-the-Middle (MiTM) attack.
    3. Host A will attempt to send packets destined to Host B but using Host X’s link-layer address.

    Duplicate Address Detection Attacks

    Duplicate Address Detection (DAD) is an IPv6 protocol that enables a host to detect a duplicate address on the local network. DAD attacks are usually aimed at preventing hosts from having IPv6 addresses. Steps involved in deploying a DAD attack;

    1. Host A wants to use the address 2001:DB8:C0FF:EE::1. So it sends an NS message on its local link to determine if any other host is using this address. If no NA response is received from other hosts on the local link, Host A will go ahead to use this address.
    2. However, malicious host Host X which has inserted itself on the local link receives this NS message. It responds with an NA claiming that it is currently using that same address 2001:DB8:C0FF:EE::1 yet it does not actually use this address.
    3. Host A sends another NS message requesting to use another IPv6 address 2001:DB8:C0FF:EE::A. Host X again claims that this address is already taken. Host X essentially claims all addresses that Host A requests to use thereby preventing Host A from having a valid IPv6 address.

    Neighbor Cache Attacks

    When performing address resolution after receiving IPv6 an NA response to an NS request, a host stores the MAC address to IPv6 address binding in its neighbor table/cache. If many hosts reside on the local link, the neighbor table can grow large in size. In IPv6, the interface identifier is 64-bits long. There could be as many as 264 potential number of hosts on the link resulting in potentially 264 neighbor table entries. With IoT devices prevalent these possibilities become close to reality.

    A malicious host (Host X) can attempt to fill up the neighbor cache / table of another host or router resulting in a DoS condition.

    Step 1: Malicious Host X sends packets to all potential addresses in its local link. The local router R1 will attempt to resolve the IPv6 addresses in order to forward the frames to them. For hosts whose addresses are not yet resolved, R1 will create an incomplete cache entry for a few seconds as it awaits a response that is never received. This entry eventually times out.

    However, if Host X sends many such packets fast, it could fill up the R1 neighbor table resulting in a DoS condition.