A brief introduction to Ethernet link aggregation and VRRP


1. Ethernet link aggregation

1、Eth-trunk

Ethernet link aggregation-Eth-trunk multi-link aggregation, which converts multiple physical links into one E-trunk logical link, thereby achieving the purpose of increasing link bandwidth. The maximum number of links in link aggregation is 8, divided into manual mode and LACP mode.

2. LACP mode

The LACP mode requires the participation of the link aggregation control protocol LACP. When it is necessary to provide a larger link bandwidth between two directly connected devices and the device supports LACP, it is recommended to use LACP mode. LACP mode can not only achieve the purpose of increasing bandwidth, improving reliability, and load sharing, but also can provide Eth-trunk fault tolerance and provide backup functions.

In LACP mode, some links are active links, and all active links participate in data forwarding. If an active link fails, the link aggregation group automatically selects a link from the inactive links as the active link, so that the number of links participating in data forwarding remains unchanged.

3. Configuration of link aggregation

Insert picture description here

[SW1]lacp priority 1000 ###Configure system LACP priority
[SW1]int Eth-trunk 1 ###Enter Eth-trunk view
[SW1-Eth-Trunk1]bpdu enable
[SW1-Eth-Trunk1]mode lacp-static
[SW1-Eth-Trunk1]trunkport Etherent 0/0/1 to 0/0/4
[SW1-Eth-Trunk1]max active-linknumber 3

[SW2]int Eth-trunk 1
[SW2-Eth-Trunk1]bpdu enable
[SW2-Eth-Trunk1]mode lacp-static
[SW2-Eth-Trunk1]trunkport Etherent 0/0/1 to 0/0/4
[SW2-Eth-Trunk1]max active-linknumber 3

Two, VRRP

1. Virtual router redundancy protocol

Vritual Router Redundancy, also known as virtual router redundancy protocol.
With VRRP, a group of routers (interfaces in the same LAN) work together, but only one is in the Master state, and the router (interface) in this state is responsible for the actual data traffic forwarding task. Multiple router interfaces in a VRRP group share a virtual IP address, which is used as the default (default) gateway address of all hosts in the LAN.

VRRP determines which router is the Master, and the Master router is responsible for receiving and forwarding data packets sent to the user gateway, and responding to the PC's ARP request for its gateway IP address.

The Backup router listens to the status of the Master router and takes over its work when the Master router fails, so as to ensure the smooth switching of business traffic.

2. Introduction to VRRP

(1) The role of VRRP: It
provides a device backup mechanism on the LAN. VRRP is a fault-tolerant protocol. It ensures that when the next-hop router of a host fails, it can be replaced by another router in time, thus ensuring the continuity and reliability of communication.
When VRRP works, a virtual router containing a virtual IP and virtual MAC address is added to the network. The router acts as a gateway for network users, so that hosts on the network communicate with the virtual router without knowing any information about the physical router on the network.

(2) VRRP router:
a router running VRRP. A VRRP router (the interface) can participate in multiple VRRP groups at the same time. In different groups, a VRRP router can play different roles.

(3) VRRP group:
A VRRP group is composed of multiple VRRP routers, which are identified by the same VRID (Virtual Router ID). VRRP routers belonging to the same VRRP group exchange information with each other. Each VRRP group can only There is a Master.

(4) Virtual router:
For each VRRP group, a logical router abstracted out. The router acts as a gateway for network users. The router does not really exist. In fact, for users, they only need to know the IP of the virtual router. As for Who will take the role of the specific virtual router, who will take the task of data forwarding, and who will take over when the Master fails? This is the job of VRRP.

(5) Virtual IP address, MAC address:

  • The virtual IP address is the IP address of the virtual router, and the address is actually the user's gateway address.
  • The virtual MAC address is the MAC address generated by the virtual router based on the VRID. A virtual router has a virtual MAC address in the format: 00-00-5E-00-01-{VRID}.

(6) Master, Backup router:

  • Master router: The router that actually forwards data packets in a VRRP group. In each VRRP group, only the Master responds to ARP requests for virtual IP addresses. The Master router sends VRRP messages at a certain time interval at the same time to inform the Backup router of its own survival status.
  • Backup router: A router in the monitoring state. Once the Master router fails, the Backup router will begin to take over.
  • Election basis: first compare the interface VRRP priority (larger), if they are equal, compare the interface IP address (larger).

