Skip to content

Commit 0c64b6d

Browse files
authored
Merge pull request #5 from kernelkit/jovatn/ospf-unnumbered-updates
Simplifying OSPF unnumbered example
2 parents 66ade6a + 22c94dd commit 0c64b6d

File tree

1 file changed

+55
-180
lines changed

1 file changed

+55
-180
lines changed

_posts/2024-01-30-ospf-unnumbered-infix.md

Lines changed: 55 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ admin@R1:/>
110110
admin@R1:/> configure
111111
admin@R1:/config/> set interface lo ipv4 address 10.1.1.1 prefix-length 32
112112
admin@R1:/config/> set interface eth0 ipv4 address 10.1.1.1 prefix-length 32
113-
admin@R1:/config/> set interface eth0 ipv4 forwarding true
113+
admin@R1:/config/> set interface eth0 ipv4 forwarding
114114
```
115115

116116
To view the changes done so far, use the `diff` command.
@@ -127,11 +127,11 @@ interfaces {
127127
+ }
128128
}
129129
interface lo {
130-
ipv4 {
130+
ipv4 {
131131
+ address 10.1.1.1 {
132132
+ prefix-length 32;
133133
+ }
134-
}
134+
}
135135
}
136136
}
137137
```
@@ -146,12 +146,11 @@ admin@R1:/>
146146
Status of IP address assignment can be viewed using `show interfaces` command.
147147

148148
```console
149-
admin@R1:/>
150149
admin@R1:/> show interfaces
151150
INTERFACE PROTOCOL STATE DATA
152151
eth0 ethernet UP 0c:ec:d1:04:00:00
153-
ipv4 10.1.1.1/32 (static)
154-
ipv6 fe80::eec:d1ff:fe04:0/64 (link-layer)
152+
ipv4 10.1.1.1/32 (static)
153+
ipv6 fe80::eec:d1ff:fe04:0/64 (link-layer)
155154
eth1 ethernet DOWN 0c:ec:d1:04:00:01
156155
eth2 ethernet DOWN 0c:ec:d1:04:00:02
157156
eth3 ethernet DOWN 0c:ec:d1:04:00:03
@@ -162,9 +161,9 @@ eth7 ethernet DOWN 0c:ec:d1:04:00:07
162161
eth8 ethernet DOWN 0c:ec:d1:04:00:08
163162
eth9 ethernet DOWN 0c:ec:d1:04:00:09
164163
lo ethernet UP 00:00:00:00:00:00
165-
ipv4 127.0.0.1/8 (static)
166-
ipv4 10.1.1.1/32 (static)
167-
ipv6 ::1/128 (other)
164+
ipv4 127.0.0.1/8 (static)
165+
ipv4 10.1.1.1/32 (static)
166+
ipv6 ::1/128 (other)
168167
admin@R1:/>
169168
```
170169

@@ -180,18 +179,17 @@ are done within OSPF area context (here the backbone area 0.0.0.0 is
180179
used).
181180

182181
```console
183-
admin@R1:/config/>
184182
admin@R1:/config/> edit routing control-plane-protocol ospfv2 name default
185-
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> set ospf area 0.0.0.0 interface lo enabled true
186-
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> set ospf area 0.0.0.0 interface eth0 enabled true
183+
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> set ospf area 0.0.0.0 interface lo enabled
184+
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> set ospf area 0.0.0.0 interface eth0 enabled
187185
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> set ospf area 0.0.0.0 interface eth0 interface-type point-to-point
188186
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/>
189187
```
190188

191189
Changes can be shown with the `diff` command.
192190

193191
```diff
194-
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> diff
192+
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> diff
195193
+routing {
196194
+ control-plane-protocols {
197195
+ control-plane-protocol ospfv2 name default {
@@ -222,52 +220,17 @@ admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> leave
222220
admin@R1:/>
223221
```
224222

