User Tools

Site Tools


documentation:examples:ospf_inter-area_loop_prevention

OSPF inter-area loop prevention (using Quagga)

Presentation

This lab show a non optimum route selection because of inter-area loop prevention feature of OSPF.

Network diagram

Here is the OSPF and logical view:

Preparing

This chapter will describe how to start the lab.

Downloading BSD Router Project images

Download Qemu-KVM/Virtualbox Lab scripts

More information on these BSDRP lab scripts available on How to build a BSDRP router lab.

Starting the lab

If you would to use Virtualbox, start this lab with:

virtualbox.sh -i BSDRP_0.35_full_amd64_vga.img -n 4 -c

The output should be like that:

[olivier@bigdev]~>/usr/src/tools/tools/nanobsd/BSDRP/virtualbox.sh -n 4 -c
BSD Router Project: VirtualBox lab script
Creating lab with 4 router(s):
- 0 LAN between all routers
- Full mesh ethernet point-to-point link between each routers
- One NIC connected to the shared LAN with the host

Router1 have the following NIC:
em0 connected to Router2.
em1 connected to Router3.
em2 connected to Router4.
em3 connected to shared-with-host LAN.
Router2 have the following NIC:
em0 connected to Router1.
em1 connected to Router3.
em2 connected to Router4.
em3 connected to shared-with-host LAN.
Router3 have the following NIC:
em0 connected to Router1.
em1 connected to Router2.
em2 connected to Router4.
em3 connected to shared-with-host LAN.
Router4 have the following NIC:
em0 connected to Router1.
em1 connected to Router2.
em2 connected to Router3.
em3 connected to shared-with-host LAN.
Connect to the router 1 by vnc client on port 5901
Connect to the router 2 by vnc client on port 5902
Connect to the router 3 by vnc client on port 5903
Connect to the router 4 by vnc client on port 5904
You need to configure an IP address in these range for communicating with the host:
        inet 192.168.56.1 netmask 0xffffff00 broadcast 192.168.56.255
        inet6 fe80::800:27ff:fe00:0%vboxnet0 prefixlen 64 scopeid 0x5

Routers configuration

Router 1

Configure hostname, edit /etc/rc.conf

hostname="R1.bsdrp.net"

Then apply changes:

hostname R1.bsdrp.net

Enter in quagga mode:

vtysh

And configure it:

R1.bsdrp.net# conf t
R1.bsdrp.net(config)# int em2
R1.bsdrp.net(config-if)# ip address 192.168.1.1/24
R1.bsdrp.net(config-if)# ip ospf cost 1
R1.bsdrp.net(config-if)# int em0
R1.bsdrp.net(config-if)# ip address 10.0.0.1/30
R1.bsdrp.net(config-if)# ip ospf cost 1
R1.bsdrp.net(config-if)# int em1
R1.bsdrp.net(config-if)# ip address 10.0.0.5/30
R1.bsdrp.net(config-if)# ip ospf cost 100
R1.bsdrp.net(config-if)# router ospf
R1.bsdrp.net(config-router)# router-id 1.1.1.1
R1.bsdrp.net(config-router)# network 192.168.1.0/24 area 1
R1.bsdrp.net(config-router)# network 10.0.0.0/30 area 0
R1.bsdrp.net(config-router)# network 10.0.0.4/30 area 0
R1.bsdrp.net(config)# exit
R1.bsdrp.net# wr
Building Configuration...
Configuration saved to /usr/local/etc/quagga/zebra.conf
Configuration saved to /usr/local/etc/quagga/ripd.conf
Configuration saved to /usr/local/etc/quagga/ripngd.conf
Configuration saved to /usr/local/etc/quagga/ospfd.conf
Configuration saved to /usr/local/etc/quagga/ospf6d.conf
Configuration saved to /usr/local/etc/quagga/bgpd.conf
Configuration saved to /usr/local/etc/quagga/isisd.conf
[OK]
R1.bsdrp.net# exit
[root@R1]~#config save
Archiving configuration files...
Saving configuration...
/etc/local/quagga/ripd.conf -> /cfg/local/quagga/ripd.conf
/etc/local/quagga/ospfd.conf -> /cfg/local/quagga/ospfd.conf
/etc/local/quagga/bgpd.conf -> /cfg/local/quagga/bgpd.conf
/etc/local/quagga/isisd.conf -> /cfg/local/quagga/isisd.conf
/etc/local/quagga/ospf6d.conf -> /cfg/local/quagga/ospf6d.conf
/etc/local/quagga/ripngd.conf -> /cfg/local/quagga/ripngd.conf
/etc/local/quagga/zebra.conf -> /cfg/local/quagga/zebra.conf
Done.

Router 2

Configure hostname, edit /etc/rc.conf

hostname="R2.bsdrp.net"

Then apply changes:

hostname R2.bsdrp.net

Enter in quagga mode:

vtysh

And configure it:

