thanhan1310
Intern
Cấu Hình Giao Thức Dự Phòng Gateway (VRRP)
- Tiếp tục với bài viết Lý Thuyết về Giao Thức Dự Phòng Gateway (VRRP)- Bài viết này mình sẽ hướng dẫn các bạn cấu hình VRRP trên thiết bị Router Juniper
Sơ đồ mô hình :

Mục tiêu : ta cấu hình VRRP, bầu chọn R1 làm master, các router còn lại làm backup dựa trên chỉ số priority để khi R1 gặp sự cố, hệ thống vẫn hoạt động và các luồng dữ liệu sẽ được chuyển qua R2 và R4
Ta cấu hình SW
set vlans VLAN10 vlan-id 10
set interfaces xe-0/0/0 unit 0 family ethernet-switching interface-mode access vlan members VLAN10
set interfaces xe-0/0/1 unit 0 family ethernet-switching interface-mode access vlan members VLAN10
set interfaces xe-0/0/2 unit 0 family ethernet-switching interface-mode access vlan members VLAN10
set interfaces xe-0/0/3 unit 0 family ethernet-switching interface-mode access vlan members VLAN10

Tiếp theo ta cấu hình R1
set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.1/24 vrrp-group 1 virtual-address 192.168.10.254
set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.1/24 vrrp-group 1 priority 150
set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.1/24 vrrp-group 1 preempt
set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.1/24 vrrp-group 1 accept-data
set interfaces ge-0/0/1 unit 0 family inet address 172.10.20.2/30
set routing-options static route 192.168.20.0/24 next-hop 172.10.20.1

Tương tự với các Router 4,2 để cấu hình VRRP
R4
set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.3/24 vrrp-group 1 virtual-address 192.168.10.254
set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.3/24 vrrp-group 1 priority 120
set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.3/24 vrrp-group 1 preempt
set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.3/24 vrrp-group 1 accept-data
set interfaces ge-0/0/1 unit 0 family inet address 172.10.20.14/30
set routing-options static route 192.168.20.0/24 next-hop 172.10.20.13
R2
set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.2/24 vrrp-group 1 virtual-address 192.168.10.254
set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.2/24 vrrp-group 1 priority 100
set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.2/24 vrrp-group 1 preempt
set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.2/24 vrrp-group 1 accept-data
set interfaces ge-0/0/1 unit 0 family inet address 172.10.20.6/30
set routing-options static route 192.168.20.0/24 next-hop 172.10.20.5
R3
set interfaces ge-0/0/0 unit 0 family inet address 192.168.20.1/24
set interfaces ge-0/0/1 unit 0 family inet address 172.10.20.1/30
set interfaces ge-0/0/2 unit 0 family inet address 172.10.20.13/30
set interfaces ge-0/0/3 unit 0 family inet address 172.10.20.5/30
set routing-options static route 192.168.10.0/24 qualified-next-hop 172.10.20.2
set routing-options static route 192.168.10.0/24 qualified-next-hop 172.10.20.6
set routing-options static route 192.168.10.0/24 qualified-next-hop 172.10.20.14
Gán ip cho 2 PC
PC1
PC2ip 192.168.10.10/24 192.168.10.254
ip 192.168.20.10/24 192.168.20.1
Kiểm tra kết quả
R1

R4

R2

Cơ chế đảm bảo dự phòng VRRP (Tracker Interface)
Tracker Interface là một cơ chế cho phép VRRP giám sát trạng thái của một hoặc nhiều interface cụ thể trên router. Khi interface bị down, điểm ưu tiên (priority) của router sẽ giảm, từ đó khiến router nhường quyền Master cho router khác có kết nối tốt hơn.
Ta cấu hình R1
Khi đó priority của R1 sẽ hạ từ 150 xuống 50, ưu tiên master cho các router khácset interfaces ge-0/0/0 unit 0 family inet address 192.168.10.1/24 vrrp-group 1 track interface ge-0/0/1 priority-cost 100
Tương tự với R4, R2 không cần vì nó là Router cuối cùng rồi, nếu sập thì cả hệ thống sập luôn :>>
R1set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.3/24 vrrp-group 1 track interface ge-0/0/1 priority-cost 100

R4

R2

Kiểm tra trace từ PC1 đi PC2

Hiện tại PC1 đang trỏ tới PC2 thông qua R1
Ta tắt cổng ở R1


PC1 trỏ tới PC2 thông qua R4

Ta tắt nốt cổng ở R4

PC1 trỏ tới PC2 thông qua R2


Biểu diễn quá trình dự phòng

Khi có một Router bị disconnect, gói tin được chuyển đến Router khác, đảm bảo quá trình luôn hoạt động
Kết luận
Thông qua bài lab, VRRP đã chứng minh khả năng duy trì tính sẵn sàng cao cho cổng mặc định nhờ cơ chế ưu tiên và theo dõi trạng thái giao diện, cho phép tự động chuyển đổi vai trò Master khi phát hiện sự cố mà không làm gián đoạn kết nối.Các tình huống mô phỏng sự cố Router cho thấy kết nối giữa các thiết bị đầu cuối luôn được đảm bảo, khẳng định VRRP là lựa chọn đáng tin cậy cho hạ tầng mạng doanh nghiệp.
Đính kèm
Sửa lần cuối:
Bài viết liên quan
Bài viết mới