VRRP Introduction and Configuration

1. Introduction

        Virtual Router Redundancy Protocol (VRRP) is an optional protocol that delegates the responsibilities of a virtual router to

Any of the VRRP routers dynamically assigned to the LAN. VRRP that controls the virtual router IP address

The router, called the master router, is responsible for forwarding packets to these virtual IP addresses. Once the main router is unavailable

If used, this selection process provides a dynamic failover mechanism, which allows the IP address of the virtual router to be

as the default first-hop router for end hosts. The advantage of using VRRP is that there is a higher reliability of the default path

usability without configuring dynamic routing or route discovery protocols on each end host. VRRP packets are encapsulated in IP

It is a backup protocol for LAN access devices. All hosts in a local area network are set to default

Gateway, so that the packets sent by the host whose destination address is not in the network segment will be sent to the Layer 3 switch through the default gateway

machine, thereby realizing the communication between the host computer and the external network.

        working principle  

        VRRP only defines one kind of message——vrrp message, which is a kind of multicast message, which is determined by the main Layer 3 switch.

Send out from time to time to announce his presence. These packets can be used to detect various parameters of the virtual layer 3 switch, and can also be

It is used for the election of the master Layer 3 switch.

Three state models are defined in VRRP, initial state Initialize, active state Master and backup state

up, where only the active switch can serve forwarding requests to the virtual IP address.

VRRP packets are encapsulated in IP packets and support various upper-layer protocols. VRRP also supports real

The interface IP address is set to the virtual IP address.

  So how to elect the Master from multiple switches in the backup group? This work is done by us on each of the backup group

The virtual switch with the same IP address configured on the switch is done.

  The virtual switch selects the master switch according to the configured priority, and the one with the highest priority is the master switch

machine, the state is Master, if the priority is the same (if the switch is not configured with priority, the default value will be used

100), compare the main IP address of the interface, and the one with the larger main IP address becomes the main switch, which provides the actual route

by service. Other switches are used as backup switches to monitor the status of the main switch at any time. When the main switch is normal

When working, it will send a VRRP multicast packet at regular intervals to notify the backup switch in the group, the master

The switch is in normal working condition. If the backup switch in the group does not receive data from the master switch for a long time

VRRP multicast packets, then change its state to Master. When there are multiple backup switches in the group, there will be

Multiple master switches can be generated. At this time, each master switch will compare the priority in the VRRP message with its own

If the local priority is lower than the priority in VRRP, the state will be converted to

Backup, otherwise keep your own state unchanged. Through such a process, the exchange with the highest priority

The machine is elected as the new master switch to complete the backup function of VRRP.

 

Layer 2 switch lsw3 configuration

<Huawei>undo terminal monitor

Info: Current terminal monitor is off.

<Huawei>sys    

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname lsw3

[lsw3]user-in    

[lsw3]user-interface con    

[lsw3]user-interface console 0

[lsw3-ui-console0]id    

[lsw3-ui-console0]idle-timeout 0 0

[lsw3-ui-console0]q

[lsw3]vlan b    

[lsw3]vlan batch 10 20

Info: This operation may take a few seconds. Please wait for a moment...done.

[lsw3] you are e0/0/1

[lsw3-Ethernet0/0/1]p l a

[lsw3-Ethernet0/0/1]p d v 10

[lsw3-Ethernet0/0/1]int e0/0/2

[lsw3-Ethernet0/0/2]p l a

[lsw3-Ethernet0/0/2]p d v 20

[lsw3-Ethernet0/0/2]int g0/0/1

[lsw3-GigabitEthernet0/0/1]p l t

[lsw3-GigabitEthernet0/0/1]p t a v 10 20

[lsw3-GigabitEthernet0/0/1]int g0/0/2

[lsw3-GigabitEthernet0/0/2]p l t

[lsw3-GigabitEthernet0/0/2]p t a v 10 20

Layer 3 switch lsw1 configuration

<Huawei>undo terminal monitor

Info: Current terminal monitor is off.

 <Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname lsw1

[lsw1]user-interface console 0

[lsw1-ui-console0]idle-timeout 0 0

[lsw1-ui-console0]q

[lsw1]vlan batch 10 20

Info: This operation may take a few seconds. Please wait for a moment...done.

[lsw1]vlan 100

[lsw1-vlan100]q

[lsw1]int g0/0/2

[lsw1-GigabitEthernet0/0/2]p l t

[lsw1-GigabitEthernet0/0/2]p t a v 10 20

[lsw1-GigabitEthernet0/0/2]un sh

Info: Interface GigabitEthernet0/0/2 is not shutdown.

[lsw1-GigabitEthernet0/0/2]int g0/0/1

[lsw1-GigabitEthernet0/0/1]p l a

[lsw1-GigabitEthernet0/0/1]p d v 100

[lsw1-GigabitEthernet0/0/1]un sh

Info: Interface GigabitEthernet0/0/1 is not shutdown.

[lsw1-GigabitEthernet0/0/1]q

[lsw1]int vlanif 10