R2.bsdrp.net# conf t
R2.bsdrp.net(config)# in em0
R2.bsdrp.net(config-if)# ip address 10.0.0.2/30
R2.bsdrp.net(config-if)# ip ospf cost 1
R2.bsdrp.net(config-if)# in em1
R2.bsdrp.net(config-if)# ip address 10.0.0.9/30
R2.bsdrp.net(config-if)# ip ospf cost 1
R2.bsdrp.net(config-if)# router ospf
R2.bsdrp.net(config-router)# router-id 2.2.2.2
R2.bsdrp.net(config-router)# network 10.0.0.0/30 area 0
R2.bsdrp.net(config-router)# network 10.0.0.8/30 area 2
R2.bsdrp.net(config-router)# exit
R2.bsdrp.net(config)# exit
R2.bsdrp.net# wr
Building Configuration...
Configuration saved to /usr/local/etc/quagga/zebra.conf
Configuration saved to /usr/local/etc/quagga/ripd.conf
Configuration saved to /usr/local/etc/quagga/ripngd.conf
Configuration saved to /usr/local/etc/quagga/ospfd.conf
Configuration saved to /usr/local/etc/quagga/ospf6d.conf
Configuration saved to /usr/local/etc/quagga/bgpd.conf
Configuration saved to /usr/local/etc/quagga/isisd.conf
[OK]
R2.bsdrp.net# exit
[root@R2]~#config save
Archiving configuration files...
Saving configuration...
/etc/local/quagga/ripd.conf -> /cfg/local/quagga/ripd.conf
/etc/local/quagga/ospfd.conf -> /cfg/local/quagga/ospfd.conf
/etc/local/quagga/bgpd.conf -> /cfg/local/quagga/bgpd.conf
/etc/local/quagga/isisd.conf -> /cfg/local/quagga/isisd.conf
/etc/local/quagga/ospf6d.conf -> /cfg/local/quagga/ospf6d.conf
/etc/local/quagga/ripngd.conf -> /cfg/local/quagga/ripngd.conf
/etc/local/quagga/zebra.conf -> /cfg/local/quagga/zebra.conf
Done.

Router 3

Configure hostname, edit /etc/rc.conf

hostname="R3.bsdrp.net"

Then apply changes:

hostname R3.bsdrp.net

Enter in quagga mode:

vtysh

And configure it:

R3.bsdrp.net# conf t
R3.bsdrp.net(config)# int em0
R3.bsdrp.net(config-if)# ip address 10.0.0.6/30
R3.bsdrp.net(config-if)# ip ospf cost 100
R3.bsdrp.net(config-if)# int em1
R3.bsdrp.net(config-if)# ip address 10.0.0.10/30
R3.bsdrp.net(config-if)# ip ospf cost 1
R3.bsdrp.net(config-if)# int em2
R3.bsdrp.net(config-if)# ip address 10.0.0.13/30
R3.bsdrp.net(config-if)# ip ospf cost 1
R3.bsdrp.net(config-if)# router ospf
R3.bsdrp.net(config-router)# router-id 3.3.3.3
R3.bsdrp.net(config-router)# network 10.0.0.4/30 area 0
R3.bsdrp.net(config-router)# network 10.0.0.8/30 area 2
R3.bsdrp.net(config-router)# network 10.0.0.12/30 area 2
R3.bsdrp.net(config-router)# exit
R3.bsdrp.net(config)# exit
R3.bsdrp.net# wr
Building Configuration...
Configuration saved to /usr/local/etc/quagga/zebra.conf
Configuration saved to /usr/local/etc/quagga/ripd.conf
Configuration saved to /usr/local/etc/quagga/ripngd.conf
Configuration saved to /usr/local/etc/quagga/ospfd.conf
Configuration saved to /usr/local/etc/quagga/ospf6d.conf
Configuration saved to /usr/local/etc/quagga/bgpd.conf
Configuration saved to /usr/local/etc/quagga/isisd.conf
[OK]
R3.bsdrp.net# exit
[root@R3]~#config save
Archiving configuration files...
Saving configuration...
/etc/local/quagga/ripd.conf -> /cfg/local/quagga/ripd.conf
/etc/local/quagga/ospfd.conf -> /cfg/local/quagga/ospfd.conf
/etc/local/quagga/bgpd.conf -> /cfg/local/quagga/bgpd.conf
/etc/local/quagga/isisd.conf -> /cfg/local/quagga/isisd.conf
/etc/local/quagga/ospf6d.conf -> /cfg/local/quagga/ospf6d.conf
/etc/local/quagga/ripngd.conf -> /cfg/local/quagga/ripngd.conf
/etc/local/quagga/zebra.conf -> /cfg/local/quagga/zebra.conf
Done.

Router 4

Configure hostname, edit /etc/rc.conf

hostname="R4.bsdrp.net"

Then apply changes:

hostname R4.bsdrp.net

