Browse Tag

ospf

Quagga: From Installation to OSPF Routing Implementation

Quagga is a routing software suite, providing implementations of OSPFv2, OSPFv3, RIP v1 and v2, RIPng and BGP-4 for Unix platforms, particularly FreeBSD, Linux, Solaris and NetBSD. Quagga is a fork of GNU Zebra which was developed by Kunihiro Ishiguro. The Quagga tree aims to build a more involved community around Quagga than the current centralised model of GNU Zebra.

1. Install
#sudo -s <– to be root
#apt-get install quagga

2. Daemons
activate zebra and ospfd routing daemon
#sudo nano /etc/quagga/daemons
zebra=yes
bgpd=no
ospfd=yes
ospf6d=no
ripd=no
ripngd=no
#/etc/init.d/quagga restart

3. Configuration Files
create config files from the sample config file, because we will only use zebra and ospfd so just copy that files
#cp /usr/share/doc/quagga/examples/zebra.conf.sample /etc/quagga/zebra.conf
#cp /usr/share/doc/quagga/examples/ospfd.conf.sample /etc/quagga/ospfd.conf

give user and group ownership to the files inside the /etc/quagga directory

#sudo chown quagga.quaggavty /etc/quagga/*.conf
#sudo chmod 640 /etc/quagga/*.conf
#sudo /etc/init.d/quagga restart
4. Vtysh
We can access the daemons by telnetting their port number because each daemon has its own configuration file and terminal interface.

zebra: 2601
ripd: 2602
ripng: 2603
ospfd: 2603
bgpd: 2604
ospf6d: 2604

by instance, to access the ospfd daemon:
#telnet localhost 2604

As it’s not very practical to configure router by telnetting its daemons separately, vtysh has been created to configure everything in one
single interface.

To use vtysh, we must first create its configuration file as follows:
#cp /usr/share/doc/quagga/examples/vtysh.conf.sample /etc/quagga/vtysh.conf

and edit the vtysh.conf as follows:
#sudo nano /etc/quagga/vtysh.conf
/etc/quagga/vtysh.conf
!
! Sample
!
! service integrated-vtysh-config
hostname quagga-router
username root nopassword
!

apply correct permissions and restart Quagga:

#sudo chown quagga.quaggavty /etc/quagga/*.conf
#sudo chmod 640 /etc/quagga/*.conf
#sudo /etc/init.d/quagga restart

Then it’s useful to add the “VTYSH_PAGER=more” setting in our /etc/environment file, otherwise we will see an unfriendly “(END)” blinking
in the left-down corner of the screen each time we enter a command and will need to press the “q” key to continue.
#echo VTYSH_PAGER=more > /etc/environment

Run Quagga Configuration using vtysh
root@quagga-Inspiron-660:~# vtysh

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

quagga-router#

see the exiting zebra configuration
quagga-router# show run
Building configuration…

Current configuration:
!
hostname Router
hostname ospfd
log stdout
hostname quagga-router
!
service integrated-vtysh-config
!
password zebra
enable password zebra
!
interface eth0
ipv6 nd suppress-ra
!
interface lo
!
interface wlan0
ipv6 nd suppress-ra
!
router ospf
network 163.180.0.0/16 area 0.0.0.0
!
ip forwarding
!
line vty
!
end

5. IP forwarding

IP forwarding is required to transfer packets between the network interfaces of a Linux system.

we can activate the IP forwarding through Quagga router
#vtysh
quagga-router#conf t
quagga-router(config)# ip forwarding
quagga-router(config)#exit
quagga-router#write

see the IP forwarding status using this command
quagga-router# show ip forwarding
IP forwarding is on

