Wiki source code of EdgeRouter - OSPF Routing

Last modified by Jean Franco on 2024/06/09 22:14

Hide last authors
Jean Franco 1.1 1 == How to Configure OSPF Routing ==
2
3 [[//OSPF will be used to provide reachability between the 10.0.4.0/24 and the 10.0.0.0/22 networks over the Site-to-Site VPN.//>>image:topology.png]]
4
5 In the example diagram above, all of the EdgeRouters are ABRs (Area Border Routers) and contain an active interface in OSPF area 0 and another area. There is a Site-to-Site VPN configured between ER-4 and ER-1, over which the OSPF adjacency is established and the routing information for the 10.0.4.0/24 and 10.0.0.0/22 networks is exchanged. There is more information about VPNs in the [[Route-Based Site-to-Site IPsec VPN>>url:https://help.ui.com/hc/en-us/articles/115011377588]] article.
6
7 Follow the steps below to enable the OSPF process on the relevant interfaces of all routers:
8
9 **CLI:** Access the Command Line Interface on ER-4.You can do this using the CLI button in the GUI or by using a program such as PuTTY.
10
11 ~1. Enter configuration mode.
12
13 {{{configure}}}
14
15 2. Define the OSPF network type for the **vti0** interface.
16
17 Copy
18
19 {{{set interfaces vti vti0 ip ospf network point-to-point}}}
20
21 3.[[image:https://help-center-assets.ubnt.com/optional.svg||height="17" width="66"]] Define a custom OSPF router ID.
22
23 Copy
24
25 {{{set protocols ospf parameters router-id 0.0.0.4}}}
26
27 4. Enable the OSPF routing process on the relevant interfaces and define the OSPF area number.
28
29 Copy
30
31 {{{set protocols ospf area 0 network 10.255.12.0/30
32 set protocols ospf area 4 network 10.0.4.0/24}}}
33
34 5.[[image:https://help-center-assets.ubnt.com/optional.svg||height="17" width="66"]] Set all interfaces to **passive**, with the exception of interfaces that should form adjacencies with other OSPF routers.
35
36 Copy
37
38 {{{set protocols ospf passive-interface default
39 set protocols ospf passive-interface-exclude vti0
40 set protocols ospf passive-interface-exclude eth1}}}
41
42 **NOTE:** Interfaces which are set to passive are unable to form OSPF neighborship adjacancies.
43
44 6. Commit the changes and save the configuration.
45
46 {{{commit ; save}}}
47
48 **CLI:** Access the Command Line Interface on ER-1.
49
50 ~1. Enter configuration mode.
51
52 {{{configure}}}
53
54 2. Define the OSPF network type for the **vti0** interface.
55
56 Copy
57
58 {{{set interfaces vti vti0 ip ospf network point-to-point}}}
59
60 3. Define the OSPF network type for the **eth1** interface and lower the priority to 1.
61
62 Copy
63
64 {{{set interfaces ethernet eth1 ip ospf priority 1
65 set interfaces ethernet eth1 ip ospf network broadcast}}}
66
67 **NOTE:** Lowering the OSPF priority **ensures** that ER-1 becomes the DR (Designated Router) on the 10.0.1.0/24 LAN segment.
68
69 4.[[image:https://help-center-assets.ubnt.com/optional.svg||height="17" width="66"]] Define a custom OSPF router ID.
70
71 Copy
72
73 {{{set protocols ospf parameters router-id 0.0.0.1}}}
74
75 5. Enable the OSPF routing process on the relevant interfaces and define the OSPF area number.
76
77 Copy
78
79 {{{set protocols ospf area 0 network 10.255.12.0/30
80 set protocols ospf area 0 network 10.0.1.0/24}}}
81
82 6. [[image:https://help-center-assets.ubnt.com/optional.svg||height="17" width="66"]] Set all interfaces to **passive**, with the exception of interfaces that should form adjacencies with other OSPF routers.
83
84 Copy
85
86 {{{set protocols ospf passive-interface default
87 set protocols ospf passive-interface-exclude vti0
88 set protocols ospf passive-interface-exclude eth1}}}
89
90 5. Commit the changes and save the configuration.
91
92 {{{commit ; save}}}
93
94 **CLI:** Access the Command Line Interface on ER-2.
95
96 ~1. Enter configuration mode.
97
98 {{{configure}}}
99
100 2. Define the OSPF network type for the **eth0 **interface.
101
102 Copy
103
104 {{{set interfaces ethernet eth0 ip ospf network broadcast}}}
105
106 3.[[image:https://help-center-assets.ubnt.com/optional.svg||height="17" width="66"]] Define a custom OSPF router ID.
107
108 Copy
109
110 {{{set protocols ospf parameters router-id 0.0.0.2}}}
111
112 4. Enable the OSPF routing process on the relevant interfaces and define the OSPF area number.
113
114 Copy
115
116 {{{set protocols ospf area 0 network 10.0.1.0/24
117 set protocols ospf area 2 network 10.0.2.0/24}}}
118
119 4. [[image:https://help-center-assets.ubnt.com/optional.svg||height="17" width="66"]] Set all interfaces to **passive**, with the exception of interfaces that should form adjacencies with other OSPF routers.
120
121 Copy
122
123 {{{set protocols ospf passive-interface default
124 set protocols ospf passive-interface-exclude eth0}}}
125
126 5. Commit the changes and save the configuration.
127
128 {{{commit ; save}}}
129
130 **CLI:** Access the Command Line Interface on ER-3.
131
132 ~1. Enter configuration mode.
133
134 {{{configure}}}
135
136 2. Define the OSPF network type for the **eth0** interface.
137
138 Copy
139
140 {{{set interfaces ethernet eth0 ip ospf network broadcast}}}
141
142 3.[[image:https://help-center-assets.ubnt.com/optional.svg||height="17" width="66"]] Define a custom OSPF router ID.
143
144 Copy
145
146 {{{set protocols ospf parameters router-id 0.0.0.3}}}
147
148 4. Enable the OSPF routing process on the relevant interfaces and define the OSPF area number.
149
150 Copy
151
152 {{{set protocols ospf area 0 network 10.0.1.0/24
153 set protocols ospf area 3 network 10.0.3.0/24}}}
154
155 4. [[image:https://help-center-assets.ubnt.com/optional.svg||height="17" width="66"]] Set all interfaces to **passive**, with the exception of interfaces that should form adjacencies with other OSPF routers.
156
157 Copy
158
159 {{{set protocols ospf passive-interface default
160 set protocols ospf passive-interface-exclude eth0}}}
161
162 5. Commit the changes and save the configuration.
163
164 {{{commit ; save}}}
165
166 After finalizing the OSPF configuration, the OSPF neighbor table and interfaces on ER-1 looks like this:
167
168 {{{show ip ospf neighbor
169 Total number of full neighbors: 3
170
171 OSPF process 0 VRF(default):
172 Neighbor ID     Pri   State            Dead Time   Address         Interface           Instance ID
173 0.0.0.2           1   Full/Backup      00:00:38    10.0.1.2        eth1                    0
174 0.0.0.3           1   Full/DROther     00:00:33    10.0.1.3        eth1                    0
175 0.0.0.4           1   Full/ -          00:00:31    10.255.12.2     vti0                    0
176
177 show ip ospf interface
178 vti0 is up, line protocol is up
179 Internet Address 10.255.12.1/30, Area 0.0.0.0, MTU 1436
180 Process ID 0, VRF (default), Router ID 0.0.0.1, Network Type POINTTOPOINT, Cost: 10
181 Transmit Delay is 1 sec, State Point-To-Point, TE Metric 10
182 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
183 Neighbor Count is 1, Adjacent neighbor count is 1
184 <output shortened>
185
186 eth1 is up, line protocol is up
187 Internet Address 10.0.1.1/24, Area 0.0.0.0, MTU 1500
188 Process ID 0, VRF (default), Router ID 0.0.0.1, Network Type BROADCAST, Cost: 10
189 Transmit Delay is 1 sec, State DR, Priority 1, TE Metric 10
190 Designated Router (ID) 0.0.0.1, Interface Address 10.0.1.1
191 Backup Designated Router (ID) 0.0.0.2, Interface Address 10.0.1.2
192 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
193 Neighbor Count is 2, Adjacent neighbor count is 2
194 <output shortened>}}}
195
196 The OSPF routing table on ER-3 look like this:
197
198 {{{show ip route ospf
199
200 IP Route Table for VRF "default"
201 O IA *> 10.0.2.0/24 [110/11] via 10.0.1.2, eth0, 00:01:44
202 O *> 10.255.12.0/30 [110/20] via 10.0.1.1, eth0, 00:01:44
203 O IA *> 10.0.4.0/24 [110/21] via 10.0.1.1, eth0, 00:01:44}}}
Maila Networks