Saturday, December 6, 2014

Notes: Configuring HSRP

Configuring HSRP on Catalyst 3560 IOS Software Release 12.2(52)SE.

HSRP Versions


HSRPv1 - Version 1 is the default version of HSRP. It has the following features:
  • The HSRP group number range is from 0 to 255.
  • HSRPv1 uses the multicast IP address 224.0.0.2.
  • HSRPv1 and CGMP are mutually exclusive.

HSRPv2 - Version 2 has these features:
  • extends the group number range to 0-4095 (group number can match all VLAN IDs)
  • virtual MAC address from 0000.0C9F.F000 to 0000.0C9F.FFFF
  • uses the multicast IP address 224.0.0.102
  • HSRPv2 and CGMP are not mutually exclusive, both can be enabled at the same time
  • HSRPv2 has different packet format than HSRPv1

Default HSRP Configuration

  • HSRP version: Version 1
  • HSRP groups: None configured
  • Standby group number: 0
  • Standby MAC address: System assigned as 0000.0C07.ACxx, where xx is the HSRP group number
  • Standby priority: 100
  • Standby delay: 0 (no delay)
  • Standby track interface priority: 10
  • Standby Hellotime: 3 seconds
  • Standby Holdtime: 10 seconds

HSRP Configuration Guidelines

  • HSRP for IPv4 and HSRP for IPv6 are mutually exclusive, both cannot be enabled simultaneously.
  • HSRPv1 and HSRPv2 are mutually exclusive. HSRPv2 is not interoperable with HSRPv1 on an interface and the reverse.
  • Support up to 32 instances of HSRP groups.
  • The interface must be a Layer 3 interface, either a router port or an SVI.
  • All Layer 3 interfaces must have IP addresses assigned.
  • Configure only on instance of an FHRP.
  • The HSRP version can be changed from HSRPv2 to HSRPv1 only if the group number is less than 256.
  • For HSRPv2 and HSRP for IPv6, group numbers that are multiples of 256 must be used; valid ranges are 0 to 255, 512 to 767, 3840 to 4095, and so on.
  • If the HSRP version is changed on an interface, each HSRP group resets because it now has a new virtual MAC address.


Enabling HSRP


standby version {1 | 2}
  • (Optional) Configures the HSRP version on the interface.
  • 1 for HSRPv1, 2 for HSRPv2.
  • If not specified, the interface runs HSRPv1 by default.

standby [gp-num] ip [ip-add]
  • (Optional) [gp-num] specifies the group number for which HSRP is enabled.
  • (Optional on all but one interface) [ip-add] sets the virtual IP address for the HSRP group. Must be set on at least one interface, can be learned by other interfaces.

Example
standby version 1
standby 47 ip 10.0.47.1



Configuring HSRP Priority

  • The standby priority, standby preempt, and standby track commands are used to set characteristics for finding the active and standby routers.
  • Assigning a priority allows allows the active and standby routers to be manually defined.
  • If preemption is enabled, the router with the highest priority becomes the active router.
  • If priorities are equal, the current active router does not change.
  • The highest numerical value (1 to 255) represents the highest priority (most likely to become the active router).
  • The priority can change dynamically if an interface is tracked, and the status goes down.
  • By default, the priority is decreased by 10.
  • If an interface is not tracked, its state change does not affect the priority.
  • When multiple tracked interfaces are down, the configured priority decerements are cumulative.
  • If tracked interface were not configured with a decrement priority, the default decrement is 10, and it is non-cumulative.
  • When routing is first enabled for the interface, it does not have a complete routing table. If it is configured to preempt, it becomes the active router, even though it is unable to provide adequate routing services. To solve this problem, configure a delay time to allow the router to update its routing table.

standby [gp-num] priority [value] preempt
  • Sets a priority value used in choosing the active router.
  • (Optional) [value] The range is 1 to 255 (100 by default), the highest number represents the highest priority.
  • (Optional) preempt, so that when the local router has a higher priority than the active router, it assumes control as the active router.

standby [gp-num] track [int-num] [int-prio]
  • Configures an interface to track another interface so that if it goes down, the priority is lowered.
  • [int-num] is the interface identifier of the tracked interface.
  • (Optional) [int-prio] specifies the amount by which the priority is decremented, when the interface goes down (10 by default).

Example
standby 47 priority 150 preempt
standby 47 track GigabitEthernet0/0 60



Configuring HSRP Authentication and Timers

  • The authentication string is sent unencrypted in all HSRP messages.
  • The same authentication string must be configured on all routers.
  • Authentication mismatch prevents a device from learning the virtual IP address, and timer values from other routers.
  • Routers on which timer values are not configured can learn timer values from the active or standby router.
  • The timers configured on an active router always override any other timer settings.
  • All routers in an HSRP group should use the same timer values.
  • Normally, the Holdtime is greater than or equal to 3 times the Hellotime.

standby [gp-num] authentication [string]
  • (Optional) [string] sets the authentication string to be carried in all HSRP messages, up to eight characters in length (the default is cisco).

standby [gp-num] timers [Hello] [Hold]
  • Configures the time between Hello packets and the time before other routers declare the active router to be down.
  • [Hello] sets the Hello interval in seconds, the range is from 1 to 255 (3 by default).
  • [Hold] sets the time in seconds before th active or standby router is declared to be down, the range is from 1 to 255 (10 by default).

Example
standby 47 authentication hsrpstring
standby 47 timers 5 15



Verification


Applied the following configuration.

SW01#
interface Vlan47
 ip address 10.0.47.101 255.255.255.0
 standby version 2
 standby 47 ip 10.0.47.1
 standby 47 priority 150
 standby 47 preempt

SW02#
interface Vlan47
 ip address 10.0.47.102 255.255.255.0
 standby version 2
 standby 47 ip 10.0.47.1



Verying the configuration.

SW01#show standby brief
                     P indicates configured to preempt.
                    
Interface   Grp  Pri P State    Active          Standby         Virtual IP
Vl4         47   150 P Active   local           10.0.47.102     10.0.47.1  

SW02#show standby brief
                     P indicates configured to preempt.
                    
Interface   Grp  Pri P State    Active          Standby         Virtual IP
Vl4         47   100   Standby  10.0.47.101     local           10.0.47.1 


