zoukankan      html  css  js  c++  java
  • 使用 Quagga 将你的 CentOS 变成 OSPF 路由器


    http://www.ahlinux.com/open/9171.html


    发布时间:2014-11-16 21:54:51   编辑:AHLinux.com

    Quagga是一个开源路由软件套件,可以将Linux变成支持如RIP、OSPF、BGP和IS-IS等主要路由协议的路由器。它具有对IPv4 和IPv6的完整支持,并支持路由/前缀过滤。Quagga可以是你生命中的救星,以防你的生产路由器一旦宕机,而你没有备用的设备而只能等待更换。通过 适当的配置,Quagga甚至可以作为生产路由器。

    本教程中,我们将连接假设之间具有专线连接的两个分支机构网络(例如,192.168.1.0/24和172.17.1.0/24)。

    我们的CentOS位于所述专用链路的两端。两台主机名分别设置为“site-A-RTR”和“site-B-RTR'。下面是IP地址的详细信息。

    • Site-A : 192.168.1.0/24
    • Site-B : 172.16.1.0/24
    • 两个 Linux 路由器之间的对等网络 : 10.10.10.0/30

    Quagga包括了几个协同工作的守护进程。在本教程中,我们将重点建立以下守护进程。

    1. Zebra : 核心守护进程,负责内核接口和静态路由。
    2. Ospfd : IPv4 OSPF 守护进程。

    在CentOS上安装Quagga

    我们使用yum安装Quagga。

    1. # yum install quagga

    在CentOS7,SELinux默认会阻止quagga将配置文件写到/usr/sbin/zebra。这个SELinux策略会干扰我们接下来要介绍 的安装过程,所以我们要禁用此策略。对于这一点,无论是关闭SELinux(这里不推荐),还是如下启用“zebra write config”都可以。如果你使用的是CentOS 6的请跳过此步骤。

    1. # setsebool -P zebra_write_config 1

    如果没有做这个修改,在我们尝试在Quagga命令行中保存配置的时候看到如下错误。

    1. Can 't open configuration file /etc/quagga/zebra.conf.OS1Uu5.

    安装完Quagga后,我们要配置必要的对等IP地址,并更新OSPF设置。Quagga自带了一个命令行称为vtysh。vtysh里面用到的Quagga命令与主要的路由器厂商如思科和Juniper是相似的。

    步骤 1: 配置 Zebra

    我们首先创建Zebra配置文件,并启用Zebra守护进程。

    1. # cp /usr/share/doc/quagga-XXXXX/zebra.conf.sample /etc/quagga/zebra.conf
    2. # service zebra start
    3. # chkconfig zebra on

    启动vtysh命令行:

    1. # vtysh

    首先,我们为Zebra配置日志文件。输入下面的命令进入vtysh的全局配置模式:

    1. site - A - RTR # configure terminal

    指定日志文件位置,接着退出模式:

    1. site - A - RTR ( config )# log file / var / log / quagga / quagga . log
    2. site - A - RTR ( config )# exit

    永久保存配置:

    1. site - A - RTR # write

    接下来,我们要确定可用的接口并按需配置它们的IP地址。

    1. site - A - RTR # show interface
    1. Interface eth0 is up , line protocol detection is disabled
    2. . . . . .
    3. Interface eth1 is up , line protocol detection is disabled
    4. . . . . .

    配置eth0参数:

    1. site - A - RTR # configure terminal
    2. site - A - RTR ( config )# interface eth0
    3. site - A - RTR ( config - if )# ip address 10.10 . 10.1 / 30
    4. site - A - RTR ( config - if )# description to - site - B
    5. site - A - RTR ( config - if )# no shutdown

    继续配置eth1参数:

    1. site - A - RTR ( config )# interface eth1
    2. site - A - RTR ( config - if )# ip address 192.168 . 1.1 / 24
    3. site - A - RTR ( config - if )# description to - site - A - LAN
    4. site - A - RTR ( config - if )# no shutdown

    现在验证配置:

    1. site - A - RTR ( config - if )# do show interface
    1. Interface eth0 is up , line protocol detection is disabled
    2. . . . . .
    3. inet 10.10 . 10.1 / 30 broadcast 10.10 . 10.3
    4. . . . . .
    5. Interface eth1 is up , line protocol detection is disabled
    6. . . . . .
    7. inet 192.168 . 1.1 / 24 broadcast 192.168 . 1.255
    8. . . . . .
    1. site - A - RTR ( config - if )# do show interface description
    1. Interface Status Protocol Description
    2. eth0 up unknown to - site - B
    3. eth1 up unknown to - site - A - LAN

    永久保存配置:

    1. site - A - RTR ( config - if )# do write

    在site-B上重复上面配置IP地址的步骤。

    如果一切顺利,你应该可以在site-A的服务器上ping通site-B上的对等IP地址10.10.10.2了。

    注意:一旦Zebra的守护进程启动了,在vtysh命令行中的任何改变都会立即生效。因此没有必要在更改配置后重启Zebra守护进程。



  • 相关阅读:
    leetcode 347. Top K Frequent Elements
    581. Shortest Unsorted Continuous Subarray
    leetcode 3. Longest Substring Without Repeating Characters
    leetcode 217. Contains Duplicate、219. Contains Duplicate II、220. Contains Duplicate、287. Find the Duplicate Number 、442. Find All Duplicates in an Array 、448. Find All Numbers Disappeared in an Array
    leetcode 461. Hamming Distance
    leetcode 19. Remove Nth Node From End of List
    leetcode 100. Same Tree、101. Symmetric Tree
    leetcode 171. Excel Sheet Column Number
    leetcode 242. Valid Anagram
    leetcode 326. Power of Three
  • 原文地址:https://www.cnblogs.com/ztguang/p/12645793.html
Copyright © 2011-2022 走看看