225-
226-
### Checking connectivity
227-
228-
Assuming the above configuration is done on R1 and R2 (with address
229-
10.1.1.2), we can verify connectivity, by pinging the neighbor
230-
router.
231-
232-
```console
233-
admin@R1:/>
234-
admin@R1:/> ping 10.1.1.2
235-
PING 10.1.1.2 (10.1.1.2) 56(84) bytes of data.
236-
64 bytes from 10.1.1.2: icmp_seq=1 ttl=64 time=1.21 ms
237-
64 bytes from 10.1.1.2: icmp_seq=2 ttl=64 time=1.54 ms
238-
^C
239-
--- 10.1.1.2 ping statistics ---
240-
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
241-
rtt min/avg/max/mdev = 1.205/1.374/1.544/0.169 ms
242-
admin@R1:/>
243-
```
244-
245-
We can also view the IP routing table using the `show routes` command
246-
247-
```console
248-
admin@R1:/>
249-
admin@R1:/> show routes
250-
PREFIX NEXT-HOP PREF PROTOCOL
251-
10.1.1.2/32 10.1.1.2 20 ospf
252-
admin@R1:/>
253-
```
254-
255-
OSPF status can be shown with commands such as `show ospf neighbor`,
256-
`show ospf interface`, `show ospf routes`, etc.
223+
When the above configuration is done on R1, and correspondingly on R2
224+
with address 10.1.1.2 ([Figure 2](#fig2)), routing information will be
225+
exchanged using OSPF.
257226

258227
```console
259-
admin@R1:/>
260-
admin@R1:/> show ospf neighbor
261-
262-
Neighbor ID Pri State Up Time Dead Time Address Interface RXmtL RqstL DBsmL
263-
10.1.1.2 1 Full/- 1m01s 38.568s 10.1.1.2 eth0:10.1.1.1 0 0 0
264-
265228
admin@R1:/> show ospf routes
266229
============ OSPF network routing table ============
267230
N 10.1.1.1/32 [0] area: 0.0.0.0
268-
directly attached to lo
231+
directly attached to lo
269232
N 10.1.1.2/32 [10] area: 0.0.0.0
270-
via 10.1.1.2, eth0
233+
via 10.1.1.2, eth0
271234

272235
============ OSPF router routing table =============
273236

@@ -276,92 +239,6 @@ N 10.1.1.2/32 [10] area: 0.0.0.0
276239
admin@R1:/>
277240
```
278241

279-
280-
## Troubleshooting
281-
282-
If OSPF fails to setup the routes, it is usually good to start
283-
checking from bottom up. Is cable connected, are Ethernet interfaces
284-
up, etc. To troubleshoot connectivity, it can be hard to use `IPv4
285-
ping` as we have not assigned any IPv4 address to `eth0` other than
286-
the /32 address. Pinging the neighbor relies on OSPF to work when
287-
unnumbered interfaces are used.
288-
289-
Instead we can use *tcpdump* to listen for LLDP packets.
290-
291-
```console
292-
admin@R1:/> tcpdump eth0
293-
tcpdump: listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
294-
07:22:13.051412 LLDP, length 232: R2
295-
07:22:31.856495 LLDP, length 232: R1
296-
07:22:43.063845 LLDP, length 232: R2
297-
298-
3 packets captured
299-
3 packets received by filter
300-
0 packets dropped by kernel
301-
^C
302-
admin@R1:/>
303-
```
304-
305-
In this case, R1 could see both its outgoing LLDP message and R2's
306-
incoming LLDP. A good sign of connectivity, but we ought to have seen
307-
some OSPF signalling too.
308-
309-
We can also use IPv6 ping to *all-hosts* address. Below R1 sends such
310-
a ping on interface eth0.
311-
312-
```console
313-
admin@R1:/> ping interface eth0 ff02::1
314-
ping: Warning: source address might be selected on device other than: eth0
315-
PING ff02::1(ff02::1) from :: eth0: 56 data bytes
316-
64 bytes from fe80::eec:d1ff:fe04:0%eth0: icmp_seq=1 ttl=64 time=0.022 ms
317-
64 bytes from fe80::e47:2dff:fe15:0%eth0: icmp_seq=1 ttl=64 time=1.34 ms
318-
64 bytes from fe80::eec:d1ff:fe04:0%eth0: icmp_seq=2 ttl=64 time=0.057 ms
319-
64 bytes from fe80::e47:2dff:fe15:0%eth0: icmp_seq=2 ttl=64 time=2.97 ms
320-
^C
321-
--- ff02::1 ping statistics ---
322-
2 packets transmitted, 2 received, +2 duplicates, 0% packet loss, time 1002ms
323-
rtt min/avg/max/mdev = 0.022/1.097/2.968/1.203 ms
324-
admin@R1:/>
325-
```
326-
327-
By looking at sequence numbers, we see duplicate responses for each
328-
ping; one from R1 itself and one from R2. This is also a good sign of
329-
connectivity.
330-
331-
If neighbor connectivity work but you are unable to ping to 10.1.1.2
332-
from R1, the following hints for troubleshooting is suggested.
333-
334-
- Check the IP address status (`show interfaces`) and/or IP address
335-
and forwarding configuration (`show running-config`, look for
336-
*interface eth0* and *interface lo*)
337-
- Check OSPF status, in particular `show ospf neighbor` and `show ospf
338-
interfaces` for hints.
339-
- Chec OSPF configuration, either by `show running-config` (look for
340-
*ietf-routing:routing*) or by entering configuration mode as shown below.
341-
342-
```
343-
admin@R1:/> configure
344-
admin@R1:/config/> edit routing control-plane-protocol ospfv2 name default
345-
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> show
346-
ospf {
347-
areas {
348-
area 0.0.0.0 {
349-
interfaces {
350-
interface eth0 {
351-
interface-type point-to-point;
352-
enabled true;
353-
}
354-
interface lo {
355-
enabled true;
356-
}
357-
}
358-
}
359-
}
360-
}
361-
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/>
362-
```
363-
364-
365242
## Larger setup
366243

367244
Expanding the simple setup, depicted in [Figure 2](#fig2), to the larger
@@ -376,18 +253,16 @@ config as eth0 got before).
376253
First setting IPv4 address and enable forwarding
377254

378255
```console
379-
admin@R1:/>
380256
admin@R1:/> configure
381257
admin@R1:/config/> set interface eth1 ipv4 address 10.1.1.1 prefix-length 32
382-
admin@R1:/config/> set interface eth1 ipv4 forwarding true
258+
admin@R1:/config/> set interface eth1 ipv4 forwarding
383259
```
384260

385261
Then OSPF configuration
386262

387263
```console
388-
admin@R1:/config/>
389264
admin@R1:/config/> edit routing control-plane-protocol ospfv2 name default
390-
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> set ospf area 0.0.0.0 interface eth1 enabled true
265+
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> set ospf area 0.0.0.0 interface eth1 enabled
391266
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> set ospf area 0.0.0.0 interface eth1 interface-type point-to-point
392267
```
393268

@@ -397,21 +272,21 @@ OSPF configuration can be inspected
397272
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> show
398273
ospf {
399274
areas {
400-
area 0.0.0.0 {
401-
interfaces {
402-
interface eth0 {
403-
interface-type point-to-point;
404-
enabled true;
405-
}
406-
interface eth1 {
407-
interface-type point-to-point;
408-
enabled true;
409-
}
410-
interface lo {
411-
enabled true;
412-
}
413-
}
414-
}
275+
area 0.0.0.0 {
276+
interfaces {
277+
interface eth0 {
278+
interface-type point-to-point;
279+
enabled true;
280+
}
281+
interface eth1 {
282+
interface-type point-to-point;
283+
enabled true;
284+
}
285+
interface lo {
286+
enabled true;
287+
}
288+
}
289+
}
415290
}
416291
}
417292
admin@R1:/config/routing/control-plane-protocol/ospfv2/name/default/> leave
@@ -426,18 +301,18 @@ routers. Here is the result at R1.
426301
admin@R1:/> show ospf routes
427302
============ OSPF network routing table ============
428303
N 10.1.1.1/32 [0] area: 0.0.0.0
429-
directly attached to lo
304+
directly attached to lo
430305
N 10.1.1.2/32 [10] area: 0.0.0.0
431-
via 10.1.1.2, eth0
306+
via 10.1.1.2, eth0
432307
N 10.1.1.3/32 [10] area: 0.0.0.0
433-
via 10.1.1.3, eth1
308+
via 10.1.1.3, eth1
434309
N 10.1.1.4/32 [20] area: 0.0.0.0
435-
via 10.1.1.2, eth0
310+
via 10.1.1.2, eth0
436311
N 10.1.1.5/32 [20] area: 0.0.0.0
437-
via 10.1.1.3, eth1
312+
via 10.1.1.3, eth1
438313
N 10.1.1.6/32 [30] area: 0.0.0.0
439-
via 10.1.1.2, eth0
440-
via 10.1.1.3, eth1
314+
via 10.1.1.2, eth0
315+
via 10.1.1.3, eth1
441316

442317
============ OSPF router routing table =============
443318

@@ -464,12 +339,11 @@ router is expected on this LAN, eth2 can be configured as a passive
464339
OSPF interface.
465340

466341
```console
467-
admin@R1:/>
468342
admin@R1:/> configure
469343
admin@R1:/config/> set interface eth2 ipv4 address 10.0.1.1 prefix-length 24
470-
admin@R1:/config/> set interface eth2 ipv4 forwarding true
471-
admin@R1:/config/> set routing control-plane-protocol ospfv2 name default ospf area 0.0.0.0 interface eth2 enabled true
472-
admin@R1:/config/> set routing control-plane-protocol ospfv2 name default ospf area 0.0.0.0 interface eth2 passive true
344+
admin@R1:/config/> set interface eth2 ipv4 forwarding
345+
admin@R1:/config/> set routing control-plane-protocol ospfv2 name default ospf area 0.0.0.0 interface eth2 enabled
346+
admin@R1:/config/> set routing control-plane-protocol ospfv2 name default ospf area 0.0.0.0 interface eth2 passive
473347
admin@R1:/config/> leave
474348
admin@R1:/>
475349
```
@@ -481,23 +355,23 @@ following routing table
481355
admin@R1:/> show ospf routes
482356
============ OSPF network routing table ============
483357
N 10.0.1.0/24 [10] area: 0.0.0.0
484-
directly attached to eth2
358+
directly attached to eth2
485359
N 10.0.6.0/24 [40] area: 0.0.0.0
486-
via 10.1.1.2, eth0
487-
via 10.1.1.3, eth1
360+
via 10.1.1.2, eth0
361+
via 10.1.1.3, eth1
488362
N 10.1.1.1/32 [0] area: 0.0.0.0
489-
directly attached to lo
363+
directly attached to lo
490364
N 10.1.1.2/32 [10] area: 0.0.0.0
491-
via 10.1.1.2, eth0
365+
via 10.1.1.2, eth0
492366
N 10.1.1.3/32 [10] area: 0.0.0.0
493-
via 10.1.1.3, eth1
367+
via 10.1.1.3, eth1
494368
N 10.1.1.4/32 [20] area: 0.0.0.0
495-
via 10.1.1.2, eth0
369+
via 10.1.1.2, eth0
496370
N 10.1.1.5/32 [20] area: 0.0.0.0
497-
via 10.1.1.3, eth1
371+
via 10.1.1.3, eth1
498372
N 10.1.1.6/32 [30] area: 0.0.0.0
499-
via 10.1.1.2, eth0
500-
via 10.1.1.3, eth1
373+
via 10.1.1.2, eth0
374+
via 10.1.1.3, eth1
501375

502376
============ OSPF router routing table =============
503377

@@ -507,7 +381,8 @@ N 10.1.1.6/32 [30] area: 0.0.0.0
507381
admin@R1:/>
508382
```
509383

510-
Verify be letting PC1 ping PC2
384+
Verify by letting PC1 ping PC2, where attached to R1 and R4
385+
respectivly, see [Figure 3](#fig3).
511386

512387
```console
513388
PC1> ping 10.0.6.26

0 commit comments

Comments
 (0)