A Comparison of Virtual Ip Commands
A Comparison of Virtual Ip Commands
eos.arista.com/a-comparison-of-virtual-ip-commands
Contents [hide]
1/6
Switch1:
Switch1(config)#interface vlan 10
Switch1(config-if-Vl10)#ip address 10.0.0.2/24
Switch1(config-if-Vl10)#ip virtual-router address 10.0.0.1
Switch1(config)#ip virtual-router mac-address 00:1c:73:00:00:99
Switch2:
Switch2(config)#interface vlan 10
Switch2(config-if-Vl10)#ip address 10.0.0.3/24
Switch2(config-if-Vl10)#ip virtual-router address 10.0.0.1
Switch2(config)#ip virtual-router mac-address 00:1c:73:00:00:99
The ‘ip virtual-router address’ command requires an IP address to be configured on the SVI
where it is applied.
How does the host resolve ARP for the default gateway/vIP?
Gratuitous ARPs: Gratuitous ARPs are periodically sent from both switches which
have VARP configured. In the gratuitous ARPs the configured vMAC is used as the
Ethernet Source MAC. The ARP message informs the host that Virtual IP is present at
vMAC.
ARPing for VIP from host: Some hosts might not learn from GARPs or they might
come up between the gratuitous ARP interval. The host will send out an ARP
request for the virtual IP. The receiving switch will send out an ARP reply similar
to the gratuitous ARP (unicast instead of broadcast).
Example: Switch1 has to send data to the host, the switch will send out an ARP request in
the format:
2/6
The ‘ip virtual-router’ command with mask
Static route:
Since the SVI IP belongs to a different subnet (20.0.0.0/24), we need a static route to point to
the 10.0.0.0/24 subnet, via the SVI (interface vlan 10). This installs the 10.0.0.0/24 network
in the routing table as a directly connected route.
Switch1:
Switch1(config)#interface vlan 10
Switch1(config-if-Vl10)#ip address 20.0.0.2/24
Switch1(config-if-Vl10)#ip virtual-router address 10.0.0.1/24
Switch1(config)#ip virtual-router mac-address 00:1c:73:00:00:99
Switch1(config)#ip route 10.0.0.0/24 vlan 10
Switch2:
Switch2(config)#interface vlan 10
Switch2(config-if-Vl10)#ip address 20.0.0.3/24
Switch2(config-if-Vl10)#ip virtual-router address 10.0.0.1/24
Switch2(config)#ip virtual-router mac-address 00:1c:73:00:00:99
Switch1(config)#ip route 10.0.0.0/24 vlan 10
How does the host resolve ARP for the default gateway/vIP?
3/6
Gratuitous ARPs: Gratuitous ARPs are periodically sent from both switches which
have VARP configured. In the gratuitous ARP, the configured vMAC is used as the
Ethernet Source MAC. The ARP message informs the host that Virtual IP is present at
vMAC.
ARPing for VIP from host: Some hosts might not learn from Grat ARPs or they might
come up between the gratuitous ARP interval. It will send out an ARP request for the
virtual IP. The receiving switch will send out an ARP reply similar to the gratuitous ARP
(unicast instead of broadcast).
Example: Switch1 has to send data to the host, the switch will send out an ARP
request in the format:
ARP sync
The host will learn the virtual IP and MAC from the ARP request and will reply to the same.
Since the reply could be hashed to any one of the switches, ARP sync is enabled on the
switches to allow both the switches in the MLAG pair to learn the host MAC.
Example: Switch 1 sends out the ARP request. Host replies to the ARP request, but the reply
could get hashed to Switch2. In this case, Switch 2 consumes the ARP reply since it also
possesses the vMAC. Switch2 then uses ARP sync to inform Switch1 about the host’s ARP
information.
4/6
This command is generally used to conserve IP addresses in VXLAN deployments and
can be used to provide an Anycast gateway.
Switch1:
Switch1(config)#interface vlan 10
Switch1(config-if-Vl10)#ip address virtual 10.0.0.1/24
Switch1(config)#ip virtual-router mac-address 00:1c:73:00:00:99
Switch2:
Switch2(config)#interface vlan 10
Switch2(config-if-Vl10)#ip address virtual 10.0.0.1/24
Switch2(config)#ip virtual-router mac-address 00:1c:73:00:00:99
How does the host resolve ARP for the default gateway/vIP?
No gratuitous ARPs: There are no gratuitous ARPs generated by the switch when the ‘ip
address virtual’ command is used.
To learn the vMAC, the host will send an ARP request for the virtual IP. The
receiving switch will sent an ARP reply in the format:
Example: Switch1 has to send data to the host, the switch will send out an ARP request
in the format:
ARP sync
The host will learn the virtual IP and MAC from the ARP request and will reply to the same.
Since the reply could be hashed to any one of the switches, ARP sync is enabled on the
switches to allow both the switches in the MLAG pair to learn the host MAC.
Suggested reading
1. Active-active router redundancy using VARP
2. Difference between”ip virtual-router address” and “ip address virtual”
3. VXLAN routing with MLAG
6/6