In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to use Quagga to turn CentOS devices into OSPF routers. I think it is very practical, so I share it with you. I hope you can get something after reading this article.
Quagga is an open source routing software suite that can be used to turn your Linux device into a full-featured router that supports several major routing protocols, such as RIP, OSPF, BGP or ISIS routers. It is fully prepared for IPv4 and IPv6, and also supports routing / prefix filtering. In case the router in your production environment breaks down and you don't have a backup router on hand, waiting for a replacement, Quagga can come in handy. With proper configuration, Quagga can even be configured as a router in a production environment.
In this tutorial, we will connect two hypothetical branch networks (such as 192.168.1.0 and 172.17.1.0) with a dedicated link between them.
Our CentOS devices are located at both ends of this dedicated link. The host names of these two devices are set to "site-A-RTR" and "site-B-RTR", respectively. Information about the IP address is provided below.
Site-A:192.168.1.0/24
Site-B:172.16.1.0/24
Peer-to-peer between two Linux devices: 10.10.10.Compact 30
The Quagga software contains several background programs that run together. In this tutorial, we will focus on setting up the following daemons.
Zebra: core daemon, responsible for kernel interfaces and static routing.
Ospfd:IPv4 OSPF daemon.
Install Quagga on CentOS
We first use yum to install Quagga.
# yum install quagga
On CentOS 7, SELinux prevents / usr/sbin/zebra from being written to its configuration directory by default. This SELinux policy interferes with the installation process we want to describe, so we want to disable it. To do this, turn off SELinux (not recommended), or enable the "zebra_write_config" Boolean expression, as shown below. If you use CentOS 6, you can skip this step.
# setsebool-P zebra_write_config 1
Without this change, we will see the following error when we try to save the Zebra configuration from Quagga's command shell.
Can't open configuration file / etc/quagga/zebra.conf.OS1Uu5.
Unable to open configuration file / etc/quagga/zebra.conf.OS1Uu5. )
After Quagga is installed, we configure the necessary peer IP addresses and update the OSPF settings. Quagga comes with a command line shell called vtysh. The Quagga commands used in vtysh are similar to those of major router manufacturers such as Cisco or Juniper.
* phases: configure Zebra
We first create a Zebra configuration file, and then start the Zebra daemon.
# cp / usr/share/doc/quagga-XXXXX/zebra.conf.sample / etc/quagga/zebra.conf
# service zebra start
# chkconfig zebra on
Start the vtysh command shell:
# vtysh
First, we configure the log file for Zebra. To do this, enter global configuration mode in vtysh by entering the following:
Site-A-RTR# configure terminal
And specify the log file location, and then exit the mode:
Site-A-RTR (config) # log file / var/log/quagga/quagga.log
Site-A-RTR (config) # exit
* sexual save configuration:
Site-A-RTR# write
Next, we identify the available interfaces if necessary, and then configure the IP address.
Site-A-RTR# show interface
Interface eth0 is up, line protocol detection is disabled
. . . . .
Interface eth2 is up, line protocol detection is disabled
. . . . .
Configure eth0 parameters:
Site-A-RTR# configure terminal
Site-A-RTR (config) # interface eth0
Site-A-RTR (config-if) # ip address 10.10.10.1 move 30
Site-A-RTR (config-if) # description to-site-B
Site-A-RTR (config-if) # no shutdown
Continue to configure eth2 parameters:
Site-A-RTR (config) # interface eth2
Site-A-RTR (config-if) # ip address 192.168.1.1 Universe 24
Site-A-RTR (config-if) # description to-site-A-LAN
Site-A-RTR (config-if) # no shutdown
Now verify the configuration:
Site-A-RTR (config-if) # do show interface
Interface eth0 is up, line protocol detection is disabled
. . . . .
Inet 10.10.10.1/30 broadcast 10.10.10.3
. . . . .
Interface eth2 is up, line protocol detection is disabled
. . . . .
Inet 192.168.1.1/24 broadcast 192.168.1.255
. . . . .
Site-A-RTR (config-if) # do show interface description
Interface Status Protocol Description
Eth0 up unknown to-site-B
Eth2 up unknown to-site-A-LAN
* sexual save configuration:
Site-A-RTR (config-if) # do write
Repeat the IP address configuration step for the site-B server as well.
If all goes well, you should be able to ping the site-B peer IP 10.10.10.2 from the site-A server.
Please note that once the Zebra daemon is started, any changes made with the command line interface of vtysh will take effect immediately. There is no need to restart the Zebra daemon after a configuration change.
Phase 2: configure OSPF
Let's first create an OSPF configuration file, and then start the OSPF daemon:
# cp / usr/share/doc/quagga-XXXXX/ospfd.conf.sample / etc/quagga/ospfd.conf
# service ospfd start
# chkconfig ospfd on
Now start the vtysh shell and continue with the OSPF configuration:
# vtysh
Enter router configuration mode:
Site-A-RTR# configure terminal
Site-A-RTR (config) # router ospf
You can also set router-id manually:
Site-A-RTR (config-router) # router-id 10.10.10.1
Add the network that will participate in the OSPF:
Site-A-RTR (config-router) # network 10.10.10. Lash 30 area 0
Site-A-RTR (config-router) # network 192.168.1.0 Universe 24 area 0
* sexual save configuration:
Site-A-RTR (config-router) # do write
Repeat a similar OSPF configuration for site-B:
Site-B-RTR (config-router) # network 10.10.10. Lash 30 area 0
Site-B-RTR (config-router) # network 172.16.1.0 take 24 area 0
Site-B-RTR (config-router) # do write
The OSPF neighbor should now show up. As long as ospfd is running, any OSPF-related configuration changes made through the vtysh shell will take effect immediately, and there is no need to restart ospfd.
In the next section, we will verify the installed Quagga environment.
Verification
1. Use ping to test
First of all, you should be able to ping from site-A to check the local area network of site-B. Make sure your firewall is not blocking ping from detecting traffic.
[root@site-A-RTR ~] # ping 172.16.1.1-c 2
two。 Check the routing tabl
There should be necessary routes in both the kernel and the Quagga routing table.
[root@site-A-RTR ~] # ip route
10.10.10.0/30 dev eth0 proto kernel scope link src 10.10.10.1
172.16.1.0/30 via 10.10.10.2 dev eth0 proto zebra metric 20
192.168.1.0/24 dev eth2 proto kernel scope link src 192.168.1.1
[root@site-A-RTR ~] # vtysh
Site-A-RTR# show ip route
Codes: K-kernel route, C-connected, S-static, R-RIP, O-OSPF
I-ISIS, B-BGP, >-selected route, *-FIB route
O 10.10.10.0/30 [110/10] is directly connected, eth0, 00:14:29
C > * 10.10.10.0.0 30 is directly connected, eth0
C > * 127.0.0.0 8 is directly connected, lo
O > * 172.16.1.0 via 30 [110 shock 20] 10.10.10.2, eth0, 00:14:14
C > * 192.168.1.0 is directly connected 24, eth2
3. Verify OSPF neighbors and routers
Inside the vtysh shell, you can check to see if the necessary neighbors are present and remember the appropriate routes.
[root@site-A-RTR ~] # vtysh
Site-A-RTR# show ip ospf neighbor
Generally speaking, Quagga makes it easy to configure ordinary Linux devices to support dynamic routing protocols such as OSPF, RIP, or BGP. Quagga-enabled devices can contact and exchange routes with any other router you may have in your network. Because Quagga supports several major open standard routing protocols, it may be a priority in many scenarios. Even better, the command-line interface of Quagga is almost the same as that of major router manufacturers such as Cisco or Juniper, making it easy to deploy and maintain Quagga devices.
The above is how to use Quagga to turn CentOS devices into OSPF routers. Xiaobian believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.