Tóm tắt: IOS XR cấu hình OSPF theo router ospf <tên> → area → interface. Junos cấu hình dưới protocols ospf area 0.0.0.0 interface. Link router-router đặt point-to-point (XR network point-to-point, Junos interface-type p2p), loopback passive, router-id cố định bằng loopback. Lý thuyết và so sánh với IS-IS xem OSPF và IS-IS.
Topo ví dụ: R1 (IOS XR, lo 192.0.2.1) nối R2 (Junos, lo 192.0.2.2) qua 198.51.100.0/31, area 0. R2 có thêm area 1 (stub) phía dưới qua ge-0/0/2.
Luồng hoạt động
flowchart LR R1["R1 IOS XR 192.0.2.1"] -- "area 0 p2p 198.51.100.0/31" --- R2["R2 Junos 192.0.2.2 ABR"] R2 -- "area 1 stub" --- R3["R3 192.0.2.3"] R1 --> N["Hello, DBD, LSR/LSU"] N --> F["FULL, SPF, cài route"]
Cấu hình
IOS XR
interface Loopback0
ipv4 address 192.0.2.1 255.255.255.255
!
interface HundredGigE0/0/0/0
mtu 9216
ipv4 address 198.51.100.0 255.255.255.254
!
router ospf CORE
router-id 192.0.2.1
log adjacency changes
auto-cost reference-bandwidth 100000
area 0
interface Loopback0
passive enable
!
interface HundredGigE0/0/0/0
network point-to-point
cost 100
!
!
!auto-cost reference-bandwidth tính bằng Mbps: 100000 = 100G, link 100G có cost 1. Đặt cùng giá trị trên mọi router.
Junos
set interfaces et-0/0/0 mtu 9216
set interfaces et-0/0/0 unit 0 family inet address 198.51.100.1/31
set interfaces lo0 unit 0 family inet address 192.0.2.2/32
set routing-options router-id 192.0.2.2
set protocols ospf reference-bandwidth 100g
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ospf area 0.0.0.0 interface et-0/0/0.0 interface-type p2p
set protocols ospf area 0.0.0.0 interface et-0/0/0.0 metric 100Area stub / NSSA
| Mục đích | IOS XR (dưới router ospf CORE) |
Junos |
|---|---|---|
| Stub (chặn LSA type 5) | area 1 → stub |
set protocols ospf area 0.0.0.1 stub |
| Totally stubby (chỉ default route) | trên ABR: area 1 → stub no-summary |
trên ABR: set protocols ospf area 0.0.0.1 stub no-summaries default-metric 10 |
| NSSA | area 1 → nssa |
set protocols ospf area 0.0.0.1 nssa |
| Interface vào area 1 | area 1 → interface GigabitEthernet0/0/0/2 |
set protocols ospf area 0.0.0.1 interface ge-0/0/2.0 |
Mọi router trong area phải cùng loại (stub/NSSA), nếu không adjacency không lên vì lệch option bit trong Hello.
Đưa route ngoài vào OSPF
! IOS XR
route-policy STATIC-TO-OSPF
if destination in (203.0.113.0/24) then
pass
endif
end-policy
!
router ospf CORE
redistribute static route-policy STATIC-TO-OSPF
!# Junos
set policy-options policy-statement STATIC-TO-OSPF term S from protocol static
set policy-options policy-statement STATIC-TO-OSPF term S from route-filter 203.0.113.0/24 exact
set policy-options policy-statement STATIC-TO-OSPF term S then accept
set protocols ospf export STATIC-TO-OSPFBackbone ISP không nên redistribute prefix khách hàng vào IGP. IGP chỉ mang loopback và link, prefix khách đi bằng BGP. Muốn chỉnh chuyển tiếp nhanh, bật BFD: XR bfd fast-detect dưới interface OSPF, Junos bfd-liveness-detection minimum-interval 100 (xem BFD, LAG, MTU).
Kiểm tra
| Mục đích | IOS XR | Junos |
|---|---|---|
| Neighbor và state | show ospf neighbor |
show ospf neighbor |
| Interface, network type, cost | show ospf interface brief |
show ospf interface detail |
| LSDB tóm tắt | show ospf database |
show ospf database |
| Router LSA của một router | show ospf database router 192.0.2.2 |
show ospf database router advertising-router 192.0.2.2 extensive |
| Route OSPF trong RIB | show route ospf |
show route protocol ospf |
Lỗi thường gặp
| Triệu chứng | Nguyên nhân | Cách xử lý |
|---|---|---|
Kẹt EXSTART / EXCHANGE |
MTU hai đầu lệch (DBD bị loại) | Sửa MTU cho khớp; không dùng ignore MTU làm giải pháp lâu dài |
| Không thấy neighbor | Lệch area, hello/dead interval, subnet, authentication, hoặc filter chặn IP protocol 89 | So show ospf interface hai đầu |
Neighbor FULL nhưng thiếu route qua link |
Một đầu p2p, một đầu broadcast | Cùng network point-to-point / interface-type p2p |
Kẹt 2WAY trên LAN |
Bình thường giữa hai DROTHER | Chỉ cần FULL với DR/BDR |
| Junos không lên adjacency với area 1 | Lệch stub/NSSA với router bên kia | Cấu hình cùng loại area hai đầu |
Route loopback thiếu /32 |
Quên đưa loopback vào OSPF | Thêm Loopback0 / lo0.0 với passive |
| Router-ID trùng, LSA nhảy liên tục | Hai router cùng router-id (copy cấu hình) | Đặt router-id theo loopback riêng |
Đổi router-id XR không ăn |
Router-id chỉ áp khi tiến trình khởi động lại | clear ospf CORE process (gây flap) |
Tham khảo
- RFC 2328: OSPF Version 2
- Cisco IOS XR – Implementing OSPF
- Juniper – OSPF User Guide
- IGP backbone ISP thường chọn IS-IS: IS-IS trên IOS XR và Junos