6. Interface configuration
to see the interface configuration in Quagga just use the following command
quagga-router# show interface
Interface eth0 is up, line protocol detection is disabled
index 2 metric 1 mtu 1500
flags: <UP,BROADCAST,RUNNING,MULTICAST>
HWaddr: c8:1f:66:15:55:07
inet 163.180.116.26/24 broadcast 163.180.116.255
inet6 fe80::ca1f:66ff:fe15:5507/64
Interface lo is up, line protocol detection is disabled
index 1 metric 1 mtu 65536
flags: <UP,LOOPBACK,RUNNING>
inet 127.0.0.1/8
inet6 ::1/128
Interface wlan0 is up, line protocol detection is disabled
index 3 metric 1 mtu 1500
flags: <UP,BROADCAST,MULTICAST>
HWaddr: 3c:77:e6:3a:70:1c
inet 192.168.1.1/24 broadcast 192.168.1.255

to modify interface configuration (as well as linux interface config) in Quagga
quagga-router# conf t
quagga-router(config)# int wlan0 <– name of interface
quagga-router(config-if)# ip address 192.168.1.1/24 <– ip address for this interface and subnet mask
quagga-router(config-if)# no shutdown <– shutting up the interface
quagga-router(config-if)# exit
quagga-router(config)# exit
quagga-router# write

7. Routing Configuration

For our network, we try to use OSPF as routing protocol.
The example configuration to activate ospf in Quagga
quagga-router# conf t
quagga-router(config)# router ospf
quagga-router(config-router)# network 163.180.0.0/16 <– list of network address that we will include in OSPF routing
quagga-router(config-router)# exit
quagga-router(config)# exit
quagga-router# write

to see our ospf active or not, just use following command (be consider our neighbor router also use the ospf routing)
quagga-router# show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface RXmtL RqstL DBsmL
10.2.1.5 1 Full/DR 30.258s 163.180.116.1 eth0:163.180.116.26 0 0 0

or we can type show ip route (ospf indicated with “O”)

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

O 0.0.0.0/0 [110/1] via 163.180.116.1, eth0, 01:52:33
K>* 0.0.0.0/0 via 163.180.116.1, eth0
O>* 10.1.2.2/32 [110/14] via 163.180.116.1, eth0, 01:52:34
O>* 10.1.3.3/32 [110/14] via 163.180.116.1, eth0, 01:52:34
O>* 10.1.8.8/32 [110/13] via 163.180.116.1, eth0, 01:52:34
O>* 10.1.10.10/32 [110/14] via 163.180.116.1, eth0, 01:52:34
O>* 10.1.11.11/32 [110/14] via 163.180.116.1, eth0, 01:52:34
O>* 10.1.12.12/32 [110/15] via 163.180.116.1, eth0, 01:52:34
O>* 10.1.13.13/32 [110/14] via 163.180.116.1, eth0, 01:52:34
O>* 10.1.14.14/32 [110/14] via 163.180.116.1, eth0, 01:52:34
O>* 10.1.15.15/32 [110/14] via 163.180.116.1, eth0, 01:52:34
O>* 10.2.1.1/32 [110/12] via 163.180.116.1, eth0, 01:52:34
O>* 10.2.1.2/32 [110/12] via 163.180.116.1, eth0, 01:52:34
O>* 10.2.1.5/32 [110/11] via 163.180.116.1, eth0, 01:52:34
O>* 10.2.1.6/32 [110/12] via 163.180.116.1, eth0, 01:52:34
O>* 10.2.1.7/32 [110/12] via 163.180.116.1, eth0, 01:52:34
O>* 10.2.1.8/32 [110/12] via 163.180.116.1, eth0, 01:52:34
O>* 10.2.1.9/32 [110/12] via 163.180.116.1, eth0, 01:52:34
O>* 61.78.44.24/32 [110/20] via 163.180.116.1, eth0, 01:52:33

———————————————
More complex OSPF Configuration on Quagga (see toplogy)
note: please consider that upstream router already configured

koren

