Network routing protocols fall into two foremost classes: inside gateway protocols and exterior gateway protocols. Interior gateway protocols are utilized by routers to share data inside a single autonomous system. If you might be operating Linux, you can also make your system behave as a router by means of the open supply (GPLv2) routing stack Quagga.
What is Quagga?
Quagga is a routing software suite and a fork of GNU Zebra. It supplies implementations of all main routing protocols corresponding to Open Shortest Path First (OSPF), Routing Information Protocol (RIP), Border Gateway Protocol (BGP), and Intermediate System to Intermediate System (IS-IS) for Unix-like platforms.
Although Quagga implements the routing protocols for each IPv4 and IPv6, it would not act as a whole router. A real router not solely implements all of the routing protocols but additionally has the flexibility to ahead community visitors. Quagga solely implements the routing stack, and the job of forwarding community visitors is dealt with by the Linux kernel.
Architecture
Quagga implements the completely different routing protocols by means of protocol-specific daemons. The daemon title is identical because the routing protocol adopted by the letter “d.” Zebra is the core and a protocol-independent daemon that gives an abstraction layer to the kernel and presents the Zserv API over TCP sockets to Quagga purchasers. Each protocol-specific daemon is liable for operating the related protocol and constructing the routing desk primarily based on the data exchanged.
Setup
This tutorial implements the OSPF protocol to configure dynamic routing utilizing Quagga. The setup consists of two CentOS 7.7 hosts, named Alpha and Beta. Both hosts share entry to the 192.168.122.zero/24 community.
Host Alpha:
IP: 192.168.122.100/24
Gateway: 192.168.122.1
Host Beta:
IP: 192.168.122.50/24
Gateway: 192.168.122.1
Install the package deal
First, set up the Quagga package deal on each hosts. It is obtainable within the CentOS base repo:
yum set up quagga -y
Enable IP forwarding
Next, allow IP forwarding on each hosts since that may carried out by the Linux kernel:
sysctl -w web.ipv4.ip_forward = 1
sysctl -p
Configuration
Now, go into the /and many others/quagga listing and create the configuration information to your setup. You want three information:
- zebra.conf: Quagga’s daemon configuration file, which is the place you will outline the interfaces and their IP addresses and IP forwarding
- ospfd.conf: The protocol configuration file, which is the place you will outline the networks that can be provided by means of the OSPF protocol
- daemons: Where you will specify the related protocol daemons which can be required to run
On host Alpha,
[root@alpha]# cat /and many others/quagga/zebra.conf
interface eth0
ip handle 192.168.122.100/24
ipv6 nd suppress-ra
interface eth1
ip handle 10.12.13.1/24
ipv6 nd suppress-ra
interface lo
ip forwarding
line vty[root@alpha]# cat /and many others/quagga/ospfd.conf
interface eth0
interface eth1
interface lo
router ospf
community 192.168.122.zero/24 space zero.zero.zero.zero
community 10.12.13.zero/24 space zero.zero.zero.zero
line vty[root@alphaa ~]# cat /and many others/quagga/daemons
zebra=sure
ospfd=sure
On host Beta,
[root@beta quagga]# cat zebra.conf
interface eth0
ip handle 192.168.122.50/24
ipv6 nd suppress-ra
interface eth1
ip handle 10.10.10.1/24
ipv6 nd suppress-ra
interface lo
ip forwarding
line vty[root@beta quagga]# cat ospfd.conf
interface eth0
interface eth1
interface lo
router ospf
community 192.168.122.zero/24 space zero.zero.zero.zero
community 10.10.10.zero/24 space zero.zero.zero.zero
line vty[root@beta ~]# cat /and many others/quagga/daemons
zebra=sure
ospfd=sure
Configure the firewall
To use the OSPF protocol, you have to enable it within the firewall:
firewall-cmd --add-protocol=ospf –everlastingfirewall-cmd –reload
Now, begin the zebra and ospfd daemons.
# systemctl begin zebra
# systemctl begin ospfd
Look on the route desk on each hosts utilizing:
[root@alpha ~]# ip route present
default by way of 192.168.122.1 dev eth0 proto static metric 100
10.10.10.zero/24 by way of 192.168.122.50 dev eth0 proto zebra metric 20
10.12.13.zero/24 dev eth1 proto kernel scope hyperlink src 10.12.13.1
192.168.122.zero/24 dev eth0 proto kernel scope hyperlink src 192.168.122.100 metric 100
You can see that the routing desk on Alpha comprises an entry of 10.10.10.zero/24 by way of 192.168.122.50 provided by means of protocol zebra. Similarly, on host Beta, the desk comprises an entry of community 10.12.13.zero/24 by way of 192.168.122.100.
[root@beta ~]# ip route present
default by way of 192.168.122.1 dev eth0 proto static metric 100
10.10.10.zero/24 dev eth1 proto kernel scope hyperlink src 10.10.10.1
10.12.13.zero/24 by way of 192.168.122.100 dev eth0 proto zebra metric 20
192.168.122.zero/24 dev eth0 proto kernel scope hyperlink src 192.168.122.50 metric 100
Conclusion
As you may see, the setup and configuration are comparatively easy. To add complexity, you may add extra community interfaces to the router to offer routing for extra networks. You may implement BGP and RIP protocols utilizing the identical technique.
![](https://breakingexpress.com/wp-content/uploads/2017/09/breakingexpress200px.png)