در این حالت از پروتکل OSPF برای Routing استفاده می شود .
در این روتر در اینترفیس های ge0 , ge1 پروتکل OSPF فعال شده است , همچنین فرض شده است که IP در اینترفیس ها در بخش تنظیم ip در اینترفیس تنظیم شده اند :
تنظیم OSPF در اینترفیس ge0 :
soodar1(config)# interface ge0
soodar1(config-if)# ip ospf hello-interval 3
soodar1(config-if)# ip ospf dead-interval 10
soodar1(config-if)# exit
مقادیر تنظیم شده برای interval ها می تواند توسط ادمین به هر مقدار دلخواهی تنظیم شود .
تنظیم OSPF در اینترفیس ge1 :
soodar1(config)# interface ge1
soodar1(config-if)# ip ospf hello-interval 3
soodar1(config-if)# ip ospf dead-interval 10
soodar1(config-if)# exit
اضافه کردن شبکه ها به تنظیمات OSPF :
soodar1(config)# router ospf
soodar1(config-router)# network 200.1.2.0/24 area 0
soosar1(config-router)# network 200.1.3.0/24 area 0
soodar1(config-router) # end
soodar1# write
توزیع route ها توسط OSPF :
soodar1(config-router)# redistribute connected
تنظیم OSPF در اینترفیس ge0 :
soodar2(config)# interface ge0
soodar2(config-if)# ip ospf hello-interval 3
soodar2(config-if)# ip ospf dead-interval 10
soodar2(config-if)# exit
تنظیم OSPF در اینترفیس ge1 :
soodar2(config)# interface ge1
soodar2(config-if)# ip ospf hello-interval 3
soodar2(config-if)# ip ospf dead-interval 10
soodar2(config-if)# exit
اضافه کردن شبکه ها به تنظیمات OSPF :
soodar2(config)# router ospf
soodar2(config-router)# network 200.1.2.0/24 area 0
soodar2(config-router)# network 200.2.3.0/24 area 0
soodar2(config-router) # end
soodar2# write
توزیع route ها توسط OSPF :
soodar2(config-router)# redistribute connected
تنظیم OSPF در اینترفیس ge0 :
soodar3(config)# interface ge0
soodar3(config-if)# ip ospf hello-interval 3
soodar3(config-if)# ip ospf dead-interval 10
soodar3(config-if)# exit
تنظیم OSPF در اینترفیس ge1 :
soodar3(config)# interface ge1
soodar3(config-if)# ip ospf hello-interval 3
soodar3(config-if)# ip ospf dead-interval 10
soodar3(config-if)# exit
اضافه کردن شبکه ها به تنظیمات OSPF :
soodar3(config)# router ospf
soodar3(config-router)# network 200.1.3.0/24 area 0
soodar3(config-router)# network 200.2.3.0/24 area 0
soodar3(config-router)# end
soodar3# write
توزیع route ها توسط OSPF :
soodar3(config-router)# redistribute connected
پس از اعمال شدن تنظیمات کمی صبر می کنیم تا روتر ها با استفاده از پروتکل OSPF جدول Routing را تشکیل
دهند .
سپس با استفاده از دستور زیر جدول Routing که با استفاده از پروتکل OSPF تشکیل شده است را مشاهده می کنیم :
soodar1# sh ip ospf route
یا
soodar1# sh ip fib
## بررسی عملکرد
حال باید route بین شبکه های سه روتر برقرار باشد .برای مثال باید نود n4 آدرس 2.1.1.10 را پینگ کند .
با قطع لینک ارتباطی بین soodar2 , soodar1 مسیر ها بروز رسانی شوند و مجددا ارتباط بین دو نود از مسیر جدید برقرار شود .
اگر سناریویی دارید که در آن area های مختلفی دارید از روش زیر برای پیکربندی OSPF در حالت چند Area استفاده کنید . در شکل زیر روتر soodar1 در area 1 , روتر soodar3 در area 3 قرار دارد و روتر soodar2 در area 0 به عنوان backbone در شبکه قرار گرفته است .
برای تقسیم شبکه به area مختلف باید به چند نکته توجه داشته باشید :
باید ابتدا یک area 0) back bone) تشکیل دهید
در صورت استفاده از backbone به صورت پیش فرض همه شبکه ها بین Area های مختلف distribute می شوند .
interface ge0
ip address 200.1.2.1/24
ip ospf dead-interval 10
ip ospf hello-interval 3
!
interface ge1
ip address 1.1.1.1/24
!
router ospf
ospf router-id 222.0.0.1
redistribute connected
network 1.1.1.0/24 area 1
network 200.1.2.0/24 area 0
interface ge0
ip address 200.1.2.2/24
ip ospf dead-interval 10
ip ospf hello-interval 3
!
interface ge1
ip address 200.2.3.2/24
ip ospf dead-interval 10
ip ospf hello-interval 3
!
router ospf
ospf router-id 222.0.0.2
redistribute connected
network 200.1.2.0/24 area 0
network 200.2.3.0/24 area 0
!
interface ge0
ip address 200.2.3.3/24
ip ospf dead-interval 10
ip ospf hello-interval 3
!
interface ge1
ip address 3.1.1.1/24
!
router ospf
ospf router-id 222.0.0.3
redistribute connected
network 3.1.1.0/24 area 3
network 200.2.3.0/24 area 0
باید ارتباط بین 3.1.1.10 و 1.1.1.10 که در دو Area مختلف قرار دارند برقرار شود .