SW01#show standby
Vlan47 - Group 47 (version 2)
  State is Active
    5 state changes, last state change 00:04:48
  Virtual IP address is 10.0.47.1
  Active virtual MAC address is 0000.0C9F.F02F
    Local virtual MAC address is 0000.0C9F.F02F (v2 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.086 secs
  Preemption enabled
  Active router is local
  Standby router is 10.0.47.102
  Priority 150 (configured 150)
  Group name is hsrp-Vl4-47 (default)

SW02#show standby
Vlan47 - Group 47 (version 2)
  State is Standby
    3 state changes, last state change 00:07:06
  Virtual IP address is 10.0.47.1
  Active virtual MAC address is unknown
    Local virtual MAC address is 0000.0C9F.F02F (v2 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.739 secs
  Preemption disabled
  Active router is 10.0.47.101

  Standby router is local
  Priority 100 (default 100)
  Group name is hsrp-Vl4-47 (default)


As a bonus, proof that the HSRPv2 devices are communicating using the multicast IP address 224.0.0.102.

SW01#debug ip packet
IP: s=10.0.47.102 (Vlan47), d=224.0.0.102 len 29, rcvd 2

SW01#
IP: s=10.0.47.101 (local), d=224.0.0.102 (Vlan47), len 29, sending broad/multicast


References

Configuring HSRP

Notes: Understanding HSRP

Background Information

  • HSRP, which is unique to Cisco platforms, provides network redundancy for IP networks.
  • Ensures that user traffic immediately and transparently recovers from first-hop failures.
  • Two or more routers act as a single virtual router by sharing an IP address and a MAC address.
  • End hosts do not typically contain a routing table and use only a single next-hop IP address (the
    default gateway).
  • The default gateway is configured as the virtual IP address.
  • HSRP routers continually exchange status messages.
  • One router can assume the responsibility of another, if a router fails for either planned or unplanned reasons.
  • The changeover is transparent to end hosts.
  • Windows hosts can be configured to run multiple default gateways, but they are not dynamic (only a single default gateway is used at a time).
  • The system only selects an additional configured default gateway at boot time if the first configured default gateway is determined unreachable by Internet Control Management Protocol (ICMP).

Basic Operation

  • Two or more HSRP routers work in concert to present the illusion of a single default gateway.
  • This set of routers is known as an HSRP group or standby group.
  • One router (the active router) is selected from the group to forward packets sent to the virtual IP address.
  • Another router is selected as the standby router.
  • If the active router fails, the standby router assumes its role.
  • Only the active and standby routers send periodic HSRP messages after the election process is completed.
  • Additional routers in the HSRP group remain in the Listen state.
  • If the standby router fails or becomes the active router, another router is elected as the new standby router. 
  • Each standby group emulates a single virtual router (default gateway).
  • A single well-known MAC and IP address is allocated to each group.
  • Multiple groups can coexist and overlap on a LAN.
  • Individual routers can participate in multiple groups.
  • The router maintains a separate state and timers for each group.

HSRP Terms

  • Active router: The router that currently forwards packets for the virtual router. 
  • Standby router: The primary backup router. 
  • Standby group: The set of routers that participate in HSRP and jointly emulate a virtual router. 
  • Hello time: The interval between successive HSRP hello messages from a given router. 
  • Hold time: The interval between the receipt of a hello message and the presumption that the sending router has failed.

HSRP Router Communication

  • HSRP routers communicate by exchanging HSRP information through HSRP hello packets.
    HSRP uses the destination multicast IP address 224.0.0.2 on UDP port 1985.
  • The active router sources hello packets from its configured IP address and the HSRP virtual MAC address.
  • The standby router sources hello messages from its configured IP address and the burned-in MAC address (BIA).
  • The virtual MAC address is 0000.0c07.acxx, where xx is the HSRP group number.
  • When an HSRP group number is not specified, the default group number is 0.

HSRP Features


Preemption
The feature enables the router with the highest priority to immediately become the active router.
Preference is determnined first by the highest priority value configured (default 100), and then by the highest IP address.

When a higher priority router preempts a lower priority router, it sends a coup message. When a lower priority active router receives a coup message or hello message from a higher priority active router, it changes to the speak state and sends a resign message.

Preempt Delay
The feature allows preemption to be delayed for a configurable time period, allowing the router to populate its routing table before becoming the active router.

Interface Tracking
HSRP monitors the status of another interface in order to alter the HSRP priority for a given group. If the specified interface's status goes down, the HSRP priority of a router is reduced, allowing another HSRP router higher priority to become active (if preemption is enabled).

When multiple tracked interfaces are down, the priority is reduced by a cumulative amount. If the decrement value is not specifically set, the priority value is decreased by 10 for each interface that goes down.

Use of BIA
The feature allows HSRP groups to use an interface's burned-in MAC address instead of a virtual MAC address (some hardware only recognize a single MAC address).

Several disadvantages:
  • When a router becomes active, the virtual IP address is moved to a different MAC address. The newly active router sends a gratuitous ARP response, but not all host implementations handle the gratuitous ARP correctly.
  • Proxy ARP breaks when use-bia is configured. A standby router cannot cover for the lost proxy ARP database of a failed router. 
  • Problems related to specific IOS versions: prior to Cisco IOS release 12.0(3.4)T, only one HSRP group is allowed if use-bia is configured, or prior to Cisco IOS release 12.0(6.2), the use-bia command on a subinterface actually showed up on the main interface and applied it to all subinterfaces.

Multiple HSRP Groups
The features enables load-sharing within networks, and allows redundant routers to be more fully utilized. A router can have different roles for different HSRP groups. While a router is forwarding traffic for one HSRP group, it can be in standby or in Listen state for another group.

Syslog Support
The feature allows for more efficient logging and tracking of the current HSRP status. Syslog support was added in Cisco IOS release 11.3.

HSRP Debugging
To enable HSRP debugging, use the debug standby command. The command prints output of HSRP state and packet information fro all standby groups on all interfaces.

A debug condition allows the output to be filtered upon interface and group number (debug condition standby int-num group-num). Debug conditions can be set for groups that do not exist, which allows the information capture during the initialization of a new group.

The standby debug command must be enabled to produce any output.

Enhanced HSRP Debugging
Before Cisco IOS release 12.1(0.2), HSRP debugging was of limited use because information was lost in the noise from periodic hello messages. Thus the enhanced debugging feature was added in Cisco IOS 12.1(0.2).

The following table explains the command options for enhanced debugging.



Authentication
The feature provides added security, and protects against the threat of spoofing attacks. Clear-text (default) and MD5 authentication are available.

SNMP MIB
There are two relevant MIBs for HSRP:
  • ciscoMgmt 106: The MIB module for managing HSRP
  • ciscoMgmt 107: The extension MIB module for managing HSRP

HSRP Support for MPLS VPNs
The feature is useful when a CE router is connected to two PE routers, and the default route points to the HSRP virtual IP address.


HSRP States

  • Initial: The start. Indicates that HSRP does not run. Entered through a configuration change or when an interface first becomes available.
  • Learn: The router has not determined the virtual IP address, and has not yet seen an authenticated hello message from the active router. The router still waits to hear from the active router.
  • Listen: The router knows the virtual IP address, but is neither the active router nor the standby router. The router listen for hello messages from the active and standby routers.
  • Speak: The router sends periodic hello messages and actively participates in the election of the active and/or standby router. A router cannot enter Speak state unless it has the virtual IP address.
  • Standby: The router is a candidate to become the next active router and sends periodic hello messages. There is only one router in the group in the standby state.
  • Active: The router currently forwards packets that are sent to the group virtual IP address. The router sends periodic hello messages. There is only one router in the group in the active state.

HSRP Timers

  • HSRP routers use only three timers, which time the hello messages.
  • Convergence depends on how the HSRP hello and hold timers are configured.
  • By default, the timers are set to 3 and 10 seconds, respectively.
  • A hello packet is sent between the HSRP group every 3 seconds, and the standby router becomes active when a hello packet has not been received for 10 seconds.
  • The timer values are configurable, but setting the hello timer below 1 second and the hold timer
    below 4 seconds is not recommended. 
  • If the HSRP tracking mechanism is used and the tracked link fails, the failover or preemption occurs immediately, regardless of the hello and hold timers.
  • Active timer: Used to monitor the active router. Started any time a hello packet is received from the active router. Expired in accordance with the hold time value.
  • Standby timer: Used to monitor the standby router. Started any time a hello message is received from the standby router. Expired in accordance with the hold time value.
  • Hello timer: Used to clock hello packets. Routers in Active, Standby, or Speak states generate hello messages.

Packet Format



Op Code
The Op code describes the type of message that the packet contains.
Possible values:
  • 0 - Hello (sent to indicate that the router runs HSRP and is able to become the active router)
  • 1 - Coup (sent when the router wishes to become the active router)
  • 2 - Resign (sent when a router no longer wishes to be the active router)

State
Each router in the HSRP group implements a state machine. The state field describes the current state of the router.
Individual states:
  • 0 - Initial
  • 1 - Learn
  • 2 - Listen
  • 4 - Speak
  • 8 - Standby
  • 16 - Active

Hellotime
Only meaningful in hello messages. Contains the period (in seconds) between the hello messages that the router sends.

Holdtime
Only meaningful in hello messages. Contains the amount of time (in seconds) that the current hello message should be considered valid before initiating a state change.

Priority
Used to elect the active and standby routers. Highest priority wins. In case of a tie, the highest IP address is preferred.

Group
Identifies the HSRP group.

Authentication Data
Contains a clear-text, eight-character password.

Virtual IP Address
Specifies the virtual IP address used by this HSRP group.


HSRP Events

  • 1 - HSRP is configured on an enabled interface.
  • 2 - HSRP is disabled on an interface or the interface is disabled.
  • 3 - Active timer expiry. The Active timer is set to the hold time when the last hello message is seen from the active router.
  • 4 - Standby timer expiry. The Standby timer is set to the hold time when the last hello message is seen from the standby router.
  • 5 - Hello timer expiry. The periodic timer for sending Hello messages is expired.
  • 6 - Receipt of a Hello message of higher priority from a router in Speak state.
  • 7 - Receipt of a Hello message of higher priority from the active router.
  • 8 - Receipt of a Hello message of lower priority from the active router.
  • 9 - Receipt of a Resign message from the active router.
  • 10 - Receipt of a Coup message from a higher priority router
  • 11 - Receipt of a Hello message of higher priority from the standby router.
  • 12 - Receipt of a Hello message of lower priority from the standby router.


HSRP Actions


A - Start Active Timer
The Active timer is set to the Holdtime field in the Hello message from the Active router. Otherwise set to the current Holdtime value in use by the router. The Active Timer is then started.

B - Start Standby Timer
The Standby timer is set to the Holdtime field in the Hello message from the Standby router. Otherwise set to the current Holdtime value in use by the router. The Standby timer is then started.

C - Stop Active Timer
The Active timer is stopped.

D - Stop Standby Timer
The Standby timer is stopped.

E - Learn Parameters
This action is taken when a message is received from the active router. If the virtual IP address for this group was not manually configured, it can be learned from the message. The router can also learn Hellotime and Holdtime values from the message.

F - Send Hello Message
The router sends a Hello message with its current State, Hellotime, and Holdtime.

G - Send Coup Message
The router sends a Coup message to inform the active router that there is a higher priority router available.

H - Send Resign Message
The router sends a Resign message to allow another router to become the active router.

I - Send Gratuitous ARP Message
The router broadcasts an ARP response packet advertising the group's virtual IP and MAC addresses.


HSRP State Table

Each time that an event occurs, the associated action results, and the router transitions to the next HSRP state. In the diagram, numbers designate events, and letters designate the associated action.



References

Understanding and Troubleshooting HSRP Problems in Catalyst Switch Networks
Hot Standby Router Protocol Features and Functionality
RFC 2281: Cisco Hot Standby Router Protocol (HSRP)

Saturday, November 22, 2014

FHRPs: HSRP, VRRP, and GLBP

What is this cryptic letter jargon that I've just typed in the title? Well, allow me to explain. FHRP refers to First Hop Redundancy Protocol. There are three main flavors: Hot Standby Router Protocol (HSRP), Virtual Router Redundancy Protocol (VRRP), and Gateway Load Balancing Protocol (GLBP). This post will provide a general introduction to each protocol.

Basic Operation

In essence, FHRPs are used to provide transparent gateway failover for end hosts. FHRPs enable a set of routers to work together to present the illusion of a single virtual router. This is achieved by multiple gateways sharing the same virtual IP address, and end hosts using this virtual IP address as their default gateway.

Look at the scenario below. The PCs have their default gateways set to the virtual IP address. They are basically unaware of the physical routers operating behind the scenes. The PCs only send packets towards their default gateway (the virtual IP) but they do not know which router is actually forwarding the traffic. If a router goes down, the other one will assume its role. The process is transparent and non-disruptive from the PCs' perspective.



This is the basic operation of FHRPs, but each protocol has a unique implementation.

HSRP

HSRP is a Cisco proprietary protocol, but it is also specified in RFC 2281. This means that HSRP can be implemented by other vendors, but special licensing is required. HSRP operates by electing one active router based on highest priority (100 by default, 0-255 range). The active router is responsible for forwarding packets. The other router remains in standby mode. If there are more than two routers in the HSRP group, the rest will stay in the Listen state (i.e. they know the virtual IP address and listen for Hello messages). If the active router fails, the standby router assumes its duties.

In addition to the virtual IP address, the routers in the same HSRP group share a virtual MAC address. The virtual MAC address is 0000.0C07.ACxx, where xx is the HSRP group ID. The group ID does not have to match the VLAN ID, but they are typically configured as the same value for consistency. If no group ID is specified, group ID 0 is assumed (default). The active router "owns" the virtual IP and MAC addresses. When a PC sends an ARP request for its default gateway IP address (the virtual IP), the active router will reply with the virtual MAC address.


The HSRP routers communicate by exchanging UDP-based multicast Hello packets. The Hello packets are sent in the multicast IP address 224.0.0.2 in UDP port 1985 (specific to version 1) every three seconds by default. If Hellos are not heard in ten seconds (the default HoldTime value), the active router is considered dead, and the standby router will assume its role.

Preemption is disabled by default. This means that a router will not attempt to take control as the active router, when it has a higher priority than the current active router. Note that this behavior effects the order of configuration. If preemption is not used, the active router must be configured first to guarantee that it will, in fact, become the active router. Preemption is required to successfully operate certain features (more in upcoming post about object tracking).

Because of the active/standby behavior, load balancing can only be implemented similar to STP. Load balancing is achieved by assigning different active routers for different HSRP groups (similar to STP having different root switches for different VLANs).

HSRP supports clear-text and MD5 authentication.

Other than basic IP connectivity (the routers must have individual IP addresses), the absolute minimum configuration for HSRP is to define the virtual IP address. The other parameters will then use their default values, namely, priority 100, group ID 0, and no preemption.

Example:

A#
interface vlan 10
  ip address 10.1.1.101 255.255.255.0
  standby ip 10.1.1.1

S#
interface vlan 10
  ip address 10.1.1.100 255.255.255.0
  standby ip 10.1.1.1


VRRP

VRRP has only minor differences to HSRP. The main separating factor is that VRRP is a standards-based alternative to HSRP, so it will run in multi-vendor environments. More differences include:
  • terminology: master/backup vs. active/standby
  • communication: uses its own Transport protocol 112, and multicast IP address 224.0.0.18
  • virtual IP address: can use the Master's interface IP address (HSRP requires unique physical IP addresses)
  • virtual MAC address: 0000.5E00.01xx, where xx is the VRRP group number
  • preemptive by default

Example configuration:

A#
interface vlan 10
  ip address 10.1.1.101 255.255.255.0
  vrrp 10 ip 10.1.1.1

S#
interface vlan 10
  ip address 10.1.1.102 255.255.255.0
  vrrp 10 ip 10.1.1.1

GLBP

GLBP performs similar, but not identical, to HSRP and VRRP. It is a Cisco proprietary protocol, and extends HSRP functionality to natively support load balancing. GLBP provides load balancing over multiple router using a single virtual IP address and multiple virtual MAC addresses. Contrary to HSRP and VRRP where only a single router (the active router) processes packets, all routers in a GLBP group participate in forwarding packets. GLBP members communicate with each others by sending Hello messages every 3 seconds to the multicast address 224.0.0.102, UDP port 3222.

Routers in a GLBP group operate in one of two roles: Active Virtual Gateway (AVG) or Active Virtual Forwarder (AVF). Members of a GLBP group elect one router to act as the AVG for that group. The election is based on the highest priority (range 1-255). The priority also determines the order of ascendancy to becoming an AVG if the current AVG fails. In case of a tie, the higher IP address is preferred. The remaining routers in the GLBP group assume the role of AVF. The AVG assigns a virtual MAC address for each  AVF, and each AVF is responsible for forwarding packets sent to their virtual MAC address. The AVG operates as an AVF itself. The AVG also replies to ARP requests for the virtual IP address. Up to four virtual MAC addresses per GLBP group is allowed. Load sharing is achieved by the AVG replying to the ARP requests with different virtual MAC addresses.

By default, preemption is disabled. A backup AVG can become the active AVG only if the current AVG fails, regardless of a higher priority.


Example configuration:

AVG#
interface vlan 10
  ip address 10.1.1.102 255.255.255.0
  glbp 10 ip 10.1.1.1
  glbp 10 priority 150

AVF#
interface vlan 10
  ip address 10.1.1.101 255.255.255.0
  glbp 10 ip 10.1.1.1







Thursday, November 13, 2014

IP Services: ARP, Proxy ARP, Reverse ARP, BOOTP, and DHCP

All these five protocols have a common denominator, namely, they help a host learn information to successfully send and receive IP packets.

ARP

ARP is a protocol used to map IP addresses to MAC addresses. Before a host can send any data, it must know the Layer 3 (IP) and Layer 2 (MAC) addresses to correctly construct a frame. ARP is used to dynamically learn the MAC address of a receiver, when the IP address is known. The protocol works as demonstrated in the figure below.


Proxy ARP

Proxy ARP uses the exact same process as ARP, but the ARP request is requesting a MAC address that is not on the local subnet. Because an ARP request is a broadcast, it will not be forwarded outside the local subnet, and the target host will never receive it. However, if a router has a route to that destination, it can issue a proxy ARP reply with its own MAC address on behalf of the target host.

Before the advent of DHCP, many networks relied on proxy ARP. Today, the use of proxy ARP is not that common. In fact, it is often a "quick fix" for potential routing issues (I'll get to this in another post).

Note that the sending host must believe that the target host is in its local network. Otherwise, the sending host will send an ARP request for its default gateway (this is normal ARP, not proxy ARP). In both cases, however, the default gateway (the first-hop router) will reply with its MAC address.

Let's alter the previous scenario to illustrate proxy ARP. First, let's modify the subnet mask on PC1 to cover a larger range, so it believes the remote network is directly connected. Say 10.1.1.102/16. Next, let's add a remote target host (PC2: 10.1.100.22/24) that PC1 will try to ping.


PC1 performs the AND operation, and believes that PC2 exists in its local network, so it sends an ARP request for PC2's IP address directly. The router receives the broadcast, and realizes that it can reach PC2, so it responds to PC1's ARP request with its own MAC address.

Reverse ARP

RARP, BOOTP, and DHCP represent the evolution of protocols defined to enable a host to dynamically learn its IP address. All three are client-server protocols. The client sends a broadcast to begin discovery, the server hears the request and supplies an IP address.

RARP also uses the same ARP message, but operates, well, in reverse (as conveniently implied by the protocol name). When sending a RARP request, the host inserts its own MAC address and an IP address of 0.0.0.0 (indicating an unknown IP address). A preconfigured RARP server, which must be on the same subnet, receives the request and performs a table lookup. If the MAC address listed in the RARP request is configured on the RARP server, the RARP server sends a RARP reply with the corresponding IP address.

The following figure illustrates the operation of RARP.


BOOTP

BOOTP improves on the address assignment features of RARP. BOOTP also uses a completely different set of messages, the payload is encapsulated inside an IP and UDP header. With minimal router configuration, BOOTP packets can be forwarded to remote subnets - allowing the deployment of a centrally located BOOTP server. In addition to IP address assignment, BOOTP supports the assignment of other information, including the subnet mask, default gateway, and DNS servers. But, similar to RARP, BOOTP still requires the server to be manually preconfigured with the MAC addresses and IP addresses for each client.

BOOTP operates as demonstrated in the following figure.


DHCP

DHCP represents the next in the evolution of dynamic IP address assignment. DHCP is widely deployed today. DHCP builds on the format of the BOOTP protocol, and provides flexible messaging and information assignment capability without requiring predefinition of MAC addresses for each client. DHCP also allows the reuse of IP addresses, meaning that a fixed 1:1 address configuration is not required. DHCP can lease IP addresses for the duration the device needs.

DHCP servers typically reside in a centralized location, with routers forwarding local broadcast DHCP requests  to remote DHCP servers. These type of routers are called DHCP relay agents. They change the DHCP request's destination IP address (255.255.255.255) to match the DHCP server (defined by the ip helper-address <ip> command). A relay agent would also list its own IP address in the gateway IP address (giaddr) field, notifying the DHCP server of the IP address to which the DHCP reply should be sent.



Bonus: Configuring a router as a DHCP server

Perhaps not that common in the real world, but a Cisco router can also act as a DHCP server. Essentially, the configuration requires three steps.

  1. Enable the DHCP service on the router.
  2. Exclude all statically configured IP addresses from being dynamically assigned.
  3. Configure DHCP pools with appropriate parameters.

Example:

service dhcp
!
ip dhcp excluded-address 10.1.1.1 10.1.1.15
!
ip dhcp pool DHCP-POOL
  network 10.1.1.0 255.255.255.0
  default-router 10.1.1.1
  dns-server 8.8.8.8

The above configuration is very basic; it merely enables the DHCP service, excludes IP addresses within the range 10.1.1.1-15, and defines a single DHCP pool


Tuesday, November 4, 2014

BPDU Format and STP Timers

Coming back to STP.. This post is dedicated to examining the BPDU and STP timers in detail.

BPDU Autopsy

Switches exchange STP information using a special frame type called Bridge Protocol Data Unit, or BPDU. A BPDU contains several fields which are compared in STP calculation. A switch uses its base MAC address as the source address for BPDU frames, and forwards them to the well-known STP multicast address 0180.C200.0000.

 Let's break down the BPDU frame format.


The BPDU frame format varies slightly depending on the type of protocol used. We'll focus on Cisco's implementation (represented in Figure A-13). For the purposes of this discussion, we'll ignore the Frame control, Routing Information field, Logical link control fields, which have specific preset values (no need to memorize them). As mentioned, the Destination address and Source address contain the STP multicast address and the base MAC address of the switch, respectively.

Now, the IEEE BPDU section encompasses the heart of STP.


When computing a loop-free Layer 2 topology, a switch simply examines the contents of the BPDU fields, as represented in Figure A-14. Let's view each field more specifically. The Protocol identifier, and Version fields are always set to 0, so we'll just skip them.

Message Type (1 byte): denotes whether the frame is a Configuration or TCN BPDU (described later)

Flags (1 byte): signals the TC and TCA bits (described later)

Root ID (8 bytes): contains the root BID (2-byte priority + 6-byte MAC address)

Root Path Cost (4 bytes): indicates the sender's cost to the root switch

Bridge ID (8 bytes): represents the BID of the sender (2-byte priority +  6-byte MAC address)

Port ID (2 bytes): includes the sender's port number from which the BPDU was sent

Message Age (2 bytes): indicates the amount of time since the root sent the BPDU

Max Age (2 bytes): indicates when the current BPDU should be deleted

Hello Time (2 bytes): indicates how often BPDUs are sent

Forward Delay (2 bytes): indicates the time a switch should wait before transitioning to a new state after a topology change

There are, in fact, two types of BPDUs:
  • Configuration BPDU: "normal" BPDU, used for STP computation
  • Topology Change Notification (TCN) BPDU: used to announce changes in the topology

These two BPDUs are differentiated by the TC (Topology Change) and TCA (Topology Change Notification Acknowledgement) bits, which are marked in the Flags field. A TCN BPDU has either the TC or TCA bit set.

The Configuration BPDUs are originated by the root switch only. Non-root switches merely relay the BPDU information downstream out their designated ports. On the contrary, non-root switches can generate TCN BPDUs to signify a topology change. In short, when a topology change occurs, a non-root switch sets the TC bit in the Flags field, and forwards the TCN BPDU upstream (out the Root Port) towards the root switch. The upstream switch then acknowledges the receipt of the TCN BPDU by sending back a BPDU with the TCA bit set (the process will be described in detail in a future post).

STP Timers

STP uses three configurable timers to ensure that a network converges properly without creating switching loops.

Hello Timer - The time interval between sending BPDUs. The value is dictated by the root switch, because only he originates Configuration BPDUs. The default is 2 seconds (1-10 seconds). However, all switches have a local Hello interval which is used to time the (re)transmission of TCN BPDUs.

Forward Delay - The time interval that a port spends in the Listening and Learning states. The default value is 15 seconds (4-30 seconds).

Max Age - The time interval that a switch stores a BPDU before discarding it. Each port keeps a copy of the "best" BPDU it has learned. If the port no longer receives the BPDUs after the Max Age time has elapsed, the switch assumes that a topology change must have occurred, and the BPDU is aged out. The default Max Age value is 20 seconds (6-40 seconds).

The timers should never be changed from their default values without careful consideration. The default STP timer values are derived from a reference model of a network having a diameter of seven switches. It is recommended that the diameter is adjusted to accurately reflect the actual network size, instead of modifying each timer individually. When the diameter is changed, the switch automatically calculates new values for all three timers.

In addition, there is another time-related parameter: Message Age. Unlike the three timers, Message Age is not a fixed value. The Message Age field contains the time that has passed since the root switch initially originated the BPDU. The root switch sends all its BPDUs with a Message Age of 0, and all subsequent switches add 1 to the value. Effectively, the Message Age tells the switch how far he is from the root switch.

Sources

CCNP Exam Prep: Traditional Spanning Tree Protocol
Frame Formats
Understanding and Tuning Spanning Tree Protocol Timers




Monday, November 3, 2014

Troubleshooting IPsec VPN

Now that I have introduced the theory and configuration of IPsec VPNs in my previous posts, it's time to dive into troubleshooting and examine the most common VPN problems. In fact, troubleshooting VPNs is one of the most difficult tasks in network administration. There are so many factors that can cause the IKE negotiations to fail and the tunnel not establishing.

I would strongly advice against looking at the running configuration. It is easy to become blind to your own mistakes, and, as a result, impossible to pinpoint minor configuration errors. Using debugs will provide more intuitive information, but there is a price. The output is noisy and can overwhelm the device as well as the reader.

Now, let's look at some common problems (not an exhaustive list). Again, using the same example topology.


Testing Connectivity

Well, this is not exactly a problem but a common mishap. It's possible that the configuration is correct but the administrator is improperly testing the connection. Ideally, the VPN connection is tested from the end devices inside the local networks. However, sometimes administrators try to verify the tunnel creation by pinging between the peer devices. In this case, the pings will not be encrypted, nor should they be. The key is the proxy IDs, which defines the "interesting traffic" to be encrypted and initially triggers the tunnel creation. If the ping is issued from the peer itself, by default, it will source the packets from the closest interface towards the destination. Referring to the topology, the ping from ASA01 would contain the following information:
  • source: 192.0.2.1
  • destination 198.51.100.1

This does not match the crypto ACL.

access-list L2L extended permit ip 10.1.1.0 255.255.255.0 192.168.1.0 255.255.255.0

Instead, the ping must be manually sourced from the local LAN interface and destined towards the remote LAN.

ASA01# ping inside 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/10 ms

ASA01# show crypto ipsec sa detail
interface: outside
    Crypto map tag: DEMOVPN, seq num: 10, local addr: 192.0.2.1

      access-list L2L extended permit ip 10.1.1.0 255.255.255.0 192.168.1.0 255.255.255.0
      local ident (addr/mask/prot/port): (10.1.1.0/255.255.255.0/0/0)
      remote ident (addr/mask/prot/port): (192.168.1.0/255.255.255.0/0/0)
      current_peer: 198.51.100.1

      #pkts encaps: 34, #pkts encrypt: 34, #pkts digest: 34
      #pkts decaps: 34, #pkts decrypt: 34, #pkts verify: 34

[...]

IKE Phase 1 Fail

If a VPN tunnel does not come up, verifying Phase 1 is typically the first troubleshooting step. The show crypto isakmp sa is a handy command for this purpose.

ASA01# show crypto isakmp sa

IKEv1 SAs:

   Active SA: 1
    Rekey SA: 0 (A tunnel will report 1 Active and 1 Rekey SA during rekey)
Total IKE SA: 1

1   IKE Peer: 198.51.100.1
    Type    : user            Role    : initiator
    Rekey   : no              State   : MM_WAIT_MSG2

The output indicates that the Initiator is stuck in MM_WAIT_MSG2 state. This only means that the Initiator has sent its IKE policies to the peer, but has not received a response. Therefore, there are several potential causes, for example the Receiver having no return route/link down, or simply ISAKMP not enabled on the correct interface. It's impossible to tell. Even the debugs (debug crypto isakmp sa and debug crypto ipsec sa) do not provide much further assistance, but merely state that the tunnel establishment failed.

ASA01#
%ASA-4-752012: IKEv1 was unsuccessful at setting up a tunnel.  Map Tag = DEMOVPN.  Map Sequence Number = 10.
%ASA-3-752015: Tunnel Manager has failed to establish an L2L SA.  All configured IKE versions failed to establish the tunnel. Map Tag= DEMOVPN.  Map Sequence Number = 10.

Let's see, if ASA02 offers more clues.

ASA02#
%ASA-7-713906: IP = 192.0.2.1, All SA proposals found unacceptable

Indeed, it does. 'All SA proposals found unacceptable' is the line to look for in the noisy debug output. It clearly indicates that the peers could not agree on the IKE policy to negotiate the IKE Phase 1 SA. ASA02 did not accept the proposal(s) sent by ASA01.

So let's verify the IKE policies.

ASA01# show run crypto ikev1
crypto ikev1 policy 10
 authentication pre-share
 encryption des
 hash sha
 group 2
 lifetime 86400


ASA02# show run crypto isakmp
crypto isakmp policy 15
 authentication pre-share
 encryption aes
 hash sha
 group 2
 lifetime 86400


The encryption methods do not match (des != aes).


IKE Phase 2 Fail

How does a failure in IPsec SA negotiation appear in the debug? Let's find out.

ASA01#
%ASA-5-713119: Group = 198.51.100.1, IP = 198.51.100.1, PHASE 1 COMPLETED
%ASA-7-715046: Group = 198.51.100.1, IP = 198.51.100.1, constructing IPSec SA payload
[...]
%ASA-4-752012: IKEv1 was unsuccessful at setting up a tunnel.  Map Tag = DEMOVPN.  Map Sequence Number = 10.
%ASA-3-752015: Tunnel Manager has failed to establish an L2L SA.  All configured IKE versions failed to establish the tunnel. Map Tag= DEMOVPN.  Map Sequence Number = 10.

Again, the output on the Initiator (ASA01) is not very intuitive. However, it does state that Phase 1 completed successfully, which is a clear indication that the problem occurs later in the process. What says ASA02?

ASA02#
%ASA-7-715047: Group = 192.0.2.1, IP = 192.0.2.1, processing IPSec SA payload
%ASA-5-713904: Group = 192.0.2.1, IP = 192.0.2.1, All IPSec SA proposals found unacceptable!

Ha! ASA02 complains that it does not like the IPsec SA proposal(s) from ASA01. Let's compare the configuration.

ASA01# show run crypto map
crypto map DEMOVPN 10 match address L2L
crypto map DEMOVPN 10 set peer 198.51.100.1
crypto map DEMOVPN 10 set ikev1 transform-set X
crypto map DEMOVPN interface outside


ASA01# show run | include transform-set
crypto ipsec ikev1 transform-set X esp-aes-256 esp-md5-hmac


 
ASA02# show run crypto map
crypto map VPN-CRYPTOMAP 10 match address VPN-TRAFFIC
crypto map VPN-CRYPTOMAP 10 set peer 192.0.2.1
crypto map VPN-CRYPTOMAP 10 set transform-set TRANSET
crypto map VPN-CRYPTOMAP interface outside


ASA02# show run | include transform-set
crypto ipsec transform-set TRANSET esp-aes-192 esp-md5-hmac


So ASA01 wants to use AES-256 for encryption, but ASA01 will only accept AES-192.

Mismatched Pre-Shared Keys

Unlike the other problems demonstrated so far, troubleshooting mismatched pre-shared keys is straightforward. Even without issuing the debugs, the syslog messages notify the administrator that a wrong password is a likely cause.

ASA01# ping inside 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
Oct 31 12:32:22 [IKEv1]Group = 198.51.100.1, IP = 198.51.100.1, Error, peer has indicated that something is wrong with our message.  This could indicate a pre-shared key mismatch.
.....


ASA02# show crypto isakmp sa

   Active SA: 1
    Rekey SA: 0 (A tunnel will report 1 Active and 1 Rekey SA during rekey)
Total IKE SA: 1

1   IKE Peer: 192.0.2.1
    Type    : L2L             Role    : responder
    Rekey   : no              State   : MM_WAIT_MSG5

Oct 31 15:59:35 [IKEv1]: Group = 192.0.2.1, IP = 192.0.2.1, ERROR, had problems decrypting packet, probably due to mismatched pre-shared key.  Aborting

The ISAKMP state indicates that the peers are exchanging pre-shared key hashes, and if they don't match, the Receiver will remain in the MM_WAIT_MSG5 state.

Verifying the pre-shared keys from the command line on the ASA is challenging because they are stored in a hidden format. The only way to ensure they match is to retype them on both ends.

ASA01# show run tunnel-group
tunnel-group 198.51.100.1 type ipsec-l2l
tunnel-group 198.51.100.1 ipsec-attributes
 ikev1 pre-shared-key *****


ASA02# show run tunnel-group
tunnel-group 192.0.2.1 type ipsec-l2l
tunnel-group 192.0.2.1 ipsec-attributes
 pre-shared-key *****


NOTE: The pre-shared key is not five asterisks.

Wrong proxy IDs

As discussed in my previous posts, the proxy IDs define the local and remote networks between which traffic is to be encrypted. The proxy IDs must be mirrored between the peers. So what happens when they are not?

ASA01#
%ASA-5-713119: Group = 198.51.100.1, IP = 198.51.100.1, PHASE 1 COMPLETED
%ASA-7-715009: Group = 198.51.100.1, IP = 198.51.100.1, IKE Deleting SA: Remote Proxy 192.168.1.0, Local Proxy 10.1.1.0
%ASA-4-752012: IKEv1 was unsuccessful at setting up a tunnel.  Map Tag = DEMOVPN.  Map Sequence Number = 10.
%ASA-3-752015: Tunnel Manager has failed to establish an L2L SA.  All configured IKE versions failed to establish the tunnel. Map Tag= DEMOVPN.  Map Sequence Number = 10.

Again, the debug on the Initiator merely points out that Phase 1 completed successfully, but Phase 2 negotiations failed.

ASA02#
%ASA-5-713119: Group = 192.0.2.1, IP = 192.0.2.1, PHASE 1 COMPLETED
%ASA-7-713222: Group = 192.0.2.1, IP = 192.0.2.1, Static Crypto Map check, map = VPN-CRYPTOMAP, seq = 10, ACL does not match proxy IDs src:10.1.1.0 dst:192.168.1.0
%ASA-3-713061: Group = 192.0.2.1, IP = 192.0.2.1, Rejecting IPSec tunnel: no matching crypto map entry for remote proxy 10.1.1.0/255.255.255.0/0/0 local proxy 192.168.1.0/255.255.255.0/0/0 on interface outside

On the contrary, ASA02 distinctly says that there is a problem with the proxy IDs. Let's look at the access-lists.

ASA01# show run crypto map
crypto map DEMOVPN 10 match address L2L
crypto map DEMOVPN 10 set peer 198.51.100.1
crypto map DEMOVPN 10 set ikev1 transform-set ESP-AES192-MD5
crypto map DEMOVPN interface outside


ASA01# show run access-list
access-list L2L extended permit ip 10.1.1.0 255.255.255.0 192.168.1.0 255.255.255.0


ASA02# show run crypto map
crypto map VPN-CRYPTOMAP 10 match address L2L
crypto map VPN-CRYPTOMAP 10 set peer 192.0.2.1
crypto map VPN-CRYPTOMAP 10 set transform-set TRANSET
crypto map VPN-CRYPTOMAP interface outside


ASA02# show run access-list
access-list L2L extended permit ip 10.1.1.0 255.255.255.0 192.168.1.0 255.255.255.0


So what is the problem? The access-list on ASA02 was directly copied from ASA01 without mirroring it.

Tuesday, October 28, 2014

Configuring IPsec VPNs

My previous post discussed the concepts of IPsec VPNs. This post focuses on the actual implementation.

The following scenario is used to demonstrate the configuration.


This type of setup is referred to as a site-to-site IPsec VPN or LAN-to-LAN (L2L) IPsec VPN.

I'm using two Cisco ASA 5505 firewalls with ASA 8.4 (ASA01) and 8.2 (ASA02) software versions. Because of this, the commands are going to be slightly different on each device. Cisco 1841 router is emulating the Internet cloud.

The Configuration

Essentially, the configuration consists of two parts: defining the IKE Phase 1 and IKE Phase 2 specific negotiation parameters for IKE/ISAKMP SA and IPsec SA, respectively. The IKE SA parameters are advertised inside an IKE/ISAKMP policy. The policy includes the following definitions:
  • encryption algorithm
  • authentication type
  • hashing method
  • Diffie-Hellman group
  • (optional) lifetime of seconds or kilobytes (86400 seconds by default)

The IPsec SA parameters are configured inside a crypto map. The crypto map contains the following information:
  • peer details (Who is the tunnel endpoint?)
  • proxy IDs (What traffic is encrypted?)
  • transform-set (How is the traffic encrypted?)

So let's look at the configuration step by step.


0. Verify IP connectivity.
Before an administrator can even consider configuring an IPsec VPN tunnel, there must be full IP reachability. Without going into the details, below is a briefing of a working configuration.

--- ASA01 ---

interface Vlan1
 nameif inside
 security-level 100
 ip address 10.1.1.1 255.255.255.0
!
interface Vlan2
 nameif outside
 security-level 0
 ip address 192.0.2.1 255.255.255.0

!
object network obj_any
 subnet 0.0.0.0 0.0.0.0
 nat (inside,outside) dynamic interface
!
route outside 0.0.0.0 0.0.0.0 192.0.2.254

--- ASA02 ---

interface Vlan1
 nameif inside
 security-level 100
 ip address 192.168.1.1 255.255.255.0
!
interface Vlan2
 nameif outside
 security-level 0
 ip address 198.51.100.1 255.255.255.0

!
global (outside) 1 interface
nat (inside) 1 192.168.1.0 255.255.255.0

!
route outside 0.0.0.0 0.0.0.0 198.51.100.254

ASA01# ping 198.51.100.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 198.51.100.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms


Hurray for successful pings!


1. Define the IKE/ISAKMP policy.
ASA01#
crypto ikev1 policy 10
 authentication pre-share
 encryption aes
 hash sha
 group 2
 lifetime 86400


ASA02#
crypto isakmp policy 15
 authentication pre-share
 encryption aes
 hash sha
 group 2
 lifetime 86400


Note that the policy number is only locally significant, and does not have match between the peers. A device can have more than one policy configured, and they are sequentially processed. The number signifies the priority, or the preference order (1 highest, 65535 lowest).

Another observation, I did not enter the command lifetime 86400 under the policy configuration. The ASA automatically added it as a default value.


2. Enable IKE/ISAKMP on the interface. 
ASA01#
crypto ikev1 enable outside

ASA02#
isakmp enable outside


3. Configure the transform-set. 
ASA01#
crypto ipsec ikev1 transform-set ESP-AES192-MD5 esp-aes-192 esp-md5-hmac

ASA02#
crypto ipsec transform-set TRANSET esp-aes-192 esp-md5-hmac

I like to choose a descriptive name for the transform-set that, in itself, indicates the encryption and hashing methods used.


4. Set the proxy IDs.
The ACLs define the "interesting traffic", which is to be encrypted. The proxy IDs must be mirrored between the peers (the name is locally significant).

ASA01#
access-list L2L extended permit ip 10.1.1.0 255.255.255.0 192.168.1.0 255.255.255.0

ASA02#
access-list VPN-TRAFFIC extended permit ip 192.168.1.0 255.255.255.0 10.1.1.0 255.255.255.0


5. Combine everything in the crypto map.
ASA01#
crypto map DEMOVPN 10 match address L2L
crypto map DEMOVPN 10 set peer 198.51.100.1
crypto map DEMOVPN 10 set ikev1 transform-set ESP-AES192-MD5


ASA02#
crypto map VPN-CRYPTOMAP 10 match address VPN-TRAFFIC
crypto map VPN-CRYPTOMAP 10 set peer 192.0.2.1
crypto map VPN-CRYPTOMAP 10 set transform-set TRANSET


Again, the names are locally significant, but they must refer to the correct components on that device. 


6. Configure tunnel-groups.
ASA uses tunnel-groups to set values for VPN connections. Tunnel-groups contain a small number of attributes that pertain to creating the tunnel itself. Tunnel-groups are a concept to simplify system management.

ASA01#
tunnel-group 198.51.100.1 type ipsec-l2l
tunnel-group 198.51.100.1 ipsec-attributes
 ikev1 pre-shared-key Sw0rdOfAzer0th


ASA02#
tunnel-group 192.0.2.1 type ipsec-l2l
tunnel-group 192.0.2.1 ipsec-attributes
 pre-shared-key Sw0rdOfAzer0th



7. Apply the crypto map on the interface.
ASA01#
crypto map DEMOVPN interface outside

ASA02#
crypto map VPN-CRYPTOMAP interface outside


8. NAT exemption.
As a final step, the traffic between the LANs must be exempted from NAT translation. According to the order of operations, NAT occurs before any crypto operations. Hence, if the NAT exemption rule is not created, the IP addresses are translated, and will not match the crypto map, never triggering the encryption process.


ASA01#
object network INSIDE-NET
 subnet 10.1.1.0 255.255.255.0
object network L2L-VPN-NET
 subnet 192.168.1.0 255.255.255.0
!
nat (inside,outside) source static INSIDE-NET INSIDE-NET destination static L2L-VPN-NET L2L-VPN-NET


ASA02#
nat (inside) 0 access-list VPN-TRAFFIC


** Full Configuration **

ASA01#
crypto ikev1 policy 10
 authentication pre-share
 encryption aes
 hash sha
 group 2
 lifetime 86400
!
crypto ikev1 enable outside
!
crypto ipsec ikev1 transform-set ESP-AES192-MD5 esp-aes-192 esp-md5-hmac
!
access-list L2L extended permit ip 10.1.1.0 255.255.255.0 192.168.1.0 255.255.255.0
!
crypto map DEMOVPN 10 match address L2L
crypto map DEMOVPN 10 set peer 198.51.100.1
crypto map DEMOVPN 10 set ikev1 transform-set ESP-AES192-MD5
!
crypto map DEMOVPN interface outside
!
tunnel-group 198.51.100.1 type ipsec-l2l
tunnel-group 198.51.100.1 ipsec-attributes
 ikev1 pre-shared-key Sw0rdOfAzer0th
!
!
!
object network INSIDE-NET
 subnet 10.1.1.0 255.255.255.0
object network L2L-VPN-NET
 subnet 192.168.1.0 255.255.255.0
!
nat (inside,outside) source static INSIDE-NET INSIDE-NET destination static L2L-VPN-NET L2L-VPN-NET



ASA02#
crypto isakmp policy 15
 authentication pre-share
 encryption aes
 hash sha
 group 2
 lifetime 86400
!
isakmp enable outside
!
access-list VPN-TRAFFIC extended permit ip 192.168.1.0 255.255.255.0 10.1.1.0 255.255.255.0
!
crypto ipsec transform-set TRANSET esp-aes-192 esp-md5-hmac
crypto ipsec security-association lifetime seconds 28800
crypto ipsec security-association lifetime kilobytes 4608000
!
crypto map VPN-CRYPTOMAP 10 match address VPN-TRAFFIC
crypto map VPN-CRYPTOMAP 10 set peer 192.0.2.1
crypto map VPN-CRYPTOMAP 10 set transform-set TRANSET
!
crypto map VPN-CRYPTOMAP interface outside
!
tunnel-group 192.0.2.1 type ipsec-l2l
tunnel-group 192.0.2.1 ipsec-attributes
 pre-shared-key Sw0rdOfAzer0th
!
!
!
global (outside) 1 interface
nat (inside) 1 192.168.1.0 255.255.255.0
!
nat (inside) 0 access-list VPN-TRAFFIC



Verification

Let's look at show and debug command output to verify that the tunnels have successfully established. Note that these are noisy commands, and could overwhelm the device, if used incorrectly. I would recommend forwarding the output into the logging buffer, instead of the console.

The debug crypto ikev1/isakmp and debug crypto ipsec output tells us that both Phase 1 and Phase 2 completed successfully, and inbound/outbound IPsec SAs were created. Pay special attention to the SPIs (the hexadecimal numbers). SPI stands for Security Parameter Index, and it is used to identify different traffic streams that may use different encryption rules and algorithms.

%ASA-7-713906: IP = 198.51.100.1, Connection landed on tunnel_group 198.51.100.1
%ASA-7-713906: Group = 198.51.100.1, IP = 198.51.100.1, Generating keys for Initiator...
%ASA-5-713119: Group = 198.51.100.1, IP = 198.51.100.1, PHASE 1 COMPLETED
%ASA-5-713120: Group = 198.51.100.1, IP = 198.51.100.1, PHASE 2 COMPLETED (msgid=9e76630b)
%ASA-6-602303: IPSEC: An outbound LAN-to-LAN SA (SPI= 0x66B29CF6) between 192.0.2.1 and 198.51.100.1 (user= 198.51.100.1) has been created.
%ASA-6-602303: IPSEC: An inbound LAN-to-LAN SA (SPI= 0x4FB207F5) between 192.0.2.1 and 198.51.100.1 (user= 198.51.100.1) has been created.
%ASA-5-752016: IKEv1 was successful at setting up a tunnel.  Map Tag = DEMOVPN. Map Sequence Number = 10.



The crypto ikev1/isakmp sa command provides brief information about the current IKE SAs.

ASA01# show crypto ikev1 sa

IKEv1 SAs:

   Active SA: 1
    Rekey SA: 0 (A tunnel will report 1 Active and 1 Rekey SA during rekey)
Total IKE SA: 1

1   IKE Peer: 198.51.100.1
    Type    : L2L             Role    : initiator
    Rekey   : no              State   : MM_ACTIVE



ASA02# show crypto isakmp sa

   Active SA: 1
    Rekey SA: 0 (A tunnel will report 1 Active and 1 Rekey SA during rekey)
Total IKE SA: 1

1   IKE Peer: 192.0.2.1
    Type    : L2L             Role    : responder
    Rekey   : no              State   : MM_ACTIVE



The show crypto ipsec sa command displays detailed information about the current IPsec SAs status. The output shows that on ASA01 only 4 packets encapsulated/0 packets decapsulated, and vice versa on ASA02. Why? This is because I actually have a PC only in the 10.1.1.0/24 network (the other side is an empty LAN). However, pinging any IP address in the 192.168.1.0/24 network still triggers the encryption process, and the packets are routed normally towards the assumed destination. But there will be no reply from non-existent devices.

ASA01# show crypto ipsec sa
interface: outside
    Crypto map tag: DEMOVPN, seq num: 10, local addr: 192.0.2.1

      access-list L2L extended permit ip 10.1.1.0 255.255.255.0 192.168.1.0 255.255.255.0
      local ident (addr/mask/prot/port): (10.1.1.0/255.255.255.0/0/0)
      remote ident (addr/mask/prot/port): (192.168.1.0/255.255.255.0/0/0)
      current_peer: 198.51.100.1

      #pkts encaps: 4, #pkts encrypt: 4, #pkts digest: 4
      #pkts decaps: 0, #pkts decrypt: 0, #pkts verify: 0
      #pkts compressed: 0, #pkts decompressed: 0
      #pkts not compressed: 4, #pkts comp failed: 0, #pkts decomp failed: 0
      #pre-frag successes: 0, #pre-frag failures: 0, #fragments created: 0
      #PMTUs sent: 0, #PMTUs rcvd: 0, #decapsulated frgs needing reassembly: 0
      #send errors: 0, #recv errors: 0

      local crypto endpt.: 192.0.2.1/0, remote crypto endpt.: 198.51.100.1/0
      path mtu 1500, ipsec overhead 74, media mtu 1500
      current outbound spi: 66B29CF6
      current inbound spi : 4FB207F5

    inbound esp sas:
      spi: 0x4FB207F5 (1337067509)
         transform: esp-aes-192 esp-md5-hmac no compression
         in use settings ={L2L, Tunnel, }
         slot: 0, conn_id: 24576, crypto-map: DEMOVPN
         sa timing: remaining key lifetime (kB/sec): (3915000/28060)
         IV size: 16 bytes
         replay detection support: Y
         Anti replay bitmap:
          0x00000000 0x00000001
    outbound esp sas:
      spi: 0x66B29CF6 (1722981622)
         transform: esp-aes-192 esp-md5-hmac no compression
         in use settings ={L2L, Tunnel, }
         slot: 0, conn_id: 24576, crypto-map: DEMOVPN
         sa timing: remaining key lifetime (kB/sec): (3915000/28060)
         IV size: 16 bytes
         replay detection support: Y
         Anti replay bitmap:
          0x00000000 0x00000001



ASA02# show crypto ipsec sa
interface: outside
    Crypto map tag: VPN-CRYPTOMAP, seq num: 10, local addr: 198.51.100.1

      access-list VPN-TRAFFIC extended permit ip 192.168.1.0 255.255.255.0 10.1.1.0 255.255.255.0
      local ident (addr/mask/prot/port): (192.168.1.0/255.255.255.0/0/0)
      remote ident (addr/mask/prot/port): (10.1.1.0/255.255.255.0/0/0)
      current_peer: 192.0.2.1

      #pkts encaps: 0, #pkts encrypt: 0, #pkts digest: 0
      #pkts decaps: 4, #pkts decrypt: 4, #pkts verify: 4
      #pkts compressed: 0, #pkts decompressed: 0
      #pkts not compressed: 0, #pkts comp failed: 0, #pkts decomp failed: 0
      #pre-frag successes: 0, #pre-frag failures: 0, #fragments created: 0
      #PMTUs sent: 0, #PMTUs rcvd: 0, #decapsulated frgs needing reassembly: 0
      #send errors: 0, #recv errors: 0

      local crypto endpt.: 198.51.100.1, remote crypto endpt.: 192.0.2.1

      path mtu 1500, ipsec overhead 74, media mtu 1500
      current outbound spi: 4FB207F5
      current inbound spi : 66B29CF6

    inbound esp sas:
      spi: 0x66B29CF6 (1722981622)
         transform: esp-aes-192 esp-md5-hmac no compression
         in use settings ={L2L, Tunnel, }
         slot: 0, conn_id: 24576, crypto-map: VPN-CRYPTOMAP
         sa timing: remaining key lifetime (kB/sec): (4374000/28025)
         IV size: 16 bytes
         replay detection support: Y
         Anti replay bitmap:
          0x00000000 0x00000001
    outbound esp sas:
      spi: 0x4FB207F5 (1337067509)
         transform: esp-aes-192 esp-md5-hmac no compression
         in use settings ={L2L, Tunnel, }
         slot: 0, conn_id: 24576, crypto-map: VPN-CRYPTOMAP
         sa timing: remaining key lifetime (kB/sec): (4374000/28025)
         IV size: 16 bytes
         replay detection support: Y
         Anti replay bitmap:
          0x00000000 0x00000001


That's a lot to chew. I know. Write your questions in the comments section.