QuaggaCNU
———-
quagga-router# conf t
quagga-router(config)# int fa0/0
quagga-router(config-interface)# ip address 192.168.1.1/24
quagga-router(config-interface)# no shutdown
quagga-router# write
quagga-router# conf t
quagga-router(config)# int fa0/1
quagga-router(config-interface)# ip address 192.168.2.2/24
quagga-router(config-interface)# no shutdown
quagga-router# write
quagga-router# conf t
quagga-router(config)# int e0/1/0
quagga-router(config-interface)# ip address 192.168.4.1/24
quagga-router(config-interface)# no shutdown
quagga-router# write

quagga-router(config)# router ospf
quagga-router(config-router)# network 192.168.1.0/24 area 0
quagga-router(config-router)# network 192.168.2.0/24 area 0
quagga-router(config-router)# network 192.168.3.0/24 area 0
quagga-router(config)# exit
quagga-router# write

quagga-router#show ip ospf neighbor
quagga-router#show ip route
quagga#show ip route
Codes: C – connected, S – static, I – IGRP, 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, E – EGP
i – IS-IS, 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

C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
O 192.168.3.0/24 [110/2] via 192.168.2.1, 05:41:56, FastEthernet0/1
C 192.168.4.0/24 is directly connected, Ethernet0/1/0
O 192.168.5.0/24 [110/3] via 192.168.2.1, 05:38:24, FastEthernet0/1
O 192.168.6.0/24 [110/4] via 192.168.2.1, 05:36:44, FastEthernet0/1
O 192.168.7.0/24 [110/13] via 192.168.2.1, 03:42:08, FastEthernet0/1
O 192.168.8.0/24 [110/3] via 192.168.2.1, 03:35:02, FastEthernet0/1
O 192.168.9.0/24 [110/4] via 192.168.2.1, 03:33:57, FastEthernet0/1
O 192.168.10.0/24 [110/13] via 192.168.2.1, 03:33:57, FastEthernet0/1
O 192.168.11.0/24 [110/3] via 192.168.2.1, 03:28:31, FastEthernet0/1
O 192.168.12.0/24 [110/4] via 192.168.2.1, 03:27:02, FastEthernet0/1
O 192.168.13.0/24 [110/13] via 192.168.2.1, 03:27:02, FastEthernet0/1
O 192.168.14.0/24 [110/3] via 192.168.2.1, 03:20:01, FastEthernet0/1
O 192.168.15.0/24 [110/4] via 192.168.2.1, 03:19:01, FastEthernet0/1
O 192.168.16.0/24 [110/13] via 192.168.2.1, 03:19:01, FastEthernet0/1
QuaggaKyunghee
———-
quagga-router# conf t
quagga-router(config)# int fa0/0
quagga-router(config-interface)# ip address 192.168.5.2/24
quagga-router(config-interface)# no shutdown
quagga-router# write
quagga-router# conf t
quagga-router(config)# int fa0/1
quagga-router(config-interface)# ip address 192.168.6.1/24
quagga-router(config-interface)# no shutdown
quagga-router# write
quagga-router# conf t
quagga-router(config)# int e0/1/0
quagga-router(config-interface)# ip address 192.168.7.1/24
quagga-router(config-interface)# no shutdown
quagga-router# write

quagga-router(config)# router ospf
quagga-router(config-router)# network 192.168.5.0/24 area 0
quagga-router(config-router)# network 192.168.6.0/24 area 0
quagga-router(config-router)# network 192.168.7.0/24 area 0
quagga-router(config)# exit
quagga-router# write

quagga-router#show ip ospf neighbor
quagga-router#show ip route
quagga#show ip route
Codes: C – connected, S – static, I – IGRP, 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, E – EGP
i – IS-IS, 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

