Shure, they have to be connected directly do each other, but in configuration you just configure for which interface the virtual router should exist.
Assuming there's an 802.1q trunk between the routers and the correct VLANs have been created as layer 2 etc. Then HSRP uses the standby ip to identify the neighbor via the interface or SVI. You can have "unlimited" HSRP threads in the same HSRP group, but please mind, that there can be a restriction in the TCAM as to how many the network device can actually handle in the same group.
Routers that run HSRP (version 1) communicate HSRP information between each other through HSRP hello packets. These packets are sent to the destination IP multicast address 18.104.22.168 on User Datagram Protocol (UDP) port 1985. IP multicast address 22.214.171.124 is a reserved multicast address that is used to communicate to all routers. The active router sources hello packets from its configured IP address and the HSRP virtual MAC address. The standby router sources hellos from its configured IP address and the burned-in MAC address (BIA). This use of source addressing is necessary so that HSRP routers can correctly identify each other.
In most cases, when you configure routers to be part of an HSRP group, the routers listen for the HSRP MAC address for that group as well as their own BIA. The only exception to this behavior is for Cisco 2500, 4000, and 4500 routers. These routers have Ethernet hardware that only recognizes a single MAC address. Therefore, these routers use the HSRP MAC address when they serve as the active router. The routers use their BIA when they serve as the standby router.
HSRPv2 - Version 2 of the HSRP has these features:
- To match the HSRP group number to the VLAN ID of a subinterface, HSRPv2 can use a group number from 0 to 4095 and a MAC address from 0000.0C9F.F000 to 0000.0C9F.FFFF.
- HSRPv2 uses the multicast address 126.96.36.199 to send hello packets. HSRPv2 and CGMP leave processing are no longer mutually exclusive, and both can be enabled at the same time.
- HSRPv2 has a different packet format than HRSPv1.
A switch running HSRPv1 cannot identify the physical router that sent a hello packet because the source MAC address of the router is the virtual MAC address.
HSRPv2 has a different packet format than HSRPv1. A HSRPv2 packet uses the type-length-value (TLV) format and has a 6-byte identifier field with the MAC address of the physical router that sent the packet.
If an interface running HSRPv1 gets an HSRPv2 packet, the type field is ignored.