Enter in quagga mode:

vtysh

And configure it:

R4.bsdrp.net# conf t
R4.bsdrp.net(config)# int em2
R4.bsdrp.net(config-if)# ip address 10.0.0.14/30
R4.bsdrp.net(config-if)# ip ospf cost 1
R4.bsdrp.net(config-if)# int em0
R4.bsdrp.net(config-if)# ip address 192.168.2.1/24
R4.bsdrp.net(config-if)# ip ospf cost 1
R4.bsdrp.net(config-if)# router ospf
R4.bsdrp.net(config-router)# router-id 4.4.4.4
R4.bsdrp.net(config-router)# network 10.0.0.12/30 area 2
R4.bsdrp.net(config-router)# network 192.168.2.0/24 area 2
R4.bsdrp.net(config-router)# exit
R4.bsdrp.net(config)# exit
R4.bsdrp.net# wr
Building Configuration...
Configuration saved to /usr/local/etc/quagga/zebra.conf
Configuration saved to /usr/local/etc/quagga/ripd.conf
Configuration saved to /usr/local/etc/quagga/ripngd.conf
Configuration saved to /usr/local/etc/quagga/ospfd.conf
Configuration saved to /usr/local/etc/quagga/ospf6d.conf
Configuration saved to /usr/local/etc/quagga/bgpd.conf
Configuration saved to /usr/local/etc/quagga/isisd.conf
[OK]
R4.bsdrp.net# exit
[root@R4]~#config save
Archiving configuration files...
Saving configuration.../etc/local/quagga/ripd.conf -> /cfg/local/quagga/ripd.conf
/etc/local/quagga/ospfd.conf -> /cfg/local/quagga/ospfd.conf
/etc/local/quagga/bgpd.conf -> /cfg/local/quagga/bgpd.conf
/etc/local/quagga/isisd.conf -> /cfg/local/quagga/isisd.conf
/etc/local/quagga/ospf6d.conf -> /cfg/local/quagga/ospf6d.conf
/etc/local/quagga/ripngd.conf -> /cfg/local/quagga/ripngd.conf
/etc/local/quagga/zebra.conf -> /cfg/local/quagga/zebra.conf
Done.

The problem

What route will R4 take for joining network 192.168.1.0/24 ?

R4.bsdrp.net# sh ip route 192.168.1.0/24
Routing entry for 192.168.1.0/24
  Known via "ospf", distance 110, metric 4, best
  Last update 00:02:12 ago
  * 10.0.0.13, via em2

Notice the OSPF metric for this route: 4, this mean the route should be: R4 → R3 → R2 → R1.

Great, how about a traceroute:

R4.bsdrp.net# traceroute ip 192.168.1.1
traceroute to 192.168.1.1 (192.168.1.1), 64 hops max, 52 byte packets
 1  10.0.0.13 (10.0.0.13)  0.668 ms  0.317 ms  0.209 ms
 2  192.168.1.1 (192.168.1.1)  1.169 ms  0.574 ms  0.742 ms

Where is R2 hop ??

Verifying the 192.168.1.0/24 route on R3:

R3.bsdrp.net# sh ip route 192.168.1.0
Routing entry for 192.168.1.0/24
  Known via "ospf", distance 110, metric 101, best
  Last update 00:32:13 ago
  * 10.0.0.5, via em0

R3 didn't choose the “best” path for reach 192.168.1.0/24: The installed route have a metric of 101. How about its OSPF database state:

R3.bsdrp.net# sh ip ospf database summary 192.168.1.0

       OSPF Router with ID (3.3.3.3)


                Summary Link States (Area 0.0.0.0)

  LS age: 1345
  Options: 0x2  : *|-|-|-|-|-|E|*
  LS Flags: 0x6
  LS Type: summary-LSA
  Link State ID: 192.168.1.0 (summary Network Number)
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000004
  Checksum: 0x9456
  Length: 28
  Network Mask: /24
        TOS: 0  Metric: 1


                Summary Link States (Area 0.0.0.2)

  LS age: 2456
  Options: 0x2  : *|-|-|-|-|-|E|*
  LS Flags: 0x6
  LS Type: summary-LSA
  Link State ID: 192.168.1.0 (summary Network Number)
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000001
  Checksum: 0x8662
  Length: 28
  Network Mask: /24
        TOS: 0  Metric: 2

  LS age: 1087
  Options: 0x2  : *|-|-|-|-|-|E|*
  LS Flags: 0x3
  LS Type: summary-LSA
  Link State ID: 192.168.1.0 (summary Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000002
  Checksum: 0x4838
  Length: 28
  Network Mask: /24
        TOS: 0  Metric: 101

ABR (R3) expects summary LSAs from Area 0 only. Then R3 ignore summary LSA received from R2 (area 2)

documentation/examples/ospf_inter-area_loop_prevention.txt · Last modified: 2011/08/12 16:47 (external edit)