HOWTO: OSPF with Quagga and Bird

OSPF is a routing protocol to help you propagate ip routes.

I propose to show you a minimalistic installation of 3 hosts talking to each other with ospf:
I am purposely giving the minimum set of instructions to get the hosts started as OSPF neighbors.
  1. A- Cisco router (ip:10.0.0.1)
  2. B- FreeBSD using Quagga net/quagga (ip:10.0.0.2)
  3. C- FreeBSD using Bird net/bird (ip:10.0.0.3)

A- Sample Cisco OSPF configuration:
Code:
!
interface FastEthernet 0/0
ip address 10.0.0.1 255.255.255.0
!
!
router ospf 1
network 10.0.0.0 0.0.0.255 area 0


B- FreeBSD with net/quagga
Code:
pkg install net/quagga

Customize the quagga configurations files:

1- Customize the general quagga daemon zebra: /user/local/etc/quagga/zebra.conf
Add the following:
Code:
hostname myquagga
password mypassword
enable pasword mypassword

2- Customize the quagga ospf daemon: /usr/local/etc/quagga/ospfd.conf
Add the following:
Code:
hostname myospfquagga
password mypassword
enable password mypassword
!
router ospf
network 10.0.0.0/24 area 0.0.0.0

Make quagga start automatically:
Add the following in the /etc/rc.conf
Code:
# assign ip:10.0.0.2/24 to your network interface
# replace em0 with your nic (bge0, xl0, rl0 ...)
ifconfig_em0="inet 10.0.0.2/24"

# auto start quagga
quagga_enable="YES"
quagga_daemons="zebra ospfd"

# you will most probably need to enable ip forwarding if this host will be used as a router.
# an alternative way is: sysctl net.inet.ip.forwarding=1
gateway_enable="YES"

Start quagga with: service start quagga






C- FreeBSD with net/bird
Code:
pkg install net/bird

Customize the Bird configurations files:

1- There is only one configuration file:
/usr/local/etc/bird.conf
Here is a minimalistic config:
Code:
# instruct Bird to manipulate the FreeBSD kernel routing table
protocol kernel {
        learn;                  # Learn even routes entered manually with "route add"
        scan time 20;       # Scan kernel routing table every 20 seconds
        import all;            # Default is import all
        export all;            # Default is export none
}

# This pseudo-protocol watches all interface up/down events.
protocol device {
        scan time 10;           # Scan interfaces every 10 seconds
}

protocol ospf MyOSPF {
        area 0.0.0.0 {
                networks {
                        10.0.0.0/24;
                };
                interface "em0" {
                # this tells Bird to talk ospf on this interface em0 (customize as needed)
                # notice: unlike Cisco and quagga, you need to specify the interface
                };
        };
}

Make Bird start automatically:
Add the following in the file /etc/rc.conf
Code:
# assign ip:10.0.0.3/24 to your network interface
# replace em0 with your nic (bge0, xl0, rl0 ...)
ifconfig_em0="inet 10.0.0.3/24"

# auto start bird
bird_enable="YES"

# you will most probably want to enable ip forwarding if this host will be used as a router.
# an alternative way is: sysctl net.inet.ip.forwarding=1
gateway_enable="YES"

Start bird with: service start bird


======================
Troubleshooting your setup:

A- For Cisco
You would telnet or ssh.

B- For Quagga
Quagga tries to mimick Cisco, you can access the CLI by telnet on ports 2601 for zebra and 2604 for ospfd
sockstat | grep quagga

These are some interesting troublshooting commands in Zebra:
telnet localhost 2601
Like Cisco, go in "enable" mode enable

Code:
#show inteface
#show ip route
#show ip route ospf
#show ip route kernel

Look also in the Quagga's ospfd telnet cli:
telnet localhost 2604
Like Cisco, go in "enable" mode enable
Code:
# show ip ospf border-routers
# show ip ospf interface
# show ip ospf neighbor
# show ip ospf database
# show ip ospf route

C- For Bird
Bird has a command line interface: birdc
you could use the interactive form or command-args like so:
Code:
# find the status of Bird, look for "Daemon is up"
>birdc show status

# list the interaces seen by Bird
>birdc show interfaces

# list the protocols seen by Bird
# you should see the OSPF line listed as Running
>birdc show protocols

# notice I used the custom name kenel1
# since you may have several kernel protocols
# as you might have several OSPF protocols
# protocol names are listed with "show protocols"
>birdc show route protocol kernel1
>birdc show route protocol MyOSPF
 
Back
Top