[lsw1-Vlanif10]ip add 192.168.10.10 24

[lsw1-Vlanif10]vrrp vr    

[lsw1-Vlanif10]vrrp vrid ?

  INTEGER<1-255>  Virtual router identifier

[lsw1-Vlanif10]vrrp vrid 1?

  INTEGER<1-255>                          

[lsw1-Vlanif10]vrrp vrid 1 for    

[lsw1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1 Configure virtual ip address

[lsw1-Vlanif10]vrrp vrid 1 priority 120 configuration priority

[lsw1-Vlanif10]vrrp vrid 1 track interface g0/0/1 Configure the listening port

[lsw1-Vlanif10]vrrp vrid 1 track interface g0/0/2

[lsw1-Vlanif10] you are vlanif 20

[lsw1-Vlanif20]ip add 192.168.20.10 24

[lsw1-Vlanif20]vrr    

[lsw1-Vlanif20]vrrp vi    

[lsw1-Vlanif20]vrrp vr    

[lsw1-Vlanif20]vrrp twist 2 we    

[lsw1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1

[lsw1-Vlanif20]vrrp v    

[lsw1-Vlanif20]vrrp vrid 2 p    

[lsw1-Vlanif20]vrrp vrid 2 pr    

[lsw1-Vlanif20]vrrp vrid 2 priority 115

[lsw1-Vlanif20]q

[lsw1]int vlanif 100

[lsw1-Vlanif100]ip add 11.0.0.2 30

[lsw1-Vlanif100]q

[lsw1]ip r    

[lsw1]ip rou    

[lsw1]ip route-s    

[lsw1]ip route-static 0.0.0.0 0.0.0.0 11.0.0.1

Layer 3 switch lsw2 command configuration

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname LSW2

[LSW2]user-in    

[LSW2]user-interface con    

[LSW2]user-interface console 0

[LSW2-ui-console0]id     

[LSW2-ui-console0]idle-timeout 0 0

[LSW2-ui-console0]q

[LSW2]vlan b    

[LSW2]vlan batch 10 20 100

Info: This operation may take a few seconds. Please wait for a moment...done.

[LSW2]int g0/0/2

[LSW2-GigabitEthernet0/0/2]p l t

[LSW2-GigabitEthernet0/0/2]p t a v 10 20

[LSW2-GigabitEthernet0/0/2]un sh

Info: Interface GigabitEthernet0/0/2 is not shutdown.

[LSW2-GigabitEthernet0/0/2]int g0/0/1

[LSW2-GigabitEthernet0/0/1]p l a

[LSW2-GigabitEthernet0/0/1]p d v 100

[LSW2-GigabitEthernet0/0/1]un sh

Info: Interface GigabitEthernet0/0/1 is not shutdown.

[LSW2-GigabitEthernet0/0/1]int vlanif 10

[LSW2-Vlanif10]ip add 192.168.10.20 24

 [LSW2-Vlanif10]vrrp vrid 1 priority 115

Error: The VRRP does not exist.

[LSW2-Vlanif10]you are vlanif 20

[LSW2-Vlanif20]ip add 192.168.20.20 24

[LSW2-Vlanif20]vrrp vrid 2     

[LSW2-Vlanif20]vrrp twist 2 vi    

[LSW2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1

 [LSW2-Vlanif20]vrrp vrid 2 priority 120

  [LSW2-Vlanif20]vrrp vrid 2 track interface g0/0/2

[LSW2-Vlanif20]int vlan    

[LSW2-Vlanif20]int last year    

[LSW2-Vlanif20]int vlanif 100

[LSW2-Vlanif100]ip add 12.0.0.2 30

[LSW2-Vlanif100]q

[LSW2]ip r    

[LSW2]ip rou    

[LSW2]ip route-s    

[LSW2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1

[LSW2]

Router R1

<Huawei>undo terminal monitor

Info: Current terminal monitor is off.

<Huawei>sys    

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname R1

[R1]user-interface console 0

[R1-ui-console0]idle-timeout 0 0

[R1-ui-console0]q

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]ip add 11.0.0.1 30

[R1-GigabitEthernet0/0/0]un sh

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[R1-GigabitEthernet0/0/0]int g0/0/1

[R1-GigabitEthernet0/0/1]ip add 12.0.0.1 30

[R1-GigabitEthernet0/0/1]un sh

Info: Interface GigabitEthernet0/0/1 is not shutdown.

[R1-GigabitEthernet0/0/1]int loo 0

[R1-LoopBack0]ip add 1.1.1.1 24

[R1-LoopBack0]q

[R1]ip route-static 192.168.10.0 24 11.0.0.2

[R1]ip route-static 192.168.10.0 24 12.0.0.2 p    

[R1]ip route-static 192.168.10.0 24 12.0.0.2 preference 70

[R1]ip route-static 192.168.20.0 24 12.0.0.2

[R1]ip route-static 192.168.20.0 24 11.0.0.2 preference 70

Guess you like

Origin blog.csdn.net/z09364517158/article/details/132092342