O 192.168.1.0/24 [110/4] via 192.168.5.1, 05:43:28, FastEthernet0/0
O 192.168.2.0/24 [110/3] via 192.168.5.1, 05:43:28, FastEthernet0/0
O 192.168.3.0/24 [110/2] via 192.168.5.1, 05:43:28, FastEthernet0/0
O 192.168.4.0/24 [110/13] via 192.168.5.1, 05:43:28, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet0/0
C 192.168.6.0/24 is directly connected, FastEthernet0/1
C 192.168.7.0/24 is directly connected, Ethernet0/1/0
O 192.168.8.0/24 [110/3] via 192.168.5.1, 03:41:43, FastEthernet0/0
O 192.168.9.0/24 [110/4] via 192.168.5.1, 03:40:38, FastEthernet0/0
O 192.168.10.0/24 [110/13] via 192.168.5.1, 03:40:38, FastEthernet0/0
O 192.168.11.0/24 [110/3] via 192.168.5.1, 03:35:12, FastEthernet0/0
O 192.168.12.0/24 [110/4] via 192.168.5.1, 03:33:42, FastEthernet0/0
O 192.168.13.0/24 [110/13] via 192.168.5.1, 03:33:42, FastEthernet0/0
O 192.168.14.0/24 [110/3] via 192.168.5.1, 03:26:42, FastEthernet0/0
O 192.168.15.0/24 [110/4] via 192.168.5.1, 03:25:42, FastEthernet0/0
O 192.168.16.0/24 [110/13] via 192.168.5.1, 03:25:42, FastEthernet0/0

QuaggaKorea
———-
quagga-router# conf t
quagga-router(config)# int fa0/0
quagga-router(config-interface)# ip address 192.168.8.2/24
quagga-router(config-interface)# no shutdown
quagga-router# write
quagga-router# conf t
quagga-router(config)# int fa0/1
quagga-router(config-interface)# ip address 192.168.9.1/24
quagga-router(config-interface)# no shutdown
quagga-router# write
quagga-router# conf t
quagga-router(config)# int e0/1/0
quagga-router(config-interface)# ip address 192.168.10.1/24
quagga-router(config-interface)# no shutdown
quagga-router# write

quagga-router(config)# router ospf
quagga-router(config-router)# network 192.168.8.0/24 area 0
quagga-router(config-router)# network 192.168.9.0/24 area 0
quagga-router(config-router)# network 192.168.10.0/24 area 0
quagga-router(config)# exit
quagga-router# write

quagga-router#show ip ospf neighbor
quagga-router#show ip route
quagga#show ip route
Codes: C – connected, S – static, I – IGRP, 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, E – EGP
i – IS-IS, 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

O 192.168.1.0/24 [110/4] via 192.168.8.1, 03:42:24, FastEthernet0/0
O 192.168.2.0/24 [110/3] via 192.168.8.1, 03:42:24, FastEthernet0/0
O 192.168.3.0/24 [110/2] via 192.168.8.1, 03:42:24, FastEthernet0/0
O 192.168.4.0/24 [110/13] via 192.168.8.1, 03:42:24, FastEthernet0/0
O 192.168.5.0/24 [110/3] via 192.168.8.1, 03:42:24, FastEthernet0/0
O 192.168.6.0/24 [110/4] via 192.168.8.1, 03:42:24, FastEthernet0/0
O 192.168.7.0/24 [110/13] via 192.168.8.1, 03:42:24, FastEthernet0/0
C 192.168.8.0/24 is directly connected, FastEthernet0/0
C 192.168.9.0/24 is directly connected, FastEthernet0/1
C 192.168.10.0/24 is directly connected, Ethernet0/1/0
O 192.168.11.0/24 [110/3] via 192.168.8.1, 03:36:51, FastEthernet0/0
O 192.168.12.0/24 [110/4] via 192.168.8.1, 03:35:22, FastEthernet0/0
O 192.168.13.0/24 [110/13] via 192.168.8.1, 03:35:22, FastEthernet0/0
O 192.168.14.0/24 [110/3] via 192.168.8.1, 03:28:21, FastEthernet0/0
O 192.168.15.0/24 [110/4] via 192.168.8.1, 03:27:21, FastEthernet0/0
O 192.168.16.0/24 [110/13] via 192.168.8.1, 03:27:21, FastEthernet0/0
for the other routers.. please try configure by yourself 😀