Khắc phục sự cố liên quan đến OSPF Adjacency – Phần 3

Khắc phục sự cố liên quan đến OSPF Adjacency  Phần 1Phần 2

Trong bài viết hôm nay, chúng ta sẽ tiếp tục thảo luận về các nguyên nhân có thể dẫn đến sự cố thiết lập quan hệ OSPF (OSPF adjacency), và sẽ tìm hiểu hai nguyên nhân sau:

+ Không khớp giá trị Hello và Dead Interval

+ Không khớp giá trị MTU

Chúng ta sẽ tiếp tục làm việc trên cùng một sơ đồ mạng (topology) như trước.

Không khớp giá trị Hello và Dead Interval

Như chúng ta đã biết, để thiết lập và duy trì quan hệ OSPF, các router phải có giá trị hellodead interval giống nhau. OSPF không đàm phán các giá trị này — nếu không khớp, quan hệ lân cận sẽ bị coi là down (mất kết nối).

thuongndh@Router1# run show log OSPFLOG
Jan 2 00:04:47.362239 OSPF rcvd Hello 10.100.12.2 -> 224.0.0.5 (ge-0/0/1.112 IFL 71 area 0.0.0.0)
Jan 2 00:04:47.362261 Version 2, length 48, ID 163.121.1.2, area 0.0.0.0
Jan 2 00:04:47.362266 checksum 0x0, authtype 1
Jan 2 00:04:47.362273 mask 255.255.255.252, hello_ivl 7, opts 0x12, prio 128
Jan 2 00:04:47.362279 dead_ivl 21, DR 0.0.0.0, BDR 0.0.0.0
Jan 2 00:04:47.362285 OSPF packet ignored: hello interval mismatch 7 from 10.100.12.2 on intf ge-0/0/1.112 area 0.0.0.0

Và bằng cách kiểm tra kết quả đầu ra của lệnh show ospf interface detail, chúng ta có thể thấy rằng Router1 đang sử dụng các giá trị mặc định

+ Hello interval: 10 giây

+ Dead interval: 40 giây

→ Điều này cho thấy rõ sự không khớp nếu router bên kia sử dụng các giá trị khác (ví dụ: 7/21 giây), và là nguyên nhân khiến quan hệ OSPF không được thiết lập.

thuongndh@Router1# run show ospf interface ge-0/0/1.112 detail
Interface      State       Area         DR ID        BDR ID       Nbrs
ge-0/0/1.112   PtToPt      0.0.0.0      0.0.0.0      0.0.0.0      0
Type: P2P, Address: 10.100.12.1, Mask: 255.255.255.252, MTU: 1500, Cost: 1
Adj count: 0
Hello: 10, Dead: 40, ReXmit: 5, Not Stub
Auth type: Password
Protection type: None
Topology default (ID 0) -> Cost: 1

Bằng cách kiểm tra kết quả đầu ra của lệnh monitor traffic interface <interface> detail, chúng ta có thể thấy rõ các giá trị Hello Dead interval trong:

  • Các gói tin IN (nhận vào)

  • Các gói tin OUT (gửi ra)

Từ đó, chúng ta có thể đối chiếu và đảm bảo rằng các giá trị này được cấu hình giống nhau trên cả hai router

00:22:44.059611 In IP (tos 0xc0, ttl 1, id 16613, offset 0, flags [none], proto: OSPF (89), length: 76) 10.100.12.2 > 224.0.0.5: OSPFv2, Hello, length 56 [len 44]
Router-ID 163.121.1.2, Backbone Area, Authentication Type: simple (1)
Simple text password: Jun!p3r
Options [External, LLS]
Hello Timer 7s, Dead Timer 21s, Mask 255.255.255.252, Priority 128
LLS: checksum: 0xfff6, length: 3
Extended Options (1), length: 4
Options: 0x00000001 [LSDB resync]00:22:50.412662 Out IP (tos 0xc0, ttl 1, id 25235, offset 0, flags [none], proto: OSPF (89), length: 76) 10.100.12.1 > 224.0.0.5: OSPFv2, Hello, length 56 [len 44]
Router-ID 163.121.1.1, Backbone Area, Authentication Type: simple (1)
Simple text password: Jun!p3r
Options [External, LLS]
Hello Timer 10s, Dead Timer 40s, Mask 255.255.255.252, Priority 128
LLS: checksum: 0xfff6, length: 3
Extended Options (1), length: 4
Options: 0x00000001 [LSDB resync]

Không khớp giá trị MTU

OSPF rất nhạy cảm với sự không khớp về MTU, và nếu có bất kỳ sự khác biệt nào trong giá trị MTU của family INET, thì quan hệ OSPF sẽ không được thiết lập.


 Lưu ý:

+ Nếu không cấu hình MTU logic (logical MTU) cho bất kỳ family giao thức nào (ví dụ: inet, inet6), thì:

– MTU của family INET sẽ thấp hơn 14 byte so với MTU vật lý (physical MTU) đã cấu hình.

+ Nếu bạn sử dụng VLAN tagging hoặc inner VLAN tagging, thì:

– MTU sẽ thấp hơn 18 byte hoặc 22 byte so với MTU vật lý tương ứng.


Triệu chứng lỗi:

Khi có sự khác biệt về MTU giữa hai router

+ Router 1 sẽ bị kẹt ở trạng thái ExStart

+ Router 2 sẽ bị kẹt ở trạng thái Exchange

→ Đây là dấu hiệu kinh điển cho lỗi MTU mismatch trong OSPF.

thuongndh@Router1# run show ospf neighbor
Address         Interface              State     ID               Pri  Dead
10.100.12.1     ge-0/0/1.112           ExStart   163.121.1.1      128    37
thuongndh@Router2# run show ospf neighbor
Address         Interface           State      ID               Pri  Dead
10.100.12.2      ge-0/0/1.112       Exchange   163.121.1.2      128    36

Bạn có thể phát hiện và xác nhận lỗi này bằng cách dùng các lệnh:

show interfaces <interface-name> detail
show ospf neighbor 
monitor traffic interface <interface-name> detail

Bằng cách xem nhật ký traceoptions, chúng ta có thể thấy rằng sự không khớp MTU chính là vấn đề.

thuongndh@Router2# run show log OSPFLOG
Jan  2 00:56:22.289619 OSPF rcvd DbD 10.100.12.1 -> 224.0.0.5 (ge-0/0/1.112 IFL 78 area 0.0.0.0)
Jan  2 00:56:22.289626   Version 2, length 172, ID 163.121.1.1, area 0.0.0.0
Jan  2 00:56:22.289632   checksum 0x0, authtype 1
Jan  2 00:56:22.289638   options 0x52, i 0, m 0, ms 0, r 0, seq 0xa377cd12, mtu 1500
Jan  2 00:56:22.289713 OSPF restart signaling: Received DBD with LLS data from nbr ip=10.100.12.1 id=163.121.1.1.
Jan  2 00:56:22.289719 OSPF packet ignored: MTU mismatch from 10.100.12.1 on intf ge-0/0/1.112 area 0.0.0.0
Jan  2 00:56:23.586559 OSPF rcvd LSUpdate 10.100.12.1 -> 224.0.0.5 (ge-0/0/1.112 IFL 78 area 0.0.0.0)
Jan  2 00:56:23.586568   Version 2, length 112, ID 163.121.1.1, area 0.0.0.0
Jan  2 00:56:23.586574   checksum 0x0, authtype 1
Jan  2 00:56:23.586580   adv count 3
Jan  2 00:56:25.459808 OSPF hello from 163.121.1.1 (IFL 78, area 0.0.0.0) absorbed
Jan  2 00:56:27.091553 OSPF resend last DBD to 10.100.12.1
Jan  2 00:56:27.091607 OSPF sent DbD 10.100.12.2 -> 224.0.0.5 (ge-0/0/1.112 IFL 78 area 0.0.0.0)
Jan  2 00:56:27.091613   Version 2, length 32, ID 163.121.1.2, area 0.0.0.0
Jan  2 00:56:27.091619   options 0x52, i 1, m 1, ms 1, r 0, seq 0xa377cd12, mtu 1482
Jan  2 00:56:27.091656 OSPF restart signaling: Add LLS data for DbD packet on interface ge-0/0/1.112.

Những gì chúng ta có thể nhận thấy từ O/P bên trên là các gói mô tả cơ sở dữ liệu được gửi và nhận với kích thước MTU tương ứng, do đó OSPF đã phát lại tín hiệu do sự không khớp MTU này và sẽ bị kẹt ở trạng thái Exstart/Exchange.

Cuối cùng, chúng ta có thể sử dụng monitor traffic interface detail, tìm kiếm các gói DBD và tôi nghĩ đây là cách nhanh nhất theo tôi để giải quyết vấn đề này.

01:05:42.805146 Out IP (tos 0xc0, ttl   1, id 30892, offset 0, flags [none], proto: OSPF (89), length: 204) 10.100.12.1 > 224.0.0.5: OSPFv2, Database Description, length 184 [len 172]
Router-ID 163.121.1.1, Backbone Area, Authentication Type: simple (1)
Simple text password: Jun!p3r
Options [External, LLS, Opaque], DD Flags [none], MTU: 1500, Sequence: 0xa377cd12
Advertising Router 163.121.1.1, seq 0x80000014, age 21s, length 28
Router LSA (1), LSA-ID: 163.121.1.1
Options: [External, Demand Circuit]
Advertising Router 163.121.1.2, seq 0x80000019, age 87s, length 76
Router LSA (1), LSA-ID: 163.121.1.2
Options: [External, Demand Circuit]01:08:30.249575  In IP (tos 0xc0, ttl   1, id 20471, offset 0, flags [none], proto: OSPF (89), length: 64) 10.100.12.2 > 224.0.0.5: OSPFv2, Database Description, length 44 [len 32]
Router-ID 163.121.1.2, Backbone Area, Authentication Type: simple (1)
Simple text password: Jun!p3r
Options [External, LLS, Opaque], DD Flags [Init, More, Master], MTU: 1482, Sequence: 0xa377cd12
LLS: checksum: 0xfff6, length: 3
Extended Options (1), length: 4
Options: 0x00000001 [LSDB resync]

Khắc phục sự cố liên quan đến OSPF Adjacency – Phần 2

Trong bài viết trước (Khắc phục sự cố liên quan đến OSPF Adjacency – Phần 1) , chúng ta đã thảo luận về một số lý do có thể dẫn đến vấn đề  thiết lập OSPF neighbors, trong bài viết hôm nay, chúng ta sẽ xem xét các lý do dưới đây và sẽ tiếp tục đề cập đến các lý do còn lại trong bài viết tiếp theo trong phần 3.

– Kiểu giao diện (interface type) không khớp.

– OSPF priority được đặt là 0 ở cả hai phía.

