Configuration examples with quagga

I have heard of Quagga for sometime but I had never tried it until now. Quagga was installed on my old Core duo, 2GB laptop.

Quagga is a suite of routing daemons, the suite contains these daemons:

1. ospfd – For managing OSPFv2 routing protocol.

2. ospfv6d – For managing OSPFv3 routing protocol.

3. zebra – For managing the entire routing daemon operation, only zebra can assign ip addresses, only zebra can do static route and static default route, the other routing daemons are strictly for specific routing configuration. Hence at anytime at least two daemons must be started if you desire to use dynamic routing protocol.

4. isisd – For managing IS-IS (ipv4)

5. bgpd – For managing BGP.

6. ripd – For managing ripv1 and v2.

7. ripngd – For managing ripng.

Quagga commands are easy to learn, because almost exactly the same as Cisco IOS command syntax. Interestingly autocomplete feature also exists in quagga, as long as the command is not ambiguous you can execute the command without typing in full. ? online help is also available if you want to know the commands, just like a Cisco IOS.

Simple demonstration


telnet localhost zebra
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Hello, this is Quagga (version 0.99.18).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

User Access Verification

Password:
kmint>
kmint> enable
kmint# conf t
kmint(config)#

Originally I wanted to use the vtysh which is a program shell to unify all the daemons but it is not working.

What I do is to use konsole terminal and open tab for zebra and ospf.

To assign ip address on interface and to check interface on zebra do this:

kmint# sh int
Interface eth0 is up, line protocol detection is disabled
  Description: To master stack port 2
  index 2 metric 1 mtu 1500
  flags:
  HWaddr:
  inet 10.1.1.2/24 broadcast 10.1.1.255
  inet6
Interface eth1 is up, line protocol detection is disabled
  Description: To stack member port 2
  index 4 metric 1 mtu 1500
  flags:
  HWaddr:
  inet 10.1.2.2/24 broadcast 10.1.2.255
  inet6
Interface lo is up, line protocol detection is disabled
  index 1 metric 1 mtu 16436
  flags:
  inet 5.5.5.5/32
  inet 127.0.0.1/8
  inet6 ::1/128
kmint#

kmint# show interface eth1
Interface eth1 is up, line protocol detection is disabled
  Description: To stack member port 2
  index 4 metric 1 mtu 1500
  flags:
  HWaddr:
  inet 10.1.2.2/24 broadcast 10.1.2.255
  inet6
kmint#

If you like to see the full command just use tab, as long as the command is not ambiguous you can abbreviate the command such as above i.e. sh int and show interface produce the same results.

kmint# conf t
kmint(config)# int eth1
kmint(config-if)# description To member stack port 2
kmint(config-if)# ip address 10.1.2.2/24
kmint(config-if)#

Configuring interface ip address is almost the same as Cisco, quagga uses CIDR notation which is much shorter 🙂

Only one OSPF process is allowed. Here is how ospf is configured with quagga.

kmint(config)# router ospf
kmint(config-router)# router-id 5.5.5.5
kmint(config-router)# passive-interface default
kmint(config-router)# no passive-interface eth0
kmint(config-router)# no passive-interface eth1
kmint(config-router)# no passive-interface lo
kmint(config-router)# network 10.1.1.2/24 area 1
kmint(config-router)# network 10.1.2.2/24 area 1
kmint(config-router)# network 5.5.5.5/32 area 1
kmint(config-router)# end
kmint#

Isn’t this cool? 😉 It looks exactly like Cisco IOS command syntax.

Let’s check the routing table with show ip route in zebra.

kmint# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
       I - ISIS, B - BGP, > - selected route, * - FIB route

C>* 5.5.5.5/32 is directly connected, lo
O   10.1.1.0/24 [110/10] is directly connected, eth0, 00:02:06
C>* 10.1.1.0/24 is directly connected, eth0
O   10.1.2.0/24 [110/10] is directly connected, eth1, 00:01:47
C>* 10.1.2.0/24 is directly connected, eth1
C>* 127.0.0.0/8 is directly connected, lo
kmint#

