Lab 4-4: OSPF TRONG MẠNG NBMA DẠNG NON-BROADCASTMô tả Khi cấu hình OSPF trong môi trường NBMA như Frame Relay, điều quan trọng là phải xác định được router nào sẽ là router chỉ định DR/B
Trang 1Lab 4-4: OSPF TRONG MẠNG NBMA DẠNG NON-BROADCAST
Mô tả
Khi cấu hình OSPF trong môi trường NBMA như Frame Relay, điều quan trọng là phải xác định được router nào sẽ là router chỉ định DR/BDR trong mạng Router DR/BDR cần phải có kết nối (logical) đến tất cả các router khác trong mạng Tuỳ vào việc sử dụng network type nào (broadcast, non-broadcast, point-to-point hay point-to-multipoint) mà cách cấu hình sẽ khác nhau
Bài thực hành này mô tả mạng Frame Relay sử dụng giao thức định tuyến OSPF với network type là non-broadcast Đây là network type mặc định khi cấu hình Frame Relay trên các cổng giao tiếp Với network type loại này, router DR/BDR sẽ được chọn trong mạng, tuy nhiên mỗi router DR/BDR cần phải có danh sách các router kết nối vào mạng Frame Relay, điều này được thực hiện bằng lệnh neighbor trong cấu hình OSPF
RouterA, RouterB, RouterC kết nối vào Frame Relay Switch Các Serial interface trên RouterA, RouterC được cấu hình OSPF priority là 0 để đảm bảo cho RouterB làm DR cho mạng Trên RouterB cần dùng lệnh neighbor trong cấu hình OSPF
Cấu hình mẫu
FrameSwitch
!
hostname FrameSwitch
!
frame-relay switching
!
interface Serial0/0
no ip address
encapsulation frame-relay
Trang 2no fair-queue
clockrate 64000
frame-relay intf-type dce
frame-relay route 100 interface Serial0/1 100
!
interface Serial0/1
no ip address
encapsulation frame-relay
clockrate 64000
frame-relay intf-type dce
frame-relay route 100 interface Serial0/0 100 frame-relay route 200 interface Serial0/2 200
!
interface Serial0/2
no ip address
encapsulation frame-relay
clockrate 64000
frame-relay intf-type dce
frame-relay route 200 interface Serial0/1 200
!
ip classless
ip http server
!
Trang 3line con 0
transport input none
line aux 0
line vty 0 4
!
end
RouterA
!
version 12.0
!
hostname RouterA
!
interface Loopback0 ¬ Định nghĩa cổng ảo dùng để làm routerID
ip address 1.1.1.1 255.255.255.0
!
interface Serial0/0
ip address 192.1.1.1 255.255.255.0
encapsulation frame-relay
ip ospf priority 0 ¬ Thiết lập priority cho router để chọn lựa DR Priority là 0 nghĩa là router sẽ không tham gia vào quá trình bầu chọn DR
frame-relay map ip 192.1.1.2 100 broadcast
frame-relay map ip 192.1.1.3 100 broadcast
!
Trang 4router ospf 64
network 1.1.1.1 0.0.0.0 area 0
network 192.1.1.0 0.0.0.255 area 0
!
end
RouterB
!
hostname RouterB
!
interface Loopback0 ¬ định nghĩa cổng ảo dùng để làm routerID
ip address 2.2.2.2 255.255.255.0
!
interface Serial0/0
ip address 192.1.1.2 255.255.255.0
encapsulation frame-relay
frame-relay map ip 192.1.1.1 100 broadcast
frame-relay map ip 192.1.1.3 200 broadcast
!
router ospf 64
network 2.2.2.2 0.0.0.0 area 0
network 192.1.1.0 0.0.0.255 area 0
neighbor 192.1.1.1 ¬ Lệnh này dùng để định nghĩa neighbor trong môi trường non-broadcast
neighbor 192.1.1.3
Trang 5end
RouterC
!
hostname RouterC
!
interface Loopback0 ¬ định nghĩa cổng ảo dùng để làm routerID
ip address 3.3.3.3 255.255.255.0
!
interface Serial0/0
ip address 192.1.1.3 255.255.255.0
encapsulation frame-relay
ip ospf priority 0 ¬ Thiết lập priority cho router để chọn lựa DR Priority là 0 nghĩa là router sẽ không tham gia vào quá trình bầu chọn DR
frame-relay map ip 192.1.1.1 200 broadcast
frame-relay map ip 192.1.1.2 200 broadcast
!
router ospf 64
network 3.3.3.3 0.0.0.0 area 0
network 192.1.1.0 0.0.0.255 area 0
!
end
Kiểm tra
Từ router A xem trạng thái của cổng giao tiếp chạy OSPF bằng lệnh show ip ospf
Trang 6interface S0 Chú ý rằng network type là non-broadcast nghĩa là sẽ diễn ra quá trình chọn lựa DR và cần cấu hình thủ công các quan hệ cận kề trên router Priority của cổng giao tiếp là 0 nghĩa là router sẽ không tham gia vào quá trình bầu chọn DR/BDR trên mạng RouterA#sh ip ospf int s0
Serial0 is up, line protocol is up
Internet Address 192.1.1.1/24, Area 0
Process ID 64, Router ID 1.1.1.1, Network Type NON_BROADCAST, Cost: 64
Transmit Delay is 1 sec, State DROTHER, Priority 0
Designated Router (ID) 2.2.2.2, Interface address 192.1.1.2
No backup designated router on this network
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
Hello due in 00:00:03
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Xem trạng thái của các quan hệ cận kề từ RouterA bằng lệnh show ip ospf neighbor Chú
ý rằng RouterA có quan hệ liền kề full adjacent với router DR là RouterB(2.2.2.2)
RouterA#sh ip ospf nei
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/DR 00:01:47 192.1.1.2 Serial0
Xem bảng định tuyến trên RouterA bằng lệnh show ip route, chú ý rằng RouterA có một route đi đến địa chỉ loopback của RouterB và RouterC Các số kế tiếp [110/65], 110 nghĩa là số AD của OSPF được dùng để so sánh khi có nhiều route sử dụng các giao thức định tuyến khác để đi đến đích, số AD càng nhỏ thì route càng được ưu tiên Số kế tiếp là
65 là metric hay còn gọi là cost (đơn giá) của đường đi, được dùng để so sánh khi có nhiều route sử dụng cùng giao thức định tuyến, route được chọn là route có đơn giá nhỏ nhất
RouterA#sh ip route
Trang 7Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 192.1.1.2, 00:00:44, Serial0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 192.1.1.3, 00:00:44, Serial0
C 192.1.1.0/24 is directly connected, Serial0
Xem trạng thái các router OSPF cận kề trên RouterB bằng lệnh show ip ospf neighbor Chú ý rằng RouterB có hai router OSPF cận kề là RouterA (1.1.1.1) và RouterC (2.2.2.2)
và ở trạng thái FULL RouterB được chọn làm DR vì có độ ưu tiên cao nhất Trong mạng non-broadcast, cần định nghĩa các router OSPF cận kề trên DR/BDR
RouterB#sh ip ospf nei
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 0 FULL/DROTHER 00:01:51 192.1.1.1 Serial0
3.3.3.3 0 FULL/DROTHER 00:01:46 192.1.1.3 Serial0
Xem trạng thái của các router OSPF cận kề trên RouterC bằng lệnh show ip ospf
neighbor Chú ý rằng RouterC chỉ có một router OSPF cận kề với router DR là RouterB Không có tiến hành bầu chọn BDR vì chỉ có một mình RouterB là có priority khác 0 Nếu priority trên RouterB là 0 thì sẽ không thể chọn được DR/BDR
RouterC#sh ip ospf nei
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/DR 00:01:37 192.1.1.2 Serial0
Trong mạng NBMA, router DR cần phải có kết nối đến tất cả các router khác Trong bài
Trang 8thực hành này bởi vì RouterB có kết nối với router A và C nên RouterB phải là DR Trường hợp ta thay đổi RouterA làm DR bằng cách thay đổi OSPF priority và loại bỏ câu lệnh neighbor trên RouterB
RouterB(config)#int s0
RouterB(config-if)#ip ospf priority 0
RouterB(config-if)#router ospf 64
RouterB(config-router)#no neighbor 192.1.1.1
RouterB(config-router)#no neighbor 192.1.1.3
Cấu hình priority trên serial cổng giao tiếp của RouterA là 10 và khai báo quan hệ cận kề với RouterB và RouterC
RouterA(config)#int s0
RouterA(config-if)#ip ospf priority 10
RouterA(config-if)#router ospf 64
RouterA(config-router)#neighbor 192.1.1.2
RouterA(config-router)#neighbor 192.1.1.3
RouterA(config-router)#end
RouterA#copy run start
RouterA#reload
Lưu cấu hình vào NVRAM và khởi động lại router Từ RouterA xem trạng thái của cổng S0 bằng lệnh show ip ospf interface s0 Chú ý là RouterA (1.1.1.1) bây giờ là DR trên mạng
RouterA#sh ip ospf int s0
Serial0 is up, line protocol is up
Internet Address 192.1.1.1/24, Area 0
Process ID 64, Router ID 1.1.1.1, Network Type NON_BROADCAST, Cost: 64
Trang 9Transmit Delay is 1 sec, State DR, Priority 10
Designated Router (ID) 1.1.1.1, Interface address 192.1.1.1
No backup designated router on this network
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
Hello due in 00:00:03
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 2.2.2.2
RouterA chỉ thiết lập quan hệ adjacency với RouterB (2.2.2.2) chứ không thiết lập với RouterC
RouterA#sh ip ospf nei
Neighbor ID Pri State Dead Time Address Interface
N/A 0 ATTEMP/DROTHER - 192.1.1.3 Serial0
2.2.2.2 0 FULL/DROTHER 00:01:55 192.1.1.2 Serial0
Xem bảng định tuyến trên RouterC, chú ý rằng RouterC không thiết lập quan hệ adjacency với RouterA là router DR nên sẽ không nhận được cập nhật định tuyến RouterC#sh ip ro
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
C 192.1.1.0/24 is directly connected, Serial0