3. Virtual MAC address

The virtual router formed by VRRP uses virtual IP address and virtual MAC to communicate with PCs in the network. The format of the virtual MAC is as follows: The VRID of the last byte represents the hexadecimal of the virtual router ID. For example, the VRID is 1, and the MAC address is 00-00-5E-00-01-01.
Insert picture description here

4. VRRP state machine

There are three states of VRRP protocol, namely Initialize, Master, Backup. The initial state is nitialize. Master and Backup are generated by comparing priorities. If Backup does not receive a heartbeat message from Master within a specified period of time, it will Switch to Master.
Insert picture description here

Three, Master/Backup router

1. Master router

  • During normal operation, VRRP advertisement messages are sent every 1 second to inform Backup routers of their survival status.
  • Respond to the ARP request of other devices for the virtual IP address with the virtual MAC address.
  • Forward IP packets with the virtual MAC address as the destination MAC address.
  • If it is the owner of the virtual IP address (the actual IP address of the interface is the virtual IP address)
    , then the IP packet with the destination IP address being the virtual IP address is received, otherwise the IP packet is discarded.
  • If it receives a packet with a higher priority than its own, it immediately becomes a backup.
  • If it receives a VRRP packet with the same priority as its own and the local interface IP address is less than the peer interface IP, it immediately becomes a backup.

The VRRP notification message is encapsulated in an IP message and sent through the multicast address 224.0.0.18, with a TTL of 255 and a protocol number of 112.

2. Backup router

  • Receive the VRRP notification message sent by the master device to determine whether the status of the master device is normal.
  • No response is made to the ARP request of the virtual IP address.
  • IP packets whose destination IP addresses are virtual IP addresses are discarded.
  • If it receives a packet with the same priority as itself or greater than itself, it resets the Master-Down-Interval timer without further comparing IP addresses.
  • If a packet with a lower priority than its own is received and the priority of the packet is 0, the timer time is set to Skew_time (offset time)
    . If the priority of the packet is not 0, the packet is discarded and the packet becomes the Master immediately.

Four, VRRP configuration

1 、 R1

[R1]int vlanif 10 ###Gateway interface (Layer 3 switching is VLAN interface, router is downstream interface)
[R1-vlanif10]ip address 192.168.10.11 24

[R1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1 ####Create a VRRP virtual router with the ID vrid of 1, and configure the virtual IP address of vrid 1
[R1-Vlanif10]vrrp vrid 1 priority 120 ###Set The priority of device A is 120 (the default value is 100), the larger the value, the more priority
[R1-vlanif10]vrrp vrid 1 preempt-mode timer delay 6###Configure the preemption delay of the Master device to 6 seconds (default value 0, immediately preempt) to prevent frequent state switching
[R1-vlanif10]vrrp vrid 1 track interface GigabitEtherneto/0/1 reduce 30####Track the status of the uplink interface Go/0/1, if the port fails, The master priority is lowered by 30 (default value is 10)
[R1-Vlanif10]vrrp vrid 1 track interface g0/0/2 ####Track the downlink interface

2、R2
[R2] int vlanif 10
[R2-Vlanif10]ip address 192.168.10.10 24
[R2-vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1
[R2-vlanif10lvrrp vrid 1 priority 115

[R2]dis vrrp ##Display VRRP status

PC test verification, tracert 10.0.0.1

Optional items:
[R1-Vlanif10]vrrp vrid 1 preempt-mode timer delay 6
###It is recommended that the backup device be set to preempt immediately, and the master device to delay preemption. Specify a certain delay time. The purpose of this configuration is to When the network environment is unstable, wait for a certain period of time for the state of the uplink and downlink to restore consistency, so as to avoid dual master devices or frequent preemption by both the main and backup parties causing the user equipment to learn the wrong master device MAC address.

[Huawei-GigabitEthernet0/0/2] vrrp vrid 1 timer advertise 3
###The master device will send a vrrp notification message to the backup device in the group with the advertisement interval notification time timer (the default value is 1) to notify that it is working properly . If the backup device does not receive the vrrp notification message after the notification time timer (approximately 3 times the notification time + offset time ((256-Priority) /256) has expired, it will re-elect the master

Guess you like

Origin blog.csdn.net/weixin_55609819/article/details/114984603