Setting Router CISCO
OSPF Routing
Routing Open Shortest Path First (OSPF) adalah sebuah routing protocol
standard terbuka yang telah diimplementasikan oleh sejumlah besar vendor
jaringan. Alasan untuk mengkonfigurasi OSPF dalam sebuah topologi adalah untuk
mengurangi overhead (waktu pemrosesan) routing, mempercepat convergance,serta
membatasi ketidakstabilan network disebuah area dalam suatu network.
OSPF Message Encapsulation terjadi pada lapisan data-link dengan nomor protocol
89. Data field ini dapat berisi salah satu dari lima tipe paket OSPF. Pada IP
packet header, alamat tujuannya mempunyai dua alamat multicast yaitu 224.0.0.5
dan 224.0.0.6 namun yang diset cukup salah satu dari alamat tersebut. Bila
paket OSPF diencapsulasi di sebuah frame Ethernet, alamat tujuan dari MAC
address juga merupakan sebuah alamat multicast, yaitu 01-00-5E-00-00-05 dan
01-00-5E-00-00-06. Semua paket OSPF mempunyai 24 byte yang berisikan informasi
yang diperlukan. Packet header ini terdiri dari berbagai bidang seperti
jenis-jenis paket OSPF, router ID serta alamat IP dari router yang mengirimkan
paket.
Ada 5 tipe paket yang digunakan OSPF, yaitu :
*. Hello packet -> untuk menemukan serta membangun
hubungan antar tetangga router OSPF.
*. Database Description (DBD)-> untuk mengecek singkronisasi
database antar router.
*. Link-State Request (LSR) -> meminta spesifikasi
link-state records antara router satu dengan yang lain.
*. Link-State Update (LSU) -> mengirimkan permintaan
spesifikasi link-state records.
*. Link-State Acknowledgement (LSAck) -> menerima paket
link-state.
OSPF adalah salah satu dari Interior Gateway Protocol (IGP) yang
biasanya digunakan untuk routing protocol dalam satu routing domain yang
sama.
Terdapat 2 macam routing protocol, yaitu Distance Vector dan Link
State. Distance vector menggunakan kalkulasi distance atau
jarak serta outgoing interface untuk memilih jalur yang paling baik ke network
tujuan. Contoh dari Distance Vector adalah RIP, IGRP, dan EIGRP.
Link State memantau status dan tipe koneksi setiap link, kemudian membuat
kalkulasi metric berdasarkan informasi tersebut. Contoh dari Link State adalah
OSPF.
Router R1
R1(config)#router rip
R1(config-router)#network 192.168.0.0
R1(config-router)#network 150.72.21.0
R1(config-router)#end
Router R2
R2(config)#router rip
R2(config-router)#network 10.0.0.0
R2(config-router)#network 150.72.21.0
R2(config-router)#end
Router(config)# router ospf process_ID
Router(config-router)# network IP_address wildcard_mask area area_#
(1841Router0) Hostname R1
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
R1(config)#interface fastethernet 0/0
R1(config-if)#ip address 10.0.0.1 255.0.0.0
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0,
changed state to up
R1(config-if)#exit
R1(config)#interface serial 0/0/0
R1(config-if)#ip address 20.0.0.1 255.0.0.0
R1(config-if)#clock rate 64000
R1(config-if)#bandwidth 64
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
R1(config-if)#exit
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
R1(config)#router ospf 1
R1(config-router)#network 10.0.0.0 0.255.255.255 area 0
R1(config-router)#network 20.0.0.0 0.255.255.255 area 0
R1(config-router)#exit
R1(config)#
(2620XM-Router1) Hostname R2
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R2
R2(config)#interface serial 0/0
R2(config-if)#ip address 20.0.0.2 255.0.0.0
R2(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0,
changed state to up
R2(config-if)#exit
R2(config)#interface fastethernet 0/0
R2(config-if)#ip address 30.0.0.1 255.0.0.0
R2(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
R2(config-if)#exit
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0,
changed state to up
R2(config)#router ospf 2
R2(config-router)#network 20.0.0.0 0.255.255.255 area 0
R2(config-router)#network 3
00:03:10: %OSPF-5-ADJCHG: Process 2, Nbr 20.0.0.1 on Serial0/0 from
LOADING to FULL, Loading Done0.0.0.0 0.255.255.255 area 0
R2(config-router)#network 30.0.0.0 0.255.255.255 area 0
R2(config-router)#exit
R2(config)#
(2620XM-Router2)Hostname R3
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R3
R3(config)#interface fastethernet 0/0
R3(config-if)#ip address 30.0.0.2 255.0.0.0
R3(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0,
changed state to up
R3(config-if)#interface serial 0/0
R3(config-if)#ip address 40.0.0.1 255.0.0.0
R3(config-if)#clock rate 64000
R3(config-if)#bandwidth 64
R3(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0, changed state to down
R3(config-if)#exit
%LINK-5-CHANGED: Interface Serial0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0,
changed state to up
R3(config)#router ospf 3
R3(config-router)#network 40.0.0.0 0.255.255.255 area 0
R3(config-router)#network 30.0.0.0 0.255.255.255 area 0
00:04:53: %OSPF-5-ADJCHG: Process 3, Nbr 30.0.0.1 on FastEthernet0/0 from
LOADING to FULL, Loading D
R3(config-router)#exit
R3(config)#
%SYS-5-CONFIG_I: Configured from console by console
R3#
(2811Router3) Hostname R4
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface serial 0/0/0
Router(config-if)#ip address 40.0.0.2 255.0.0.0
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to up
Router(config-if)#exit
Router(config)#interface fastethernet 0/0
Router(config-if)#ip address 50.0.0.1 255.0.0.0
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0,
changed state to up
Router(config-if)#exit
R4(config)#router ospf 4
R4(config-router)#network 50.0.0.0 0.255.255.255 area 0
R4(config-router)#network 40.0.0.0 0.255.255.255 area 0
R4(config-router)#
00:06:32: %OSPF-5-ADJCHG: Process 4, Nbr 40.0.0.1 on Serial0/0/0 from
LOADING to FULL, Loading Done
R4(config-router)#exit
R4(config)#
PC-1
PC>ipconfig
IP Address......................: 10.0.0.2
Subnet Mask.....................: 255.0.0.0
Default Gateway.................: 10.0.0.1
PC>ping 50.0.0.2
PC-2
PC>ipconfig
IP Address......................: 50.0.0.2
Subnet Mask.....................: 255.0.0.0
Default Gateway.................: 50.0.0.1
PC>ping 10.0.0.2
R4#show ip protocols
Routing Protocol is "ospf 4"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 50.0.0.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
50.0.0.0 0.255.255.255 area 0
40.0.0.0 0.255.255.255 area 0
Routing Information Sources:
Gateway Distance Last Update
40.0.0.1 110 00:01:26
Distance: (default is 110)
R4#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
O 10.0.0.0/8 [110/1564] via 40.0.0.1, 00:02:37, Serial0/0/0
O 20.0.0.0/8 [110/1563] via 40.0.0.1, 00:02:37, Serial0/0/0
O 30.0.0.0/8 [110/782] via 40.0.0.1, 00:02:37, Serial0/0/0
C 40.0.0.0/8 is directly connected, Serial0/0/0
C 50.0.0.0/8 is directly connected, FastEthernet0/0
R4#
Configuration command of OSPF
Commands
|
Descriptions
|
Router(config)#router ospf 1
|
Starts OSPF process 1. The process
ID is any positive integer value between 1 and 65,535.
|
Router(config-router)#network
172.16.0.0 0.0.255.255 area 0
|
OSPF advertises interfaces, not
networks. Uses the wildcard mask to determine which interfaces to advertise.
|
Router(config-if)#ip ospf
hellointerval timer 20
|
Changes the Hello Interval timer
to 20 seconds.
|
Router(config-if)#ip ospf
deadinterval 80
|
Changes the Dead Interval timer to
80 seconds.
|
NOTE: Hello and Dead Interval
timers must match for routers to become neighbors
|
Router#show ip protocol
|
Displays parameters for all
protocols running on the router
|
Router#show ip route
|
Displays a complete IP routing
table
|
Router#show ip ospf
|
Displays basic information about
OSPF routing processes
|
Router#show ip ospf interface
|
Displays OSPF info as it relates
to all interfaces
|
Router#show ip ospf interface fastethernet
0/0
|
Displays OSPF information for
interface fastethernet 0/0
|
Router#show ip ospf border-routers
|
Displays border and boundary
router information
|
Router#show ip ospf neighbor
|
Lists all OSPF neighbors and their
states
|
Router#show ip ospf neighbor
detail
|
Displays a detailed list of
neighbors
|
Router#clear ip route *
|
Clears entire routing table,
forcing it to rebuild
|
Router#clear ip route a.b.c.d
|
Clears specific route to network
a.b.c.d
|
Router#clear ip opsf counters
|
Resets OSPF counters
|
Router#clear ip ospf process
|
Resets entire OSPF process,
forcing OSPF to re-create neighbors, database, and routing table
|
Router#debug ip ospf events
|
Displays all OSPF events
|
Router#debug ip ospf adjacency
|
Displays various OSPF states and
DR/ BDR election between adjacent routers
|
Router#debug ip ospf packets
|
Displays OPSF packets
|