Those entries with “>*” are preferred routes. show ip route command cannot be executed in ospfd, it can only be executed in zebra, let’s look at the show ip route command options.

kmint# show ip route
  bgp             Border Gateway Protocol (BGP)
  connected       Connected
  isis            ISO IS-IS (ISIS)
  kernel          Kernel
  ospf            Open Shortest Path First (OSPF)
  rip             Routing Information Protocol (RIP)
  static          Static routes
  A.B.C.D         Network in the IP routing table to display
  A.B.C.D/M       IP prefix /, e.g., 35.0.0.0/8
  summary         Summary of all routes
  supernets-only  Show supernet entries only

kmint# show ip route

What I did was show ip route ? although the “?” was not shown.

OSPF related command can only be executed on ospfd.

kmint# show ip ospf neighbor

    Neighbor ID Pri State           Dead Time Address         Interface            RXmtL RqstL DBsmL
4.4.4.4           1 Full/DR           34.036s 10.1.1.1        eth0:10.1.1.2            0     0     0
4.4.4.4           1 Full/DR           33.625s 10.1.2.1        eth1:10.1.2.2            0     0     0
kmint#
kmint# show ip ospf
  border-routers  for this area
  database        Database summary
  interface       Interface information
  neighbor        Neighbor list
  route           OSPF routing table

kmint# show ip ospf

It is also possible to change ospf network types under interface.

kmint# conf t
kmint(config)# interface eth0
kmint(config-if)# ip ospf network
  broadcast            Specify OSPF broadcast multi-access network
  non-broadcast        Specify OSPF NBMA network
  point-to-multipoint  Specify OSPF point-to-multipoint network
  point-to-point       Specify OSPF point-to-point network
kmint(config-if)# ip ospf network

OSPF cost can also be adjusted on interfaces.

kmint(config-if)# ip ospf cost
    Cost
kmint(config-if)# ip ospf cost

To save the configuration.

kmint# wr
Configuration saved to /etc/quagga/zebra.conf
kmint#
kmint(config)# wr
Configuration saved to /etc/quagga/ospfd.conf
kmint(config)#

Make sure the config files belong to quagga:quaggavty.

Output from Cisco router


03:18:22: %OSPF-5-ADJCHG: Process 1, Nbr 5.5.5.5 on FastEthernet1/0/2 from LOADING to FULL, Loading Done
03:18:34: %OSPF-5-ADJCHG: Process 1, Nbr 5.5.5.5 on FastEthernet2/0/2 from LOADING to FULL, Loading Done

Switch#sh 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

     5.0.0.0/32 is subnetted, 1 subnets
O       5.5.5.5 [110/11] via 10.1.2.2, 00:00:04, FastEthernet2/0/2
                [110/11] via 10.1.1.2, 00:00:04, FastEthernet1/0/2
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.2.0 is directly connected, FastEthernet2/0/2
C       10.1.1.0 is directly connected, FastEthernet1/0/2
Switch#
Switch#ping 5.5.5.5

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/16 ms
Switch#

Cisco 3750 switch could ping quagga route server’s loopback.

4 thoughts on “Configuration examples with quagga

  1. Hello, great site thank you !
    Can you tell me, is it necessary to edit iptables to allow ospf communication between the linux router and other routers ? – I have everything configured like you have, but I am getting no communication with other OSPF routers ?

    1. you have to allow all ip protocol 89 traffic in the input and output chain of filter table which destionation ip is 224.0.0.5 or 224.0.0.6

      In my lab I have noticed that there is also unicast ip proto 89 traffic between the ospf quagga routers. (I am not sure; I think it’s between DR and BDR) You have to allow them too. I don’t know if the source and destation ips are the physical ips or the loopback IPs of the routers.

      Furthermore I’ve seen IGMP traffic in my firewall log which has also to be allowed in order to get ospf working. As far as I know you have to allow all outgoing traffic for ip protocol 2.

      What’s your experience with linux, iptables and quagga? I thought to be quite familiar with ospf and routing but now I know that there are a lot of errors you can make.

  2. Can we have selected source routing in Quagga – ospf/rip; say we will only route from these selected routes, and we will send LSA route-updates to only defined neighbours.

Leave a comment