'' - dodaje sieci pasujące do wzorca do rozgłaszanych sieci oraz aktywuje na nich wymianę komunikatów OSPF. Dodanie pierwszej sieci włącza proces OSPF. \\ Przykład: do dodania sieci 192.168.0.0/24 do obszaru 0 należy wpisać: \\ ''network 192.168.0.0 0.0.0.255 area 0'' \\ Można też podać "cały świat", który dopasuje się do każdej bezpośrednio podłączonej sieci: \\ ''network 0.0.0.0 255.255.255.255 area 0''
* ''auto-cost reference-bandwidth '' – ustawia referencyjną prędkość używaną do automatycznego obliczania kosztów połączenia, np:\\ ''auto-cost reference-bandwidth 1000''
* ''default-information originate'' - włącza redystrybucję trasy domyślnej
* ''redistribute '' - włącza rozgłaszanie tras podanego typu - połączonych, statycznych lub z innego procesu/protokołu routingu. Uwaga: nie włącza OSPF na pasujących sieciach – tylko dodaje je do rozgłaszanych. Np: \\ ''redistribute connected subnets'' - wszystkie bezpośrednio podłączone sieci \\ ''redistribute static subnets'' - wszystkie trasy statyczne \\ ''redistribute eigrp subnets'' - wszystkie trasy dostarczone przez protokół eigrp
* ''passive-interface |default'' – wyłącza nawiązywanie połączeń OSPF na wybranym interfejsie, lub domyślnie na wszystkich interfejsach. \\ Przykład 1 – wyłącza wysyłanie i odbiór OSPF Hello na interfejsie FastEthernet 0/0: \\ ''passive-interface FastEthernet 0/0'' \\ Przykład 2 - pozwala na połączenia OSPF tylko na Serial 0/2/0-1 \\ ''passive-interface default'' \\ ''no passive-interface Serial/0/2/0'' \\ ''no passive-interface Serial/0/2/1''
W trybie **konfiguracji interface'u** można ręcznie ustalić koszt łącza:
* ''bandwidth '' - zmiana postrzeganej przez protokoły routingu prędkości
* ''ip ospf cost '' - sztuczna zmiana kosztu danego łącza dla OSPF
=== Diagnostyka ===
W trybie uprzywilejowanym:
* ''show ip protocols''
* ''show ip ospf'' - informacje o działających procesach ospf
* ''show ip ospf interface'' - informacje o stanie OSPF na interfejsach - koszt, sąsiedzi, lokalny identyfikator etc.
* ''show ip ospf neighbor'' - informacje o sąsiadach
* ''show ip ospf database'' - podsumowane dane o połączeniach
* ''show ip ospf database network'' - podsumowane dane o sieciach łączących routery OSPF
* ''show ip ospf database router'' - pełne dane o routerach i ich połączeniach
Każdemu protokołowi routingu CISCO przypisuje wartość AD ([[http://en.wikipedia.org/wiki/Administrative_distance|administrative distance]]).
CISCO wybiera trasy biorąc pod uwagę wpierw trasy z najmniejszą AD, potem porównuje dopiero koszt.
Zapis w tablicy routingu: [AD/koszt], np:
|''O 10.1.3.0/24 [110/65] via 10.3.4.3, 00:49:11, FastEthernet0/0'' |AD:110, koszt:65 |
|''D 10.0.2.0/24 [90/2297856] via 10.2.4.2, 00:09:38, Serial0/0'' |AD:90, koszt:2297856|
|''C 10.4.5.0/24 is directly connected, FastEthernet0/1'' |AD:1 |
++++ Przykładowe wyniki poleceń diagnostycznych |
++ schemat sieci: | {{ :sk1:ospf-example-net.png?700 |}}++
R2#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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 192.168.4.0/24 [110/4] via 192.168.5.1, 00:03:34, GigabitEthernet0/0
C 192.168.5.0/24 is directly connected, GigabitEthernet0/0
C 192.168.6.0/24 is directly connected, GigabitEthernet1/0
O 192.168.0.0/24 [110/66] via 192.168.5.1, 02:40:04, GigabitEthernet0/0
O 192.168.1.0/24 [110/65] via 192.168.5.1, 02:45:19, GigabitEthernet0/0
O 192.168.2.0/24 [110/2] via 192.168.5.1, 02:45:19, GigabitEthernet0/0
O 192.168.3.0/24 [110/3] via 192.168.5.1, 02:45:19, GigabitEthernet0/0
R2#show ip protocols
Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.6.2
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
192.168.5.0 255.255.255.0 area 0
192.168.6.0 255.255.255.0 area 0
Reference bandwidth unit is 1000 mbps
Routing Information Sources:
Gateway Distance Last Update
192.168.1.3 110 02:37:21
192.168.5.1 110 02:42:36
192.168.4.1 110 00:00:51
192.168.3.4 110 02:42:36
Distance: (default is 110)
R2#show ip ospf interface GigabitEthernet0/0
GigabitEthernet0/0 is up, line protocol is up
Internet Address 192.168.5.2/24, Area 0
Process ID 1, Router ID 192.168.6.2, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 192.168.5.1, Interface address 192.168.5.1
Backup Designated router (ID) 192.168.6.2, Interface address 192.168.5.2
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:01
Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 4 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 192.168.5.1 (Designated Router)
Suppress hello for 0 neighbor(s)
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.5.1 1 FULL/DR 00:00:37 192.168.5.1 GigabitEthernet0/0
R2#show ip ospf database router
OSPF Router with ID (192.168.6.2) (Process ID 1)
Router Link States (Area 0)
LS age: 1473
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 192.168.1.3
Advertising Router: 192.168.1.3
LS Seq Number: 80000009
Checksum: 0x1AE5
Length: 60
Number of Links: 3
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 192.168.5.1
(Link Data) Router Interface address: 192.168.1.3
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 192.168.1.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 192.168.0.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 1
LS age: 39
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 192.168.3.4
Advertising Router: 192.168.3.4
LS Seq Number: 80000008
Checksum: 0x3348
Length: 48
Number of Links: 2
Link connected to: a Transit Network
(Link ID) Designated Router address: 192.168.3.4
(Link Data) Router Interface address: 192.168.3.4
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: a Transit Network
(Link ID) Designated Router address: 192.168.2.4
(Link Data) Router Interface address: 192.168.2.4
Number of TOS metrics: 0
TOS 0 Metrics: 1
LS age: 114
Options: (No TOS-capability, No DC)
LS Type: Router Links
Link State ID: 192.168.4.1
Advertising Router: 192.168.4.1
LS Seq Number: 80000011
Checksum: 0x78FF
Length: 60
Number of Links: 3
Link connected to: a Transit Network
(Link ID) Designated Router address: 192.168.3.4
(Link Data) Router Interface address: 192.168.3.1
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 192.168.4.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 127.0.0.1
(Link Data) Network Mask: 255.255.255.255
Number of TOS metrics: 0
TOS 0 Metrics: 1
LS age: 1856
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 192.168.5.1
Advertising Router: 192.168.5.1
LS Seq Number: 80000007
Checksum: 0x435E
Length: 72
Number of Links: 4
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 192.168.1.3
(Link Data) Router Interface address: 192.168.1.1
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 192.168.1.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Transit Network
(Link ID) Designated Router address: 192.168.2.4
(Link Data) Router Interface address: 192.168.2.1
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: a Transit Network
(Link ID) Designated Router address: 192.168.5.1
(Link Data) Router Interface address: 192.168.5.1
Number of TOS metrics: 0
TOS 0 Metrics: 1
LS age: 1749
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 192.168.6.2
Advertising Router: 192.168.6.2
LS Seq Number: 80000007
Checksum: 0xA544
Length: 48
Number of Links: 2
Link connected to: a Stub Network
(Link ID) Network/subnet number: 192.168.6.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: a Transit Network
(Link ID) Designated Router address: 192.168.5.1
(Link Data) Router Interface address: 192.168.5.2
Number of TOS metrics: 0
TOS 0 Metrics: 1
++++
{{:sk1:ospf.pcap.gz|Przykładowa wymiana pakietów protokołu OSPF}}
https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/iproute_ospf/configuration/15-mt/iro-15-mt-book/iro-cfg.html
===== [Ekstra] Inne =====
Implementacje wielu protokołów routingu, w tym OSPFv2, dla systemu Linux:
* FRRouting https://frrouting.org/ (kiedyś [[http://www.nongnu.org/quagga/|Quaqqa]], jeszcze wcześniej [[https://www.gnu.org/software/zebra/|Zebra]]) - składnia (prawie) identyczna z CISCO
* Bird http://bird.network.cz/