vrrp (virtual router redundancy protocol, virtual router redundancy protocol) experimental configuration and principle analysis Xiaobai can understand (detailed experimental configuration analysis) (Huawei ensp simulator)

1. The concept of VRRP

VRRP (virtual router redundancy protocol, virtual router redundancy protocol), a routing protocol used to solve a single point of failure of the gateway. VRRP can be used in routers to provide gateway redundancy, or in firewalls for dual-system hot backup.

Two, the two roles of VRRP

The router in VRRP mode has two roles, namely, the Master router and the Backup router.

  • Master router : Under normal circumstances, the Master router is responsible for the ARP response and the forwarding of data packets, and by default it advertises the current status information of the Master router to other routers every 1s.
  • Backup router : It is the backup router of the Master router. Under normal circumstances, it does not provide data packet forwarding. When the master router fails, the router with the highest priority among all the backup routers will become the new master router and take over the work of forwarding data packets. , So as to ensure uninterrupted business.

3. Introduction of VRRP

  • VRRP router : a router running VRRP protocol.
  • Virtual router : A backup group is composed of an active router and several backup routers, and a backup group provides a virtual gateway to the client.
  • VRID : Virtual router identifier, used to uniquely identify a backup group.
  • Virtual IP address : The gateway address provided to the client is also the IP address assigned to the virtual router. It is configured in all VRRPs, and only the master device provides the ARP response of the IP address.
  • Virtual MAC address : The MAC address for VRRP generated based on VRID. When the client resolves the MAC address of the gateway through the ARP protocol, the main router will provide the MAC address.
  • IP address owner : If the IP address of the virtual router is configured as the real IP address of a member's physical interface, then the member is called the IP address owner.
  • Priority : Used to identify the priority of VRRP routers, and to elect the primary and backup devices through the priority of each VRRP router.
  • Preemption mode : In preemption mode, if the priority of the backup router is higher than other routers in the backup group (including the current active router), it will immediately become the new active router.
  • Non-preemptive mode : In non-preemptive mode, if the priority of the backup router is higher than other routers in the backup group (including the current active router), it will not immediately become the active router until the next fair election (such as restarting the device) Wait).

Four, the three states of VRRP

VRRP defines three states, which are as follows:

  • Initalize state : In the state when VRRP has just been configured, in this state, no VRRP packets are processed, and it will enter this state when the interface is shut down or the interface fails.
  • Master state : A state when the current device is elected as the master router. In this state, data packets are forwarded and VRRP notification packets are periodically sent. When the interface is shut down or the device goes down, it will immediately switch to the Initialize state.
  • Backup state : A state when the current device is elected to become a backup router. This state does not forward any data packets, but only receives VRRP advertisement messages sent by the master router to check whether the master router is working normally, and to synchronize the master device. Status information on the.

Five, VRRP election master router and backup router

The VRRP election process of master router and backup router is as follows:
first elect the device with higher priority to become the master router, if the priority is the same, compare the size of the interface IP address, the device with larger IP address (large value) will become the master router, and The other routers in the backup group will become backup routers. Unless the router is manually configured as the IP address owner (priority=255), VRRP state switching always goes through the Backup state first. Even if the router has the highest priority, it needs to transition from the backup state to the master state. At this time, the backup state is just an instant transition state. The default interface priority in VRRP is 100 and the value range is 0~255. Priority 0 is reserved by the system, and priority 255 is reserved for the IP address owner. The IP address owner does not need to configure the priority. The default priority is 255.

6. VRRP application experiment and detailed configuration text analysis

1. Experiment purpose and environment

By disconnecting a link to simulate a network disconnection test, the VRRP protocol can adjust the routing in time to solve the single point of failure accident of the routing, so that it has no impact on the operation of the business. Huawei ensp emulator.

2. Experimental planning topology diagram

Insert picture description here

3. Experimental configuration and detailed text analysis
  • Configuration of LSW1

sysname LSW1 -----------------------------------------------Re Name
vlan batch 10 20 100 ---------------------------------------- Create vlan
interface in batch Vlanif10 -------------------------------------------- Enter this interface
ip address 192.168.10.20 255.255.255.0 ------------Add an IP address for the interface
vrrp vrid 1 virtual-ip 192.168.10.1 ----------------- ----Add an IP address for VRRP virtual router 1
vrrp vrid 1 priority 115 --------------------------------- ---Set the priority of VRRP virtual router 1
interface Vlanif20
ip address 192.168.20.20 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.1
vrrp vrid 2 priority 120
vrrp vrid 2 track interface GigabitEthernet0/0/1
----- -------------------------------- Use VRRP virtual router 2 to monitor the status of this link
vrrp vrid 2 track interface GigabitEthernet0/0/2
interface Vlanif100
ip address 12.0.0.2 255.255.255.252
interface GigabitEthernet0/0/1
port link-type access
port default vlan 100 ------- add type and partition vlan for this port
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20 ----Add type trunk to the port, and trunk allows to pass vlan 10 and 20
ip route-static 0.0.0.0 0.0.0.0 12.0.0.1 -----Add a default route for the router

  • Configuration of LSW2

sysname SW2
vlan batch 10 20 100
interface Vlanif10
ip address 192.168.10.10 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.1
vrrp vrid 1 priority 120
vrrp vrid 1 track interface GigabitEthernet0/0/1
vrrp vrid 1 track interface GigabitEthernet0/0/2
interface Vlanif20
ip address 192.168.20.10 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.1
vrrp vrid 2 priority 115
interface Vlanif100
ip address 11.0.0.2 255.255.255.252
interface GigabitEthernet0/0/1
port link-type access
port default vlan 100
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
ip route-static 0.0.0.0 0.0.0.0 11.0.0.1

  • Configuration of LSW3

interface Ethernet0/0/1
port link-type access
port default vlan 10
interface Ethernet0/0/2
port link-type access
port default vlan 20
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094

  • R1 configuration

sysname R1
interface GigabitEthernet0/0/0
ip address 11.0.0.1 255.255.255.252
interface GigabitEthernet0/0/1
ip address 12.0.0.1 255.255.255.252
interface LoopBack0 ------------------ ----------The loopback port of the router, usually used for testing or Router ID
ip address 1.1.1.1 255.255.255.0
ip route-static 192.168.10.0 255.255.255.0 11.0.0.2
ip route-static 192.168. 10.0 255.255.255.0 12.0.0.2 preference 70
-------------Add a priority value to the route, which is not added as the default value of 60. The smaller the priority value, the better. The preference is to choose
ip route- static 192.168.20.0 255.255.255.0 11.0.0.2 preference 70
ip route-static 192.168.20.0 255.255.255.0 12.0.0.2

4. Test of experimental results
  • Test network connectivity

Insert picture description here
Insert picture description here

  • Disconnect a network link test

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/wulimingde/article/details/107192002