– ID vùng (area ID) hoặc loại vùng (area type) không khớp.

Chúng ta sẽ tiếp tục làm việc trên cùng một mô hìng như phần 1 

Kiểu giao diện (interface type) không khớp.

Các loại giao diện không khớp nhau có thể gây ra lỗi thiết lập quan hệ OSPF (OSPF adjacency), tuy nhiên một số tổ hợp vẫn có thể hoạt động, và quan hệ OSPF có thể đạt đến trạng thái Full.

Ví dụ:

– Một bên của kết nối OSPF được cấu hình ở chế độ point-to-point (điểm-điểm)

– Bên còn lại được cấu hình ở chế độ point-to-multipoint (điểm-đa điểm),

→ Trong một số trường hợp, vẫn có thể thiết lập quan hệ OSPF thành công.

thuongndh@Router1# show protocols ospf
area 0.0.0.0 {
   interface ge-0/0/1.112 {
   interface-type p2p;
   authentication {
      simple-password “$9$uXoJBRcKMXbs4B1X-ws4oz36”; ## SECRET-DATA
       }
   }
interface lo0.0;
thuongndh@Router2# show protocols ospf
area 0.0.0.0 {
   interface lo0.0;
   interface ge-0/0/1.112 {
   interface-type p2mp;
      authentication {
      simple-password “$9$ZyDH.QF/0BEDj/tOBEhVwY”; ## SECRET-DATA
   }
}

Và chúng ta có thể thấy OSPF đang hoạt động như sau.

thuongndh@Router2# run show ospf neighbor detail
Address       Interface        State     ID           Pri    Dead
10.100.12.1   ge-0/0/1.112     Full      163.121.1.1  128    36

Area 0.0.0.0, opt 0x52, DR 0.0.0.0, BDR 0.0.0.0
Up 00:02:40, adjacent 00:02:35

Tuy nhiên, nếu một phía của router trong OSPF được cấu hình ở chế độ mặc định là broadcast, trong khi phía còn lại được cấu hình ở chế độ point-to-point hoặc point-to-multipoint, thì quan hệ OSPF sẽ không được thiết lập (sẽ thất bại).

Điều này có thể được kết luận thông qua:

– Kết quả lệnh show ospf interfaces cho thấy sự không tương thích cấu hình

– Nhật ký từ traceoptions cho thấy lỗi,

– Kết quả lệnh monitor traffic interface detail giúp xác định vấn đề.

Ngoài ra, ta cũng có thể nhận thấy trên một trong hai router, quan hệ OSPF bị kẹt ở trạng thái Init, như hiển thị trong kết quả lệnh show ospf neighbor.

Trên Router 1

thuongndh@Router1# run show ospf interface
Interface        State      Area         DR ID          BDR ID     Nbrs ge-0/0/1.112     PtToPt    0.0.0.0       0.0.0.0      0.0.0.0      0 
thuongndh@Router1> show ospf neighbor
thuongndh@Router1> show log OSPFLOG
Jan 1 20:50:23 Router1   clear-log[1166]: logfile cleared
Jan  1 20:50:24.565357   OSPF rcvd Hello 10.100.12.2 -> 224.0.0.5 (ge-0/0/1.112 IFL 71 area 0.0.0.0)
Jan  1 20:50:24.565388   Version 2, length 48, ID 163.121.1.2, area 0.0.0.0
Jan  1 20:50:24.565394   checksum 0x0, authtype 1
Jan  1 20:50:24.565400   mask 255.255.255.252, hello_ivl 10, opts 0x12, prio 128
Jan  1 20:50:24.565406   dead_ivl 40, DR 10.100.12.2, BDR 0.0.0.0
Jan  1 20:50:24.565412   OSPF packet ignored: configuration mismatch from 10.100.12.2 on intf ge-0/0/1.112 area 0.0.0.0

Router 02

thuongndh@Router2> show ospf interface
Interface       State     Area        DR ID           BDR ID        Nbrs
ge-0/0/1.112    DR        0.0.0.0     163.121.1.2     0.0.0.0       1

thuongndh@Router2> show ospf neighbor
Address          Interface        State     ID               Pri    Dead
10.100.12.1      ge-0/0/1.112     Init      163.121.1.1      128    36
thuongndh@Router2> monitor traffic detail interface ge-0/0/1.112
20:54:52.997098 Out IP (tos 0xc0, ttl   1, id 4355, offset 0, flags [none], proto: OSPF (89), length: 80) 10.100.12.2 > 224.0.0.5: OSPFv2, Hello, length 60 [len 48]
Router-ID 163.121.1.2, Backbone Area, Authentication Type: simple (1)
Simple text password: Jun!p3r
Options [External, LLS]
Hello Timer 10s, Dead Timer 40s, Mask 255.255.255.252, Priority 128
Designated Router 10.100.12.2
Neighbor List:
163.121.1.1
LLS: checksum: 0xfff6, length: 3
Extended Options (1), length: 4
Options: 0x00000001 [LSDB resync]
20:54:58.775551  In IP (tos 0xc0, ttl   1, id 1718, offset 0, flags [none], proto: OSPF (89), length: 76) 10.100.12.1 > 224.0.0.5: OSPFv2, Hello, length 56 [len 44]
Router-ID 163.121.1.1, Backbone Area, Authentication Type: simple (1)
Simple text password: Jun!p3r
Options [External, LLS]
Hello Timer 10s, Dead Timer 40s, Mask 255.255.255.252, Priority 128
LLS: checksum: 0xfff6, length: 3
Extended Options (1), length: 4
Options: 0x00000001 [LSDB resync]

OSPF priority được đặt là 0 ở cả hai phía

Trong OSPF, mỗi router trên một mạng kiểu broadcast (ví dụ như Ethernet) đều có một giá trị gọi là priority (ưu tiên), được dùng để bầu chọn

– DR (Designated Router) – Router đại diện chín

– BDR (Backup Designated Router) – Router dự phòng

 Ý nghĩa của OSPF Priority

– Giá trị priority càng cao, càng ưu tiên được chọn làm DR.

– Giá trị 0 có nghĩa là không tham gia bầu chọn DR/BDR.

Vấn đề: Cả hai router đều có priority = 0

– Không có router nào đủ điều kiện làm DR hoặc BDR

– Do đó, quan hệ OSPF sẽ không được thiết lập, vì không thể có DR để điều phối trao đổi thông tin.

Chúng ta có thể giải quyết vấn đề trên thông qua lệnh show ospf interfaces detail và sử dụng lệnh traceoptionsmonitor traffic detail interface.

Nếu giá trị OSPF priority được đặt là 0 trên các giao diện kiểu broadcast, quan hệ OSPF sẽ bị kẹt ở trạng thái 2-Way

Điều này xảy ra vì cả hai router đều tin rằng trên phân đoạn mạng (segment) đang có những router khác có thể đóng vai trò là DR (Designated Router)BDR (Backup Designated Router).→ Kết quả là không router nào tiến hành xây dựng quan hệ đầy đủ (Full adjacency) với nhau.

thuongndh@Router2# run show ospf neighbor
Address        Interface        State     ID               Pri   Dead
10.100.12.1    ge-0/0/1.112     2Way      163.121.1.1      0     32
thuongndh@Router2# run show ospf interface detailInterface     State      Area            DR ID      BDR ID      Nbrs 
ge-0/0/1.112   DRother    0.0.0.0         0.0.0.0    0.0.0.0     1 
Type: LAN, Address: 10.100.12.2, Mask: 255.255.255.252, MTU: 1500, Cost: 1 
Priority: 0 
Adj count: 0 
Hello: 10, Dead: 40, ReXmit: 5, Not Stub 
Auth type: Password 
Protection type: None 
Topology default (ID 0) -> Cost: 1
Jan  1 21:34:01.861330   OSPF rcvd Hello 10.100.12.2 -> 224.0.0.5 (ge-0/0/1.112 IFL 71 area 0.0.0.0)
Jan  1 21:34:01.861334   Version 2, length 48, ID 163.121.1.2, area 0.0.0.0
Jan  1 21:34:01.861339   checksum 0x0, authtype 1
Jan  1 21:34:01.861346   mask 255.255.255.252, hello_ivl 10, opts 0x12, prio 0
Jan  1 21:34:01.861351   dead_ivl 40, DR 0.0.0.0, BDR 0.0.0.0
Jan  1 21:34:01.861397   RPD_OSPF_NBRUP: OSPF neighbor 10.100.12.2 (realm ospf-v2 ge-0/0/1.112 area 0.0.0.0) state changed from Init to 2Way due to 2WayRcvd (event reason: neighbor detected this router)Jan  1 21:34:01.861562 OSPF sent Hello 10.100.12.1 -> 224.0.0.5 (ge-0/0/1.112 IFL 71 area 0.0.0.0)
Jan  1 21:34:01.861568   Version 2, length 48, ID 163.121.1.1, area 0.0.0.0
Jan  1 21:34:01.861574   mask 255.255.255.252, hello_ivl 10, opts 0x12, prio 0
Jan  1 21:34:01.861580   dead_ivl 40, DR 0.0.0.0, BDR 0.0.0.0

Không khớp Area ID hoặc không khớp loại Area (Area Type)

+ Area ID không khớp: Hai router nằm cùng một liên kết (interface) nhưng được cấu hình với ID vùng khác nhau (ví dụ: một bên là 0.0.0.0, bên kia là 0.0.0.1) thì sẽ không thiết lập được quan hệ OSPF.

+ Loại vùng không khớp (mismatched area types): Cả hai router có thể cùng Area ID, nhưng nếu một bên cấu hình là Stub Area, còn bên kia là Regular Area, thì cũng sẽ không hình thành adjacency.

Không khớp Area ID sẽ khiến quan hệ OSPF không được thiết lập. Để kiểm tra vấn đề này, bạn có thể sử dụng lệnh: show ospf interface Lệnh này sẽ giúp bạn xác minh Area ID đang được cấu hình trên từng giao diện, từ đó dễ dàng phát hiện nếu hai thiết bị ở hai phía đang sử dụng Area ID khác nhau, dẫn đến lỗi không hình thành quan hệ lân cận (adjacency) trong OSPF.

thuongndh@Router2# run show ospf interface ge-0/0/1.112
Interface        State     Area        DR ID      BDR ID      Nbrs
ge-0/0/1.112     PtToPt    0.0.0.1     0.0.0.0    0.0.0.0     0
thuongndh@Router1# run show ospf interface ge-0/0/1.112
Interface         State     Area           DR ID         BDR ID      Nbrs
ge-0/0/1.112      PtToPt    0.0.0.0        0.0.0.0       0.0.0.0     0

Sử dụng traceoptions

Jan  1 21:54:04.694379 OSPF sent Hello 10.100.12.1 -> 224.0.0.5 (ge-0/0/1.112 IFL 71 area 0.0.0.0)
Jan  1 21:54:04.694384   Version 2, length 44, ID 163.121.1.1, area 0.0.0.0
Jan  1 21:54:04.694391   mask 255.255.255.252, hello_ivl 10, opts 0x12, prio 128
Jan  1 21:54:04.694396   dead_ivl 40, DR 0.0.0.0, BDR 0.0.0.0
Jan  1 21:54:11.599084 OSPF packet ignored: area mismatch (0.0.0.1) from 10.100.12.2 on intf ge-0/0/1.112 area 0.0.0.0
Jan  1 21:54:11.599152 OSPF rcvd Hello 10.100.12.2 -> 224.0.0.5 (ge-0/0/1.112 IFL 71 area 0.0.0.0)
Jan  1 21:54:11.599158   Version 2, length 44, ID 163.121.1.2, area 0.0.0.1
Jan  1 21:54:11.599164   checksum 0x46a6, authtype 1
Jan  1 21:54:11.599170   mask 255.255.255.252, hello_ivl 10, opts 0x12, prio 128
Jan  1 21:54:11.599176   dead_ivl 40, DR 0.0.0.0, BDR 0.0.0.0

Không khớp loại vùng (Stub Flag) cũng có thể ảnh hưởng đến quan hệ OSPF 

Trường Options trong gói tin Hello của OSPF sẽ thông báo loại vùng (area type) mà giao diện thuộc về. Nếu hai router cấu hình giao diện trong các loại vùng khác nhau — ví dụ: một bên là stub area, bên kia là normal area — thì các router sẽ không nhận diện nhau là hàng xóm (neighbor)quan hệ adjacency sẽ không được thiết lập.

Chúng tôi đã thay đổi Area ID từ 0 sang 1 để bật stub flag, cụ thể

+ Router2 được đặt trong area 1 (stub),

+ Router1 được đặt trong area 1 nssa (Not-So-Stubby Area).

Bạn có thể thấy sự khác biệt này khi kiểm tra đầu ra của lệnh show ospf interface detail

thuongndh@Router2# run show ospf interface ge-0/0/1.112 detail
Interface       State      Area         DR ID       BDR ID       Nbrs
ge-0/0/1.112    PtToPt     0.0.0.1      0.0.0.0     0.0.0.0      0
Type: P2P, Address: 10.100.12.2, Mask: 255.255.255.252, MTU: 1500, Cost: 1
Adj count: 0
Hello: 10, Dead: 40, ReXmit: 5, Not Stub
Auth type: None
Protection type: None
Topology default (ID 0) -> Cost: 1
thuongndh@Router1# run show ospf interface ge-0/0/1.112 detail
Interface       State     Area        DR ID      BDR ID      Nbrs
ge-0/0/1.112    PtToPt    0.0.0.1     0.0.0.0    0.0.0.0     0
Type: P2P, Address: 10.100.12.1, Mask: 255.255.255.252, MTU: 1500, Cost: 1
Adj count: 0
Hello: 10, Dead: 40, ReXmit: 5, Stub NSSA
Auth type: None
Protection type: None
Topology default (ID 0) -> Cost: 1

traceoptions

ali@Router1# run show log OSPFLOG | last 10
Jan  1 22:22:55.285989 OSPF periodic xmit from 10.100.12.1 to 224.0.0.5 (IFL 71 area 0.0.0.1)
Jan  1 22:22:57.548326 OSPF rcvd Hello 10.100.12.2 -> 224.0.0.5 (ge-0/0/1.112 IFL 71 area 0.0.0.1)
Jan  1 22:22:57.548440   Version 2, length 44, ID 163.121.1.2, area 0.0.0.1
Jan  1 22:22:57.548446   checksum 0x0, authtype 0
Jan  1 22:22:57.548452   mask 255.255.255.252, hello_ivl 10, opts 0x12, prio 128
Jan  1 22:22:57.548458   dead_ivl 40, DR 0.0.0.0, BDR 0.0.0.0
Jan  1 22:22:57.548464 OSPF packet ignored: area stubness mismatch from 10.100.12.2 on intf ge-0/0/1.112 area 

Lệnh monitor traffic detail cho thấy sự khác biệt về loại vùng OSPF

Trong trường Options của gói tin OSPF Hello, lệnh monitor traffic interface detail sẽ hiển thị các thông tin cho biết loại vùng mà mỗi router đang tham gia.

Ví dụ:

+ Một bên hiển thị: External, LLS → Tức là router đó thuộc vùng bình thường (Normal Area)

+ Bên còn lại hiển thị: NSSA, LLS → Tức là router đó thuộc vùng NSSA (Not-So-Stubby Area)

Nếu một router nằm trong Stub area, nó sẽ chỉ báo hiệu LLS (Link Local Signaling) mà không có External hay NSSA, như minh họa bên dưới.

→ Điều này dẫn đến không thể thiết lập quan hệ lân cận (adjacency) nếu hai bên thuộc các loại vùng khác nhau.

ali@Router2# run monitor traffic detail interface ge-0/0/1.112
22:24:56.832460  In IP (tos 0xc0, ttl   1, id 12439, offset 0, flags [none], proto: OSPF (89), length: 76) 10.100.12.1 > 224.0.0.5: OSPFv2, Hello, length 56 [len 44]
Router-ID 163.121.1.1, Area 0.0.0.1, Authentication Type: none (0)
Options [NSSA, LLS]
Hello Timer 10s, Dead Timer 40s, Mask 255.255.255.252, Priority 128
LLS: checksum: 0xfff6, length: 3
Extended Options (1), length: 4
Options: 0x00000001 [LSDB resync]
22:24:57.998158 Out IP (tos 0xc0, ttl   1, id 10319, offset 0, flags [none], proto: OSPF (89), length: 76) 10.100.12.2 > 224.0.0.5: OSPFv2, Hello, length 56 [len 44]
Router-ID 163.121.1.2, Area 0.0.0.1, Authentication Type: none (0)
Options [External, LLS]
Hello Timer 10s, Dead Timer 40s, Mask 255.255.255.252, Priority 128
LLS: checksum: 0xfff6, length: 3
Extended Options (1), length: 4
Options: 0x00000001 [LSDB resync]

Trong bài viết tiếp theo, chúng ta sẽ tiếp tục hành trình cùng nhau kiểm tra những lý do khác gây ra vấn đề OSPF không thiết lập neighbor với hy vọng có thể hoàn thiện chủ đề này.

Tôi hy vọng điều này có giá trị với các bạn

Khắc phục sự cố liên quan đến OSPF Adjacency – Phần 1

Trong phần này, chúng ta sẽ thảo luận một số nguyên nhân ảnh hưởng đến việc thiết lập quan hệ lân cận (adjacency) OSPF giữa hai thiết bị ngang hàng (peers), và cách xử lý sự cố này trong hệ điều hành Junos của Juniper.

Trước tiên, chúng ta sẽ liệt kê các nguyên nhân có thể dẫn đến sự cố adjacency trong OSPF, và sau đó sẽ bàn chi tiết hơn tiếp theo.

1. Các nguyên nhân có thể gây ra sự cố OSPF adjacency:

– Trùng ID router (Router ID).

– Subnet mask không khớp hoặc địa chỉ IP sai.

– Không khớp xác thực (authentication).

– Kiểu giao diện (interface type) không khớp.

– OSPF priority được đặt là 0 ở cả hai phía.

– ID vùng (area ID) hoặc loại vùng (area type) không khớp.

– Giá trị hello interval và dead interval không khớp.

– Cấu hình MTU không khớp.

2. Cách xử lý sự cố adjacency:

Có một số lệnh cơ bản để kiểm tra và tìm ra nguyên nhân sự cố mà bạn đang gặp phải, bao gồm:

show ospf neighbors
show ospf interface
show ospf interface detail
show configuration protocols ospf

Ngoài các lệnh giám sát và quản trị (A/M commands), nếu không có lý do rõ ràng gây ra sự cố adjacency, bạn có thể kiểm tra kỹ hơn hoạt động bên trong của giao thức định tuyến nội bộ (IGP) bằng lệnh:

monitor traffic interface <tên-giao-diện> detail

Ngoài ra, sử dụng traceoptions cũng là một phương pháp hữu ích để xác định chính xác vấn đề gì đang xảy ra với adjacency. Hãy cân nhắc sử dụng các cờ (flag) hello detailerror detail để hỗ trợ việc xử lý sự cố.

Trong mô hình dưới đây, chúng ta có hai router kết nối trực tiếp:

Vấn đề về trùng Router ID (RID)

Trong mạng định tuyến trạng thái liên kết (link-state), điều cực kỳ quan trọng là không có hai router nào sử dụng cùng một giá trị RID, vì những lý do sau:

– RID là một trong những phương thức để xác định xem một LSA (Link-State Advertisement) đã tồn tại trong cơ sở dữ liệu hay chưa. Nếu hai router dùng cùng một RID, cơ sở dữ liệu LSDB có thể không đồng bộ giữa các router.

–  Thuật toán Dijkstra sử dụng RID để tính toán đường đi ngắn nhất. Nếu RID bị trùng, một router có thể không xây dựng được một sơ đồ định tuyến không có vòng lặp.

Trên Router1, chúng tôi đã thực hiện các lệnh sau:

thuongndh@Router1> show ospf interface
Interface       State    Area       DR ID            BDR ID     Nbrs
ge-0/0/1.112    PtToPt   0.0.0.0    0.0.0.0          0.0.0.0    0
lo0.0           DR       0.0.0.0    163.121.1.1      0.0.0.0    0

thuongndh@Router1> show ospf neighbor

thuongndh@Router1> show interfaces lo0.0
Logical interface lo0.0 (Index 66) (SNMP ifIndex 16)
Flags: SNMP-Traps Encapsulation: Unspecified
Input packets : 12
Output packets: 12
Security: Zone: Null
Protocol inet, MTU: Unlimited
Flags: Sendbcast-pkt-to-re
Addresses, Flags: Is-Default Is-Primary
Local: 163.121.1.1

thuongndh@Router1> show configuration routing-options
router-id 163.121.1.1;

Trên Router 2

thuongndh@Router2> show ospf interface
Interface       State       Area        DR ID         BDR ID      Nbrs
ge-0/0/1.112    PtToPt      0.0.0.0     0.0.0.0       0.0.0.0     0
lo0.0           DR          0.0.0.0     163.121.1.1   0.0.0.0     0

thuongndh@Router2> show ospf neighbors

thuongndh@Router2> show interfaces lo0.0
Logical interface lo0.0 (Index 66) (SNMP ifIndex 16)
Flags: SNMP-Traps Encapsulation: Unspecified
Input packets : 0
Output packets: 0
Security: Zone: Null
Protocol inet, MTU: Unlimited
Flags: Sendbcast-pkt-to-re
Addresses, Flags: Is-Default Is-Primary
Local: 163.121.1.2

thuongndh@Router2> show configuration routing-options
router-id 163.121.1.1;

Như bạn thấy, cả hai router đều dùng chung router-id163.121.1.1, gây ra xung đột.

Chúng tôi đã bật traceoptions trên Router1 với cờ helloerror, và nhận được nhật ký sau:

Apr 29 20:16:16.391667 OSPF rcvd Hello 10.100.12.2 -> 224.0.0.5 (ge-0/0/1.112 IFL 71 area 0.0.0.0)
Apr 29 20:16:16.391678 Version 2, length 44, ID 163.121.1.1, area 0.0.0.0
Apr 29 20:16:16.391684 checksum 0x0, authtype 0
Apr 29 20:16:16.391690 mask 255.255.255.252, hello_ivl 10, opts 0x12, prio 128
Apr 29 20:16:16.391696 dead_ivl 40, DR 0.0.0.0, BDR 0.0.0.0
Apr 29 20:16:16.391702 OSPF packet ignored: our router ID received from 10.100.12.2 on intf ge-0/0/1.112 area 0.0.0.0

Sau khi khắc phục sự cố RID trùng, ta thấy trên Router2:

thuongndh@Router2> show ospf interface
Interface      State     Area         DR ID           BDR ID        Nbrs
ge-0/0/1.112   PtToPt    0.0.0.0      0.0.0.0         0.0.0.0       1
lo0.0          DR        0.0.0.0      163.121.1.2     0.0.0.0       0

thuongndh@Router2> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
10.100.12.1      ge-0/0/1.112           Full      163.121.1.1      128    35

thuongndh@Router2>

Mặt nạ mạng không khớp (Mismatched subnet masks)

Mặt nạ mạng sai hoặc địa chỉ IP sai ở giao diện có thể khiến OSPF không thiết lập được. Trong ví dụ này, địa chỉ IP trên Router1 được cấu hình là /24 thay vì /30. Mặc dù vẫn ping được, nhưng quan hệ OSPF không hình thành. Nhật ký traceoptions cho biết lý do:

thuongndh@Router1> ping 10.100.12.2 rapid
PING 10.100.12.2 (10.100.12.2): 56 data bytes
!!!!!
— 10.100.12.2 ping statistics —
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.396/0.840/2.211/0.687 ms

thuongndh@Router1> show log OSPFLOG
Apr 29 20:30:03.878646   OSPF rcvd Hello 10.100.12.2 -> 224.0.0.5 (ge-0/0/1.112 IFL 71 area 0.0.0.0)
Apr 29 20:30:03.878668   Version 2, length 44, ID 163.121.1.2, area 0.0.0.0
Apr 29 20:30:03.878674   checksum 0x0, authtype 0
Apr 29 20:30:03.878680   mask 255.255.255.252, hello_ivl 10, opts 0x12, prio 128
Apr 29 20:30:03.878686   dead_ivl 40, DR 0.0.0.0, BDR 0.0.0.0
Apr 29 20:30:03.878692   OSPF packet ignored: netmask 255.255.255.252 mismatch from 10.100.12.2 on intf ge-0/0/1.112 area 0.0.0.0

Không khớp xác thực (Authentication mismatches)

Nếu có sự không khớp về xác thực (authentication), quan hệ OSPF sẽ thất bại. Nếu dùng plain-text authentication, có thể kiểm tra mật khẩu bằng lệnh: monitor traffic interface ge-0/0/1.112 detail

monitor traffic interface ge-0/0/1.112 detail
Address resolution is ON. Use to avoid any reverse lookup delay.
Address resolution timeout is 4s.
Listening on ge-0/0/1.112, capture size 1514 bytesReverse lookup for 224.0.0.2 failed (check DNS reachability).
Other reverse lookup failures will not be reported.
Use to avoid reverse lookups on IP addresses.20:49:56.476501  In IP (tos 0xc0, ttl   1, id 21466, offset 0, flags [none], proto: OSPF (89), length: 76) 10.100.12.2 > 224.0.0.5: OSPFv2, Hello, length 56 [len 44]
Router-ID 163.121.1.2, Backbone Area, Authentication Type: simple (1)
Simple text password: Jun!p3r
Options [External, LLS]
Hello Timer 10s, Dead Timer 40s, Mask 255.255.255.252, Priority 128
LLS: checksum: 0xfff6, length: 3
Extended Options (1), length: 4
Options: 0x00000001 [LSDB resync]

Nếu sử dụng xác thực mã hóa, bạn không thể giải mã khóa và cần cấu hình lại mật khẩu trên cả hai router.

Và chúng ta cũng có thể tìm thấy sự không khớp loại xác thực trong nhật ký traceoptions (Đơn giản/không xác thực) theo O/P bên dưới

Apr 29 20:49:38.784663  OSPF sent Hello 10.100.12.1 -> 224.0.0.5 (ge-0/0/1.112 IFL 71 area 0.0.0.0)
Apr 29 20:49:38.784669  Version 2, length 44, ID 163.121.1.1, area 0.0.0.0
Apr 29 20:49:38.784675  mask 255.255.255.252, hello_ivl 10, opts 0x12, prio 128
Apr 29 20:49:38.784681  dead_ivl 40, DR 0.0.0.0, BDR 0.0.0.0
Apr 29 20:49:39.598405  OSPF packet ignored: authentication type mismatch (1) from 10.100.12.2

Ngoài ra, chúng ta có thể tìm thấy cờ xác thực trong lệnh show ospf interface detail O/P như sau trên cả hai bộ định tuyến.

Trên Router 1

thuongndh@Router1> show ospf interface ge-0/0/1.112 detail
Interface State Area DR ID BDR ID Nbrs
ge-0/0/1.112 PtToPt 0.0.0.0 0.0.0.0 0.0.0.0 0
Type: P2P, Address: 10.100.12.1, Mask: 255.255.255.252, MTU: 1500, Cost: 1
Adj count: 0
Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: None
Protection type: None
Topology default (ID 0) -> Cost: 1

Trên Router 2

thuongndh@Router2# run show ospf interface ge-0/0/1.112 detail
Interface State Area DR ID BDR ID Nbrs
ge-0/0/1.112 DR 0.0.0.0 163.121.1.2 0.0.0.0 0
Type: LAN, Address: 10.100.12.2, Mask: 255.255.255.252, MTU: 1500, Cost: 1
DR addr: 10.100.12.2, Priority: 128
Adj count: 0
Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: Password
Protection type: None
Topology default (ID 0) -> Cost: 1

Tìm hiểu về EtherChannel

EtherChannel (còn gọi là Port-Channel, LAG – Link Aggregation Group hay Eth-Trunk) là công nghệ gom nhiều đường truyền vật lý thành một kết nối logic nhằm mục đích:

  • Tạo liên kết dự phòng

  • Tăng băng thông bằng cách chia tải trên tất cả các đường truyền

  • Giải quyết vòng lặp khi kết nối nhiều đường giữa các switch

Cách cấu hình EtherChannel trên Switch Cisco

Các loại EtherChannel

Có 2 kiểu:

  • Static Link Aggregation
  • Dynamic Link Aggregation

    1. Static Link Aggregation 

    Đây là phương pháp cấu hình thủ công, trong đó nhiều liên kết vật lý được gom lại để tạo ra một liên kết logic có băng thông cao hơn và khả năng dự phòng. Hình thức này thường dùng khi hệ thống không hỗ trợ gom kênh động hoặc mạng hiếm khi thay đổi.

    Đặc điểm của Static Link Aggregation:

    • Cấu hình thủ công ở cả hai đầu kết nối (không có cơ chế đàm phán như LACP – Link Aggregation Control Protocol).

    • Cần đảm bảo các cổng được cấu hình giống hệt nhau (speed, duplex, VLAN…).

    • Không hỗ trợ phát hiện lỗi cấu hình tự động – dễ gây lỗi nếu cấu hình lệch nhau.

    Cách cấu hình Static EtherChannel:

    ✅ Điều kiện bắt buộc: Cả hai switch phải được cấu hình ở chế độ “on”. Các chế độ khác sẽ không hoạt động.

    Trên switch Sx:

    Sx(config-if-range)#channel-group 1 mode on

    Trên switch Sy:

    Sy(config-if-range)#channel-group 1 mode on

    2. Dynamic Link Aggregation 

    Phương pháp này tự động gom nhiều cổng vật lý thành một cổng logic. Giống như static, nó cũng giúp tăng băng thông và độ ổn định, nhưng dễ quản lý hơn.

    Gồm hai giao thức:

    • LACP (Link Aggregation Control Protocol) – Chuẩn mở IEEE 802.3ad

    • PAgP (Port Aggregation Protocol) – Giao thức độc quyền của Cisco

    LACP – Giao thức gom kênh mở

    • Cho phép tối đa 16 liên kết, trong đó 8 liên kết hoạt động8 dự phòng

    • Hoạt động ở hai chế độ:

      • Active: Luôn gửi gói LACP

      • Passive: Chỉ phản hồi nếu nhận được gói LACP

    Cấu hình LACP – Active Mode:

    Cả hai switch ở chế độ active:

    Sx(config-if-range)#channel-group 1 mode active
    
    Sy(config-if-range)#channel-group 1 mode active

    Một switch active, một switch passive:

    Sx(config-if-range)#channel-group 1 mode active
    Sy(config-if-range)#channel-group 1 mode passive

    * Lưu ý:

    Nếu cả hai switch đều ở chế độ passive, EtherChannel sẽ không được thiết lập, vì cả hai đều chờ nhận gói LACP nhưng không ai gửi.

    PAgP – Giao thức gom kênh riêng của Cisco

    • Gom tối đa 8 liên kết thành một cổng logic

    • Có hai chế độ hoạt động:

      • Desirable: Chủ động gửi gói PAgP

      • Auto: Chờ nhận gói PAgP từ thiết bị khác

    Cấu hình PAgP – Desirable Mode:

    Cả hai switch ở chế độ desirable:

    Sx(config-if-range)#channel-group 1 mode desirable
    Sy(config-if-range)#channel-group 1 mode desirable

    Một switch desirable, một switch auto:

    Sx(config-if-range)#channel-group 1 mode desirable
    Sy(config-if-range)#channel-group 1 mode auto

    Lưu ý:

    Trong chế độ này, thiết bị không gửi gói PAgP, mà chờ nhận gói từ thiết bị ở chế độ desirable. Nếu không có thiết bị nào gửi gói (tức cả hai ở auto), liên kết sẽ không được thiết lập.

    Cấu hình HA Juniper SRX340 Router

    Trước khi bắt đầu cấu hình cluster, hãy xóa hết cấu hình hiện có để tránh lỗi phát sinh  trong quá trình cấu hình cluster. Trong mỗi thiết bị srx thực hiện các bước sau:

    Đầu tiên, hãy xóa tất cả các logical interface dùng cho control link/plane(ge-0/0/1) & Data/fabric link/plane(ge-0/0/2). 

    ***Note: Control link và Data link khác nhau ở mỗi model SRX

    delete system host-namedelete vlans delete interfaces vlan delete security delete interfaces ge-0/0/1 delete interfaces ge-0/0/2 delete interfaces ge-0/0/3 unit 0 family ethernet-switching delete interfaces ge-0/0/4 unit 0 family ethernet-switching

    Sau khi xoá kiểm tra và chắc chắn rằng  không còn ethernet-switching nào 

    root@srx1# show | match ethernet-switching | count
    Count: 0 lines
    [edit]
    root@srx1#

    Sau đó, kết nối vật lý hai thiết bị và đảm bảo rằng chúng là cùng một loại. 

    Ví dụ, trên SRX340 kết nối cổng control ports trên node 0 và node 1.

    ***Lưu ý: Đối với các thiết bị SRX300, SRX320, SRX340 và SRX345, hãy kết nối ge-0/0/1 trên node 0 với ge-0/0/1 trên node 1.

    1. Cấu hinh hai thiết bị ở chế độ cluster và khởi động lại. Việc cấu hình được thực hiện trên cả hai thiết bị

    On node 0:
    ---------------
    user@host> set chassis cluster cluster-id 1 node 0 reboot
    
    On node 1:
    ---------------
    user@host> set chassis cluster cluster-id 1 node 1 reboot

    Sau khi khởi động lại kiểm tra tại dấu nhắc của srx1 node0, bạn sẽ thấy dấu nhắc thay đổi như bên dưới: 

    {hold:node0}
    root@srx1>
    {secondary:node0}
    root@srx1>
    {primary:node0}
    root@srx1>

    Kiểm tra tình trạng cluster

    root@srx1> show chassis cluster status
    Cluster ID: 1
    Node                  Priority          Status    Preempt  Manual failover
    
    Redundancy group: 0 , Failover count: 1
        node0                   1           primary        no       no
        node1                   1           secondary      no       no

    Sau khi cluster được thiết lập, đối với thiết bị SRX340 interface ge-0/0/1 trên node 1 sẽ chuyển thành ge-5/0/1.

     2. Cấu hình tên thiết bị và địa chỉ IP quản lý cho mỗi thiết bị, việc cấu hình chỉ thực hiện trên node đầu tiên (srx-node0)

    set groups node0 system host-name srx-nd0
    set groups node0 interfaces fxp0 unit 0 family inet address 192.168.33.1/24
    set groups node1 system host-name srx-nd1
    set groups node1 interfaces fxp0 unit 0 family inet address 192.168.33.2/24

    3. Cấu hình ‘apply-groups’

    set apply-groups "${node}"

    4. Định nghĩa các interfaces được sử dụng cho kết nối fab (data plane links for RTO sync) bằng cách sử dụng các interfaces ge-0/0/2 từ mỗi node. Việc cấu hình các liên kết fabric chỉ thực hiện trên node đầu tiên (srx-node0)

    set interfaces fab0 fabric-options member-interfaces  ge-0/0/2
    set interfaces fab1 fabric-options member-interfaces  ge-5/0/2

    # Sau khi commit, cấu hình cũng sẽ đồng bộ vào node srx-node1. Bây giờ hãy kiểm tra cluster interfaces status 

    root@srx1> show chassis cluster interfaces
    Control link 0 name: fxp1
    Control link status: Up
    
    Fabric interfaces:
    Name    Child-interface    Status
    fab0       fe-0/0/5          up
    fab0
    fab1       fe-2/0/5          up
    fab1
    Fabric link status: Up

    5. Thiết lập redundancy group 0 cho Routing Engine failover properties và thiết lập redundancy group 1  cho tất cả các interfaces. Một cluster không có redundancy group là vô dụng.  RG0 được sử dụng cho control plane và RG1 sẽ là RG dịch vụ.

    set chassis cluster reth-count 2
    set chassis cluster redundancy-group 0 node 0 priority 200
    set chassis cluster redundancy-group 0 node 1 priority 100
    set chassis cluster redundancy-group 1 node 0 priority 200
    set chassis cluster redundancy-group 1 node 1 priority 100

    6. Thiết lập interface monitoring để giám sát tình trạng của các interface và kích hoạt redundancy group failover 

    ****** Lưu ý: Juniper không khuyến nghị interface monitoring  cho redundancy group 0 vì nó khiến control plane chuyển từ node này sang node khác trong trường hợp xảy ra lỗi interface.

    set chassis cluster redundancy-group 1 interface-monitor ge-0/0/3 weight 255
    set chassis cluster redundancy-group 1 interface-monitor ge-0/0/4 weight 255
    set chassis cluster redundancy-group 1 interface-monitor ge-5/0/3 weight 255
    set chassis cluster redundancy-group 1 interface-monitor ge-5/0/4 weight 255

    #Hãy kiểm tra cluster configuration

    {primary:node0}
    root@SRX> show configuration chassis cluster
    
    reth-count 2;
    redundancy-group 0 {
        node 0 priority 200;
        node 1 priority 100;
    }
    redundancy-group 1 {
        node 0 priority 200;
        node 1 priority 100;
        preempt;
        interface-monitor {
            ge-0/0/3 weight 255;
            ge-0/0/4 weight 255;
            ge-5/0/3 weight 255;
            ge-5/0/4 weight 255;
        }
    }

    7. Thiết lập các redundant ethernet (reth) và chỉ định redundant interface cho 1 zone.

    set interfaces ge-0/0/3 gigether-options redundant-parent reth0
    set interfaces ge-5/0/3 gigether-options redundant-parent reth0
    set interfaces reth0 redundant-ether-options redundancy-group 1
    set interfaces reth0 unit 0 family inet address 198.51.100.1/24
    
    set interfaces  ge-0/0/4 gigether-options redundant-parent reth1
    set interfaces  ge-5/0/4 gigether-options redundant-parent reth1
    set interfaces reth1 redundant-ether-options redundancy-group 1
    set interfaces reth1 unit 0 family inet address 203.0.113.233/24 
    
    set security zones security-zone Trusted
    set security zones security-zone Untrusted
    set security zones security-zone Trusted host-inbound-traffic system-services all
    set security zones security-zone Untrusted host-inbound-traffic system-services all
    set security zones security-zone Untrust interfaces reth1.0
    set security zones security-zone Trust interfaces reth0.0

    #Nếu bạn muốn tạo một subinterface với vlan tagging, hãy làm như sau

    set interfaces reth0 vlan-tagging
    set interfaces reth0 unit 150 vlan-id 150
    set interfaces reth0 unit 150 family inet address 192.168.150.200/24
    set interfaces reth1 unit 0 family inet address 10.16.9.1/24
    
    set security zones security-zone Trusted interfaces reth0.150
    set security zones security-zone Untrusted interfaces reth1.0

    Các lệnh kiểm tra và xác minh cấu hình 

    show chassis cluster status
    show chassis cluster interfaces
    show chassis cluster statistics
    show chassis cluster control-plane statistics
    show chassis cluster data-plane statistics
    show chassis cluster status redundancy-group 1

    show configuration

    root@srx# run show configuration
    ## Last commit: 2017-08-07 16:41:31 GMT+6 by root
    version 15.1X49-D90.7;
    groups {
        node0 {
            system {
                host-name srx-nd0;
            }
            interfaces {
                fxp0 {
                    unit 0 {
                        family inet {
                            address 192.168.33.1/24;
                        }
                    }
                }
            }
        }
        node1 {
            system {
                host-name srx-nd1;
            }
            interfaces {
                fxp0 {
                    unit 0 {
                        family inet {
                            address 192.168.33.2/24;
                        }
                    }
                }
            }
        }
    }
    apply-groups "${node}";
    system {
        auto-snapshot;
        time-zone GMT+6;
        root-authentication {
            encrypted-password "$5$ZsCeZsruXu$TZ8Kvvzb/mxQOMqf8AxJkFqW.r5OZFnrdagxRl8LSH."; ## SECRET-DATA
     
        }
        services {
            ssh;
            telnet;
    
            }
        }
     
    }
    chassis {
        cluster {
            reth-count 2;
            redundancy-group 0 {
                node 0 priority 200;
                node 1 priority 100;
            }
            redundancy-group 1 {
                node 0 priority 200;
                node 1 priority 100;
                preempt;
                interface-monitor {
                    ge-0/0/3 weight 255;
                    ge-0/0/4 weight 255;
                    ge-5/0/3 weight 255;
                    ge-5/0/4 weight 255;
                }
            }
        }
    }
    security {
        screen {
            ids-option untrust-screen {
                icmp {
                    ping-death;
                }
                ip {
                    source-route-option;
                    tear-drop;
                }
                tcp {
                    syn-flood {
                        alarm-threshold 1024;
                        attack-threshold 200;
                        source-threshold 1024;
                        destination-threshold 2048;
                        timeout 20;
                    }
                    land;
                }
            }
        }
        nat {
            source {
                rule-set nsw_srcnat {
                    from zone Internal;
                    to zone Internet;
                    rule nsw-src-interface {
                        match {
                            source-address 0.0.0.0/0;
                            destination-address 0.0.0.0/0;
                        }
                        then {
                            source-nat {
                                interface;
                            }
                        }
                    }
                }
            }
        }
        policies {
            from-zone Internal to-zone Internet {
                policy All_Internal_Internet {
                    match {
                        source-address any;
                        destination-address any;
                        application any;
                    }
                    then {
                        permit;
                    }
                }
            }
        }
        zones {
            security-zone Internal;
            security-zone Internet {
                screen untrust-screen;
            }
            security-zone Trusted {
                host-inbound-traffic {
                    system-services {
                        all;
                    }
                }
                interfaces {
                    reth0.0;
                }
            }
            security-zone Untrusted {
                host-inbound-traffic {
                    system-services {
                        all;
                    }
                }
                interfaces {
                    reth1.0;
                }
            }
        }
    }
    interfaces {
        ge-0/0/3 {
            gigether-options {
                redundant-parent reth0;
            }
        }
        ge-0/0/4 {
            gigether-options {
                redundant-parent reth1;
            }
        }
        ge-5/0/3 {
            gigether-options {
                redundant-parent reth0;
            }
        }
        ge-5/0/4 {
            gigether-options {
                redundant-parent reth1;
            }
        }
        fab0 {
            fabric-options {
                member-interfaces {
                    ge-0/0/2;
                }
            }
        }
        fab1 {
            fabric-options {
                member-interfaces {
                    ge-5/0/2;
                }
            }
        }
        fxp0 {
            unit 0 {
                family inet;
            }
        }
        reth0 {
       
            redundant-ether-options {
                redundancy-group 1;
            }
            unit 0 {
                family inet {
                    address 198.51.100.1/24;
                }
            }
        }
        reth1 {
            redundant-ether-options {
                redundancy-group 1;
            }
            unit 0 {
                family inet {
                    address 203.0.113.233/24;
                }

    Initial HPE Comware Switch Configuration

    Initial configuration (Best Practices) for HPE Comware switches based on My deep personal experience and HPE reference guides, with focus on Security. Only the Best to the Best. Let’s go!

    Out of box switch has no configuration but this is not truth. Switch will try to allocate IP address on Management port. With Zero Provisioning technology we can push basic configuration to the switch automatically by connecting Management port to Out of Band Network. In the next articles I will share the exacts steps.

    Let’s connect to the new switch with USB to console cable.

    Startup/Backup Configuration files

    After switch is starting up press CTRL+D or CTRL+C to quit from auto configuration.

    Enter to configuration mode with System-view. Configure hostname with sysname command. I recommend to set startup/backup configuration files with the same name as the switch and not the default name: startup.cfg. In case you have centralised backup server, it is nicer to have all backups with different names. Press save followed by file name (don’t forget .cfg extension). Same for the backup configuration file: save backup. With display startup command you can verify startup and backup configuration files.

    RSA/DSA keys

    1024-bit keys are become crackable between 2006 and 2010 and that 2048-bit keys are sufficient until 2030. The National Institute of Standards (NIST) recommends 2048-bit keys for RSA.

     

    LLDP, STP

    LLDP is not enabled by default. There is no way to enable LLDP on specific ports without enabled it globally. Enable LLDP globally and keep it only on switch to switch ports. Enter lldp global enable command. Spanning is also not enabled by default, so let’s enable it with stp global enable command. In addition strongly recommended in modern Networks move to dot1t path cost, enter stp pathcost-standard dot1t. (Be careful, it will recalculate stp cost on all links

    VPN Instance (VRF-Lite)

    In case that HPE device supports VPN Instance feature, I am strongly recommend to configure VPN Instance on Management interface (completely separate routing table for management). In addition, Static routes, NTP, SNMP, Syslog and TACACS configurations will run with VPN Instance feature.

    ip vpn-instance mgmt command will create VPN Instance named mgmt. Then we need to bind management interface (it will delete IP address if you have one).

     int M-GigabitEthernet 0/0/0

    ip binding vpn-instance mgmt

     description HPE-TEST

    ip address 10.0.0.1 24

    Login banner

    To configure the banner that displays when the user logs in to a HPE switch, use the header login command. Use “%” in beginning of the banner and in the end.

    header login %

    ************************************

    *  Your Banner Here      *

    ************************************

    %

    Console password

    By default there is no password on the console port. To configure the console to require authentication use the following commands:

    line aux 0

     authentication-mode password

     user-role network-admin

     set authentication password simple 123456

     idle-timeout 5 0

    SSH

    For SSH connection let’s create local user admin with inbound protocol SSH only:

    local-user admin class manage

     password simple 123456

     service-type ssh

     authorization-attribute user-role network-admin

    #

    line vty 0 63

     authentication-mode scheme

     user-role network-admin

     protocol inbound ssh

     idle-timeout 15 0

    #

    ssh server enable

     ssh server authentication-retries 5

     ssh server authentication-timeout 30

    Hardening

    Disable copyright info,USB port and unused services.

    usb disable

    undo copyright-info enable

    In addition, if you have HTTP or Telnet running, please disabled it. HTTPS and DHCP can be also disabled, unless you are using them. Personal, I am using only CLI.

    undo ip http enable

    undo ip https enable

    undo telnet server enable

    undo dhcp enable

    Version 1 of the SSH protocol has irremediable problems and multiple vulnerabilities. Strongly recommended to disable ssh v1 compatibility:

    undo ssh server compatible-ssh1x

    Verification can be done with display ssh server status command.

    To verify TCP/UDP open ports use display tcp and display udp:

    Enable BPDU protection, all access ports configure as edge ports (portfast). All unused ports should be moved to some unused VLAN and must be Shutdown. For example, we have 10 servers connected to first 10 ports:

    vlan 666

    description Null

    name Null

    *All unused ports will be configured in VLAN 666.

    **Always put name and description after creating VLANs.

    int range GigabitEthernet 1/0/1 to GigabitEthernet 1/0/10

    stp edged-port

    Enable BPDU protection globally:

    stp bpdu-protection

    —————————————————————————————————————

    In the next article I will share Best Practices for Monitoring configurations: NTPv4, Info Center (Syslog), SNMPv3 and TACACs.

    IRF stack configuration (2 x HPE 5130 switches)

    Introduction

    In this article we will setup an IRF stack with two HP 5130 switches that run Comware OS.

    What is IRF?

    IRF (Intelligent Resilient Framework) is a proprietary virtualization/stacking technology used in some HPE switches. It has been developed originally by H3C, but later HPE acquired H3C.

    IRF allows us to interconnect several switches and manage them as a single device. Besides that those interconnected switches form a single fabric and appear as a single node to other network devices.

    IRF does not require any dedicated stacking modules, because it uses regular 10Gb Ethernet ports for stacking.

    IRF Topology

    Comware OS running switches support different number of switches in a stack depending on the switch model and the software version. The 5130 switches with the latest firmware support up to 9 switches in an IRF stack.

    Switches can be interconnected in a ring or a daisy-chain manner. In this article we will configure two 5130-24G-4SFP+ (JG932A) switches as a single IRF stack. The topology of our stack is shown below:

    The green links shown above are 10GbE connections.

    Basic Concepts.

    Below is a (very) short introduction to some of the concepts behind IRF technology. Please, read it, so you can understand why we make certain configuration changes on the switches.

    IRF Member ID.

    IRF Member ID is a unique ID that identifies a stack member. All switches in a stack should have different Member ID if we want them to form an IRF fabric. Default Member ID is 1. We will change Member ID of one of the switches.

    IRF Member Priority.

    Member priority is used to determine which switch will be selected as a master in our IRF stack. The switch with the higher priority will be elected the master. The default priority is 1.

    IRF Port.

    IRF Port is a logical interface on a switch used for communication with other stack members, and it should have at least one physical interface assigned to it. We can assign/bind several interfaces to an IRF port which will automatically become an aggregate link.

    Configuration

    Step 1. Configure IRF-SW1 (master)

    Go to Switch 1 which we want to be a master and assign it a priority 32 (the default priority is 1) . The following commands will do this:

    system-view
    irf member 1 priority 32

    You can then verify the settings on Switch 1 using display irf command:

    You can see from the output that Member ID is 1 and Priority is 32

    Step 2. Configure IRF Port on IRF-SW1

    Now let’s create and configure our IRF port on Switch 1 which is required for IRF operation. We will create logical irf-port 1/1 and assign physical ports Ten-GigabitEthernet1/0/27 and Ten-GigabitEthernet1/0/28 to it. We should shutdown the physical interfaces before we can assign them to an IRF port. Below are the commands:

    interface Ten-GigabitEthernet 1/0/27
    shutdown
    
    interface Ten-GigabitEthernet 1/0/28
    shutdown
    
    irf-port 1/1
    port group interface Ten-GigabitEthernet1/0/27
    port group interface Ten-GigabitEthernet1/0/28

    Once you have added the physical ports to an IRF port you will see a message on the console, saying that you have to save your config and activate it using irf-port-configuration active command. Before doing this we will bring up our physical interfaces:

    interface Ten-GigabitEthernet 1/0/27
    undo shutdown
    
    interface Ten-GigabitEthernet 1/0/28
    undo shutdown
    
    save
    irf-port-configuration active

    You can run display current-configuration and display irf configuration to verify the settings:

     

    Step 3. Configure IRF-SW2 (slave)

    Now let’s configure the Switch 2. The first thing we need to do is change its Member ID to 2, so it does not conflict with Switch 1. This will require a reboot. Run the following commands:

    system-view
    irf member 1 renumber 2
    save
    quit
    reboot
    You can run display irf command after reboot to make sure the new Member ID is in place:

    Step 4. Configure IRF Port on IRF-SW2

    Now we need to configure IRF port on Switch 2 and assign physical ports to it. We will create irf-port 2/2 and assign ports Ten-GigabitEthernet2/0/27 and Ten-GigabitEthernet2/0/28 to it. Note that all interface numbers now start with 2, because we have changed the Member ID of the switch.

    Again, shutdown the interfaces before adding them to IRF port:

    interface Ten-GigabitEthernet 2/0/27
    shutdown
    
    interface Ten-GigabitEthernet 2/0/28
    shutdown
    
    irf-port 2/2
    port group interface Ten-GigabitEthernet2/0/27
    port group interface Ten-GigabitEthernet2/0/28
    The display current-configuration for the Switch 2 is shown below:

    Now we can enable the interfaces and activate the IRF configuration:

    interface Ten-GigabitEthernet 2/0/27
    undo shutdown
    
    interface Ten-GigabitEthernet 2/0/28
    undo shutdown
    
    save
    irf-port-configuration active

    Once you activate the IRF configuration, the Switch 2 will detect the Switch 1 and reboot. Note that Switch 2 will lose its current configuration, because it will become a member of a stack. Switch 1 will continue to operate, because it is a master.

    Step 5. Verification

    After Switch 2 boots up they will operate as a single logical unit. The display irf command confirms this:

    As you can see, now we have a fully working IRF stack consisting of two HPE 5130 switches.

    Conclusion

    For further reading on IRF configuration you can have a look at this official guide from HP:

    https://support.hpe.com/hpsc/doc/public/display?docId=c04771708

    Thank you for reading 🙂

    Script loadbalance multiwan PPPoE RouterOS 7

    Các tính năng chính:

    1. Script cho phép bạn gửi lưu lượng từ danh sách địa chỉ đặc biệt qua kết  nối pppoe cụ thể, bỏ qua luật cân bằng tải (Ví dụ: TV của bạn luôn phải đi qua pppoe-02).

    2. Script hỗ trợ HAIRPIN-NAT

    3. Script giải quyết vấn đề multiwan khi bạn đang xây dựng các đường hầm VPN ra (openvpn, wireguard, IPSec vv). Vui lòng xem phần hồ sơ pppoe.

    4. Script thân thiện với CPU

    Trong script giả định bạn có 2 liên kết WAN pppoe:

    1. ether1 với pppoe-01 (FPT)

    2. ether2 với pppoe-02 (VNPT)

    Và 2 bridge LAN:

    1. Bridge-lan-01 (ether3, ether4, ether5)

    2. bridge-lan-02 (sử dụng sau này)

    Stack-wise Virtual with Catalyst 9K Switches!

    Gần đây, tôi đã cấu hình và triển khai nhiều Switch Cisco Catalyst 9K series. Thiết kế yêu cầu tính năng stack-wise virtual trên các thiết bị switch dòng 9606 và 9500. Vì vậy, tôi nghĩ rằng tôi sẽ dành một chút thời gian để chia sẻ với mọi người về stack-wise virtual là gì, cách cấu hình nó và một số lưu ý mà tôi đã tìm thấy trong quá trình này. 

    Stack-wise là gì ?

    Hãy bắt đầu với câu hỏi ? stack-wise virtual là gì ?

    Tính năng Stacking đã tồn tại rất lâu trong các  thiết bị Switch Cisco Catalyst.  Bạn có thể thực hiện việc xếp chồng nhiều switch vật lý với nhau nhưng bảng MAC của chúng kết hợp với nhau thành 1 bảng MAC duy nhất. Về mặt logic, chúng là nhiều switch, nhưng với control plane chúng hoạt động như một switch. Vì vậy, toàn bộ switch được điều khiển như một switch duy nhất.

    Stack-wise virtual là cách kết nối các thiết bị switch theo kiểu xếp chồng được sử dụng trên dòng switch 3K,  9300 trở lên và một số thiết bị switch dòng 2900.  Chú ý: Stack-wise virtual không được nhầm lẫn với Nexus VPC – Sự khác biệt chính ở đây là với Nexus VPC, các thiết bị switch vẫn hoạt động độc lập với nhau từ góc độ control plane và quản lý. Bạn đang quản lý hai switch riêng biệt. Với Stackwise-Virtual và VSS cũ hơn, bạn có hai switch vật lý nhưng bạn đang quản lý một switch duy nhất.

    Tại sao sử dụng Stackwise ? 

    Với Stackwise, chúng ta có thể giải quyết một cặp switch dự phòng như một switch logic duy nhất, thay vì quản lý hai switch riêng biệt. Nếu không sử dụng Stackwise thì sẽ phải chú ý thêm đến Spanning Tree và có thể thêm vào Giao thức dự phòng layer 3 First Hop như VRRP hoặc HSRP. 

    Yêu cầu Stackwise

    Có một số yêu cầu về OS cho Stackwise-Virtual tùy thuộc vào nền tảng phần cứng đang chạy.

    • 16.8.1 hoặc mới hơn cung cấp hỗ trợ cho Catalyst 3850XS và tất cả các thiết bị dòng 9500
    • 16.9.1 hoặc mới hơn trên dòng Catalyst 9400
    • 16.12.1 hoặc mới hơn trên các thiết bị Catalyst 9606 – dual sup – vì vậy chỉ có một card sup cho mỗi khung. Nếu cần quad supervisor sẽ cần IOS-XE 17.2.1 hoặc mới hơn.

    Tôi nghĩ điều quan trọng cần bổ sung ở đây là hỗ trợ quad-sup không được tích hợp sẵn cho đến 17.2.1. Nếu dual sup trên mỗi khung và chạy phiên bản iOS previous đến 17.2.1 thì một cards sup trong mỗi chassis sẽ không được sử dụng. cards sup thậm chí sẽ không ở chế độ hot standby. Vì vậy, nếu cards sup trong khung lỗi thì Stackwise sẽ chuyển đổi dự phòng sang khung khác cho đến khi card sup bị lỗi được thay thế. 17.2.1 sẽ sử dụng đầy đủ cả bốn cards supervisor

    Cáp

    Bạn cũng sẽ cần tạo kết nối giữa các cặp switch. Có hai kết nối cho Switch Virtual Link và hai kết nối cho Dual Active Detection.

    Liên kết Switch Virtual link được sử dụng để gửi control plane và data plane giữa hai thiết bị switch. Vì vậy, đây là kết nối tốc độ cao, băng thông lớn. Hình bên dưới các Switch Virtual Links là Cáp quang 40G QSFP.

    Các Dual Active Detection links được sử dụng phát hiện lỗi để switch stand by có thể đảm nhận quyền điều khiển, nếu cần. Active Detection links có băng thông thấp hơn, nhưng các liên kết tốc độ cao được sử dụng. Hình bên dưới các liên kết này đang sử dụng kết nối 10G SR SFP + và LC-LC.

    Licensing

    Không có giấy phép cụ thể nào được yêu cầu cho Stackwise-Virtual. Đây là một tính năng có sẵn 

    CẬP NHẬT: Hiện có yêu cầu cấp phép Network Advantage trên nền tảng CAT 9K.

    Cấu hình

    Configure Stack-wise Virtual ! tôi có 2 con Cat 9500. 

    Trên switch 1:

    switch#config t
    switch(config)#
    switch(config)#stackwise-virtual
    Please reload the switch for Stackwise Virtual configuration to take effect
    Upon reboot, the config will be part of running config but not part of start up config.
    Switch(config-stackwise-virtual)# domain 10
    Switch(config-stackwise-virtual)#exit
    Switch(config)#interface Hu1/0/51
    Switch(config-if)# description STACKWISE-VIRTUAL
    Switch(config-if)# stackwise-virtual link 1
    WARNING: SVL configuration will be ignored  on lower (1G) speed.
    WARNING: All the extraneous configurations will be removed for HundredGigE1/0/51 on reboot
    INFO: Upon reboot, the config will be part of running config but not part of start up config.
    Switch(config-if)#interface Hu1/0/52
    Switch(config-if)# description STACKWISE-VIRTUAL
    Switch(config-if)# stackwise-virtual link 1
    WARNING: SVL configuration will be ignored  on lower (1G) speed.
    WARNING: All the extraneous configurations will be removed for HundredGigE1/0/52 on reboot
    INFO: Upon reboot, the config will be part of running config but not part of start up config.
    Switch(config-if)#
    Switch(config-if)#interface TwentyFiveGigE1/0/47
    Switch(config-if)# description STACKWISE-VIRTUAL
    Switch(config-if)# stackwise-virtual dual-active-detection
    WARNING: All the extraneous configurations will be removed for TwentyFiveGigE1/0/47 on reboot.
    INFO: Upon reboot, the config will be part of running config but not part of start up config.
    Switch(config-if)#interface TwentyFiveGigE1/0/48
    Switch(config-if)# description STACKWISE-VIRTUAL
    Switch(config-if)# stackwise-virtual dual-active-detection
    WARNING: All the extraneous configurations will be removed for TwentyFiveGigE1/0/48 on reboot.
    INFO: Upon reboot, the config will be part of running config but not part of start up config.
    witch(config-if)#^Z
    Switch#copy run start
    Destination filename [startup-config]?
    Building configuration...
    [OK]
    Switch#reload
    Proceed with reload? [confirm]

    Domain cho switch biết chúng đang ở trong domain nào. Khi hai switch cùng một domain, chúng biết rằng chúng được ghép nối với nhau. Trong cấu hình ví dụ này, domain là 10. Mọi domain có giá trị từ 1 đến 255 đều hợp lệ.

    Mô tả cho các port kết nối là không bắt buộc, tôi làm điều đó chỉ vì lợi ích của người vận hành. Tôi là một kỹ sư triển khai nên sau khi hệ thống được triển khai, một nhóm kỹ sư khác sẽ vận hành nó. Tôi muốn gắn nhãn mô tả cho mọi thứ tôi làm để các kỹ sư theo dõi biết đó là gì. Nhưng bạn có thể thấy tôi định cấu hình các port tốc độ nhanh hơn cho Switch Virtual Link và các liên kết tốc độ thấp hơn cho Dual Active Detection links

    Hãy chuyển sang Switch 2 !

    Các lệnh trên switch 2 và switch 1 sẽ hoàn toàn giống nhau, ngoại trừ tập lệnh đầu tiên.

    Switch#switch ren
    Switch#switch renumber 2
    WARNING: Changing the switch number may result in a configuration change for that switch.  The interface configuration associated with the old switch number will remain as a provisioned configuration. New Switch Number will be effective after next reboot. Do you want to continue?[y/n]? [yes]:
    Switch#

    Sau khi khởi động lại, đây sẽ là Switch 2. Trước khi reload, chúng ta cần định cấu hình các port Stackwise giống như chúng ta đã làm trên Switch 1. Đối với Switch 2, tôi sẽ bỏ qua các mô tả vì những port này sẽ không dính vào quá trình reload.

    Switch#
    Switch#config t
    Enter configuration commands, one per line.  End with CNTL/Z.
    
    Switch(config)#stackwise-virtual
    Please reload the switch for Stackwise Virtual configuration to take effect
    Upon reboot, the config will be part of running config but not part of start up config.
    Switch(config-stackwise-virtual)#domain 10
    Switch(config-stackwise-virtual)#interface Hu1/0/51
    
    Switch(config-if)# stackwise-virtual link 1
    WARNING: SVL configuration will be ignored  on lower (1G) speed.
    WARNING: All the extraneous configurations will be removed for HundredGigE1/0/51 on reboot
    INFO: Upon reboot, the config will be part of running config but not part of start up config.
    Switch(config-if)#interface Hu1/0/52
    
    Switch(config-if)# stackwise-virtual link 1
    WARNING: SVL configuration will be ignored  on lower (1G) speed.
    WARNING: All the extraneous configurations will be removed for HundredGigE1/0/52 on reboot
    INFO: Upon reboot, the config will be part of running config but not part of start up config.
    Switch(config-if)#interface TwentyFiveGigE1/0/47
    
    Switch(config-if)# stackwise-virtual dual-active-detection
    WARNING: All the extraneous configurations will be removed for TwentyFiveGigE1/0/47 on reboot.
    INFO: Upon reboot, the config will be part of running config but not part of start up config.
    Switch(config-if)#interface TwentyFiveGigE1/0/48
    
    Switch(config-if)# stackwise-virtual dual-active-detection
    WARNING: All the extraneous configurations will be removed for TwentyFiveGigE1/0/48 on reboot.
    INFO: Upon reboot, the config will be part of running config but not part of start up config.
    Switch(config-if)#exi
    Switch(config)#exi
    Switch#copy run start
    Destination filename [startup-config]?
    Building configuration...
    [OK]
    Switch#reload
    Proceed with reload? [confirm]
    

    Khi khởi động lại, một switch sẽ trì hoãn việc khởi động và đợi Switch 2 được phát hiện và tham gia vào stack. Sau khi cả hai switch được khởi động, bạn có thể sử dụng show switch để kiểm tra stack. Bạn có thể thấy HA Sync đang được tiến hành, như sau:

    Bạn sẽ không thể sửa đổi cấu hình của switch cho đến khi HA Sync hoàn tất. Sẽ mất một vài phút. Để kiểm tra cấu hình Stackwise, hãy sử dụng show stackwise-virtual


    witch#sho switch Switch/Stack Mac Address : b0c5.3ce8.0001 - Local Mac Address Mac persistency wait time: Indefinite H/W Current Switch# Role Mac Address Priority Version State ------------------------------------------------------------------------------------- *1 Active b0c5.3ce8.3480 1 V02 Ready 2 Standby b0c5.3ce8.4a60 1 V02 HA sync in progress Switch#

     show stackwise-virtual

    Switch#sho stackwise-virtual
    Stackwise Virtual Configuration:
    --------------------------------
    Stackwise Virtual : Enabled
    Domain Number : 10
    
    Switch  Stackwise Virtual Link  Ports
    ------  ----------------------  ------
    1       1                       HundredGigE1/0/51
                                    HundredGigE1/0/52
    2       1                       HundredGigE2/0/51
                                    HundredGigE2/0/52
    
    Switch#

    Bạn sẽ thấy số của port thay đổi. Các port của switch 1 sẽ là 1/0/1 và switch 2 sẽ là 2/0/1. Con số đầu tiên là switch vật lý, vì vậy nếu là 1, chúng tôi đang giải quyết các port của Switch 1, nếu là 2 thì chúng tôi đang giải quyết các port của Switch 2. Số tiếp theo đề cập module, giống như một card có thể lắp vào. Số cuối cùng là số port. Vì vậy, 2/0/35 là port 35 trên Switch 2.

    Trên Chassis Platforms

    Quy trình tương tự này có thể được sử dụng trên Chassis Platforms Catalyst 9606. Tuy nhiên, khi khởi động lại, bạn sẽ nhận thấy điều gì đó hơi khác một chút trên số port. Các số port sẽ giống như 1/5/0/24 – 1 là Khung, 5 là Card – trên 9606 bạn có thể có 4 card ở các khe 1, 2, 5 và 6, với các khe 3 và 4 được dành riêng cho Supervisor cards – số 0 đề cập đến các module và hiện tại không có mô-đun nào có sẵn cho nền tảng 9606, nhưng điều đó có thể thay đổi và số cuối cùng là số port. Vì vậy, trong ví dụ trước, bạn có Chassis 1, line card là khe cắm 5, module 0 và port là 24.

    Cảnh báo

    Một số lưu ý quan trọng cần biết:

    Port Channels nằm trong khoảng từ 1 – 192 trên dòng switch Cat 9K – điều này không dành riêng cho Stackwise Virtual. Trên các dong switch Catalyst cũ hơn, bạn có thể có 301, 405 hoặc 550. Bạn cần cập nhật cấu hình của mình để đảm bảo các Port Channels của bạn nằm trong phạm vi hợp lệ đó.

    Ngoài ra, số Port Channels 127 và 128 được dành riêng cho Stackwise. Vì vậy, nếu bạn hiện đang sử dụng những số đó, bạn sẽ cần sửa đổi cấu hình của mình để sử dụng các Port Channels thay thế.

    VLAN 4094 được dành riêng cho Stackwise. Vì vậy, nếu bạn đang sử dụng VLAN đó hiện tại, bạn sẽ cần phải có kế hoạch di chuyển VLAN đó sang một VLAN khác.

    Juniper – Connecting Core Switch virtual chassis to SRX cluster

    Đã có rất nhiều nhầm lẫn về việc làm thế nào để kết nối 2 switch chạy  virtual chassis với SRX cluster. mọi người thường  thêm nhiều interface vật lý và tạo ra nhiều interface RETH trên SRX sau đó gán các chức năng khác nhau cho mỗi interface RETH.

    Phương pháp này không có khả năng mở rộng cao và sau một thời gian, các bạn sẽ gặp phải một mớ hỗn độn không thể quản lý được.

    Cá nhân tôi thích tạo một interface RETH duy nhất với nhiều sub interface, mỗi interface tương ứng với L2 VLAN trên switch. 

    Đối với các trường hợp không yêu cầu đặc biệt tôi thường chọn cơ chế Active/Passive cho SRX Cluster. Theo kinh nghiệm của tôi Active / Active không hoạt động tốt trong SRX Chassis Cluster. Nó cũng gây khó khăn trong việc quản lý và vận hành. Không có lợi ích thực sự trong cơ chế Active / Active và gây ra các vấn đề nghiêm trọng trong thiết bị được sử dụng với lượng traffic cao. Tùy chọn khác của tôi là sử dụng SRX làm “Router on a Stick ” –  Các switch chạy ở L2 và thực hiện tất cả L3/Routing/Security trên SRX.

    SRX là thiết bị cực kỳ mạnh mẽ sử dụng nó theo cách này mang lại khả năng bảo mật, theo dõi phiên, định tuyến và kiểm soát tốt hơn. Thiết kế này cũng sẽ hoạt động tốt khi giảm tải các chức năng định tuyến cho switch L3.

    Ví dụ bên dưới hai liên kết hoạt động trên mỗi switch vật lý, nhưng có thể mở rộng dễ dàng. Việc thêm nhiều liên kết vật lý để tăng dung lượng thực sự rất dễ và nó không ảnh hưởng đến cấu hình thực tế. Thiết kế tương tự có thể được sử dụng với nhiều switch, miễn là chúng là số chẵn

    Phía SRX có 8 liên kết được kết nối với Cluster, 4 liên kết với mỗi thiết bị. Mỗi thành viên kết nối với Interface Aggregated khác nhau trên switch (ae0 – node0, ae1 – node1), nhưng chỉ một ae / node sẽ hoạt động tại một thời điểm (đây là cách hoạt động của cụm Chassis).

    Phía EX: ae0 bao gồm 8 liên kết vật lý trên mỗi VC (4 cho mỗi thành viên). Mỗi thành viên có 2 Interface trong ae0 và 2 trong ae1. 

    Như bạn có thể thấy trong sơ đồ, lỗi của 1 thành viên EX hoặc / và 1SRX sẽ không làm gián đoạn lưu lượng và 2 đường trục liên kết sẽ   được duy trì. Tăng lên 3 trung kế liên kết sẽ yêu cầu thêm liên kết vào mỗi nhóm.

    Configuration

    1. SRX

    Interface reth1 được gán cho RE1. Tôi sử dụng weight=100, vì vậy việc chuyển đổi dự phòng (failover) có thể do lỗi của 3 liên kết trở lên. Chúng tôi muốn ngăn ngừa lỗi VC gây ra failover Chassis Cluster RE, vì các thiết bị được nối cáp đồng bộ.

     

    > show configuration chassis cluster
    control-link-recovery;
    reth-count 3;
    redundancy-group 0 {
        node 0 priority 100;
        node 1 priority 1;
    }
    /* To Core Switch */
    redundancy-group 1 {
        node 1 priority 1;
        node 0 priority 100;
        preempt;
        inactive: hold-down-interval 180;
        interface-monitor {
            ge-0/0/4 weight 100;
            ge-0/0/5 weight 100;
            ge-0/0/6 weight 100;
            ge-0/0/7 weight 100;
            ge-5/0/4 weight 100;
            ge-5/0/5 weight 100;
            ge-5/0/6 weight 100;
            ge-5/0/7 weight 100;
        }
    }

    Sau đó, tôi sử dụng subinterface để gán IP cho mỗi VLAN. Mỗi subineterface sau đó được gán cho security zone, routered, etc. 

    > show configuration interfaces reth0
    vlan-tagging;
    redundant-ether-options {
        redundancy-group 1;
    }
    unit 1 {
        vlan-id 1;
        family inet {
            address 10.0.0.1/26;
        }
    }
    unit 2 {
        vlan-id 2;
            address 10.0.0.65/26;
        }
    }
    unit 3 {
        vlan-id 3;
        family inet {
            address 10.0.0.129/25;
        }
    } 
    

    Physical Interfaces:

    ge-0/0/4 {
        description "Link to EX-01 ae0:ge-0/0/46";
        gigether-options {
            redundant-parent reth1;
        }
    }
    ge-0/0/5 {
        description "Link to EX-01 ae0:ge-1/0/47";
        gigether-options {
            redundant-parent reth1;
        }
    }
    ge-0/0/6 {
        description "Link to EX-01 ae0:ge-0/0/44";
        gigether-options {
            redundant-parent reth1;
        }
    }
    ge-0/0/7 {
        description "Link to EX-01 ae0:ge-1/0/45";
        gigether-options {
            redundant-parent reth1;
        }
    }
    
    
    
    ge-5/0/4 {
        description "Link to EX-01 ae1:ge-1/0/46";
        gigether-options {
            redundant-parent reth1;
        }
    }
    ge-5/0/5 {
        description "Link to EX-01 ae1:ge-0/0/47";
        gigether-options {
            redundant-parent reth1;
        }
    }
    ge-5/0/6 {
        description "Link to EX-01 ae1:ge-0/0/45";
        gigether-options {
            redundant-parent reth1;
        }
    }
    ge-5/0/7 {
        description "Link to EX-01 ae1:ge-1/0/44";
        gigether-options {
            redundant-parent reth1;
        }
    }
     

    2. EX Virtual Chassis

    Configuration is as simple as creating VLANs and assigning the phyiscal inerfaces to ae as per diagram above:

    ae0 {
        description "links to SRX-01 node0";
        aggregated-ether-options {
            minimum-links 2;
            link-speed 1g;
            }
        unit 0 {
            family ethernet-switching {
                interface-mode trunk;
                vlan {
                    members all;
                }
            }
        }
    }
    ae1 {
        description "links to SRX-01 node1";
        aggregated-ether-options {
            minimum-links 1;
            link-speed 1g;
        }
        unit 0 {
            family ethernet-switching {
                interface-mode trunk;
                vlan {
                    members all;
                }
            }
        }
    }
    
    
    ge-0/0/44 {
        description "ae0:Link to SRX-01 ge-0/0/6";
        ether-options {
            802.3ad ae0;
        }
    }
    ge-0/0/45 {
        description "ae1:Link to SRX-01 ge-5/0/7";
        ether-options {
            802.3ad ae1;
        }
    }
    ge-0/0/46 {
        description "ae0:Link to SRX-01 ge-0/0/4";
        ether-options {
            802.3ad ae0;
        }
    }
    ge-0/0/47 {
        description "ae1:Link to SRX-01 ge-5/0/5";
        ether-options {
            802.3ad ae1;
        }
    }
    
    
    ge-1/0/44 {
        description "ae1:Link to SRX-01 ge-5/0/6";
        ether-options {
            802.3ad ae1;
        }
    }
    ge-1/0/45 {
        description "ae0:Link to SRX-01 ge-0/0/7";
        ether-options {
            802.3ad ae0;
        }
    }
    ge-1/0/46 {
        description "ae1:Link to SRX-01 ge-5/0/4";
        ether-options {
            802.3ad ae1;
        }
    }
    ge-1/0/47 {
        description "ae0:Link to SRX-01 ge-0/0/5";
        ether-options {
            802.3ad ae0;
        }
    }