现在的位置: 首页 > 综合 > 正文

Quagga 简介

2018年03月15日 ⁄ 综合 ⁄ 共 17223字 ⁄ 字号 评论关闭

什么是Quagga
  Quagga软件原名是Zebra是由一个日本开发团队编写的一个以GNU版权方式发布的软件。Quagga项目开始与1996年,当前版本是0.98.4版 可以使用Quagga将linux机器打造成一台功能完备的路由器。
Quagga支持的路由协议
  Quagga能够同时支持RIPv1、RIPv2、RIPng、OSPFv2、OSPFv3、BGP-4和 BGP-4+等诸多TCP/IP协议。其中:
  RIPv1、RIPv2、OSPFv2适用于Ipv4的自治域系统内部网络路由协议。
  BGP-4是用于Ipv4的自治域系统之间的外部网络路由协议。
  RIPng、OSPFv3、BGP-4+主要扩展对Ipv6的支持。
Quagga的特性
  模块化设计:Quagga基于模块化方案的设计,即对每一个路由协议使用单独的守护进程。
  运行速度快:因为使用了模块化的设计,使得Quagga的运行速度比一般的路由选择程序要快。
  可靠性高:在所有软件模块都失败的情况下,路由器可以继续保持连接并且daemons也会继续运行。故障诊断不必离线的状态下被诊断和更正
  支持Ipv6:Quagga不仅支持Ipv4,还支持Ipv6。
Quagga的运行机制
  由于Quagga采用模块化的设计,因此Quagga运行时要运行多个守护进程,包括ripd ripngd ospfd ospf6d bgpd 和Zebra。
  其中,Zebra守护进程用来更新内核的路由表,而其他的守护进程负责进行相应路由选择协议的路由更新。
Quagga的好处
  就路由器而论,虽然有各种硬件可用,但是费用较高。所以想到用一个运行Linux系统构件的功能丰富的路由器作为代替。Quagga路由守护程序已经使这一切变为现实。因为Quagga支持Ipv4、Ipv6和其他各式各样的协议,所以能够满足通常所有的路由需要。
  使用Quagga的另一个好处是,这个软件配置的很多方面跟Cisco的IOS配置几乎完全相同,如果你在Cisco IOS环境中工作,可以轻松的过渡到Quagga系统,同时,使用Quagga特能让你积累起丰富的类似于使用Cisco IOS路由器的经验和知识。
  总之,现在完全可以拿一台PC机来完成一些必须用昂贵的Cisco路由器才能完成的比较复杂的路由协议处理控制功能。
Quagga使用基础
1、 Quagga的安装与启动
Red Hat EL 3自带了Quagga,下面以RPM包的安装为例介绍Quagga的安装。若用户已经安装了Quagga则可跳过下面的安装步骤。

//将Red Hat EL3 的第一章光盘放入光驱然后挂载
cd /mnt/cdrom/Red Hat/RPMS
rpm –ivh quagga*
//程序将自动安装quagga-0.96.2-4.3E.i386.rpm软件包
 
用户也可以到www.quagga.net网站自行下载最新版的软件源代码包安装。
2、 Quagga的配置文件
Quagga的配置文件均放在/etc/quagga目录下。
可以使用下面命令察看Quagga默认的配置文件:
 

# ll /etc/quagga
-rw-------    1 root     root          570 Nov 14  2003 bgpd.conf
-rw-------    1 root     root         1170 Nov 14  2003 ospf6d.conf
-rw-------    1 quagga   quagga        420 Aug  8 09:41 ospfd.conf
-rw-------    1 quagga   quagga        177 Aug  1 16:52 ripd.conf
-rw-------    1 quagga   quagga        439 Aug  1 14:29 zebra.conf
-rw-r-----    1 root     root            0 Jul 25  09:32 vtysh.conf
 
其中:vtysh.conf为配置Quagga所使用的shell的配置文件,zebra.conf是Quagga的主要配置文件。
Quagga对每钟路由选择协议有单独的配置文件:
RIP 所需的 ripd.conf
OSPF所需的ospf.conf
BGP所需的 bgp.conf
这些配置文件也存放在/etc/quagga目录下。
3、 Quagga的配置模式
下面列表说明Quagga的配置模式。
 

配置子模式
 
提示符
 
说明
 
 
Ineterface
 
Quagga(config-if)#
 
端口配置
 
 
Subinterface
 
Quagga(config-subif)#
 
子端口配置
 
 
Controller
 
Quagga(config-controller)#
 
控制器配置
 
 
Map-list
 
Quagga(config-map-list)#
 
影象表配置
 
 
Map-class
 
Quagga(config-map-class)#
 
影象类配置
 
 
Line
 
Quagga(config-line)#
 
线路配置
 
 
Router
 
Quagga(config-router)#
 
路由配置
 
 
Ipx router
 
Quagga(config-ipx-router)#
 
IPX路由配置
 
 
Router map
 
Quagga(config-router-map)#
 
路由影象配置
 
4.启动Quagga
   使用如下命令启动Quagga
 

//启动Quagga
# service zebra start
Starting zebra:                                        [  OK  ]
 
软件Quagga的总控制台启动了,管理端口号2601。
5.基本路由配置命令
直接用telnet连接:
 

# telnet localhost 2601
Trying 127.0.0.1...
Connected to vpntest.huatech.com (127.0.0.1).
Escape character is '^]'.
Hello, this is quagga (version 0.96.2).
Copyright 1996-2002 Kunihiro Ishiguro.
User Access Verification
Password:
Quagga会提示输入口令,我们通过/etc/quagga/zebra可以看到口令是zebra,enable口令也是zebra。输 入口令zebra,得到路由器用户模式提示符:
Router>
进入特权模式:
Router> enable
Password:
Router#
输入一个问号,看看Quagga提供了多少路由命令:
Router# ?
  configure  Configuration from vty interface
  copy       Copy configuration
  debug      Debugging functions (see also 'undebug')
  disable    Turn off privileged mode command
  end        End current mode and change to enable mode.
  exit       Exit current mode and down to previous mode
  help       Description of the interactive help system
  list       Print command list
  no         Negate a command or set its defaults
  quit       Exit current mode and down to previous mode
  show       Show running system information
  terminal   Set terminal line parameters
  who        Display who is on vty
  write      Write running configuration to memory, network, or terminal
察看一下当前的配置
Router# show running-config
Current configuration:
!
hostname Router
password zebra
enable password zebra
!
interface lo
!
interface eth0
!
interface eth1
!
line vty
!
end
Quagga把操作系统的网络接口当做路由器的接口,所以在做比较复杂的路由实验,会需要比较多的网卡。
进入全局模式,尽可能把实际可用的配置命令都实验一遍:
Router# configure terminal
Router(config)#
取一个路由器名字:
Router(config)# hostname r1
r1(config)#
Quagga比较简单,登陆口令不是在line下修改,而是直接在全局模式下用password修改
r1(config)# password {password}
Quagga不支持enable secret {password}这种MD5加密口令,只能使用enable password {password}来修改 enable口令:
r1# configure terminal
r1(config)# enable password {password}
在路由器配置中加密所有的口令:
r1(config)# service password-encryption
回到特权模式:
r1(config)# exit
r1# show running-config
Current configuration:
!
hostname r1
password 8 alA5.vcyMAwXQ
enable password 8 ksbxOFN8xcFMc
service password-encryption
!
interface lo
!
interface eth0
!
interface eth1
!
line vty
!
end
我们看到刚才的明文密码都进行加密了,给我们的实验机也提高安全性。Quagga有一点要值得注意,如果我 们先设置了service password-encryption,然后再修改口令,show running-config就发现口令又都是明文的了,但是由 于有service password-encryption,所以就无法登陆了。
去掉会话超时,免得10分钟没有动作,就把我们给踢了。但是在实际的路由器配置中,为安全起见我们 最好还是设上会话超时。
r1# conf t
r1(config)# line vty
r1(config-line)# exec-timeout 0 0
设置日志记录,Quagga可以把日志记录到标准输出、syslog、以及指定输出文件:
r1(config-line)# exit
r1(config)# log stdout
r1(config)# no log stdout
r1(config)# log syslog
r1(config)# no log syslog
r1(config)# log file /usr/local/etc/zebra.log
配置接口IP地址:
r1(config)# interface lo
r1(config-if)# ip address 127.0.0.1/8
r1(config-if)# exit
r1(config)# interface eth0
r1(config-if)# ip address 192.9.200.231/24
r1(config)# interface eth1
r1(config-if)# ip address 192.168.1.232/24
Quagga比较奇怪,不能使用ip address 192.9.200.179 255.255.255.0这种形式设置IP。测试一下,就设置成 和Linux中使用的一样。
保存我们刚才的配置:
r1(config-if)# exit
r1(config)# exit
r1# copy running-config startup-config
Configuration saved to /usr/quagga/zebra.conf
r1#
 
这样一个完整的Quagga自身的配置就完成了,希望读者在下面自己多多练习,熟悉基本命令。下面我们将要以RIP OSPF BGP协议为基础讲解具体的Quagga在网络中路由器的应用并以下图为网络环境
用Quagga配置RIP路由协议
RIP是应用较早、使用较普遍的IGP,适用于小型同类网络,是典型的距离向量(distance-vector)协 议。RIP通过广播UDP报文来交换路由信息,每30秒发送一次路由信息更新。RIP提供跳跃计数(hop count)作为尺度来衡量路由距离,跳跃计数是一个包到达目标所必须经过的路由器的数目。如果到相同 目标有二个不等速或不同带宽的路由器,但跳跃计数相同,则RIP认为两个路由是等距离的。RIP最多支 持的跳数为15,即在源和目的网间所要经过的最多路由器的数目为15,跳数16表示不可达。RIPv2支持 验证、密钥管理、路由汇总、无类域间路由(CIDR)和变长子网掩码(VLSMs)。
Quagga支持RIPv2,使用ripd程序实现RIP路由功能,但ripd程序需要在zebra程序读取接口信息,所以zebra 一定要在ripd之前启动。由于条件所限,下面的RIP实验是在两台双网卡的RedHat  El 3下做的,所以只是网络环境不复杂的情况下配置RIP.
按照上面基本配置的方法初始化第一台机器:
 

#  telnet localhost 2601
Password:
Router> enable
Password:
Router# configure terminal
Router(config)# hostname r1
r1(config)# interface eth0
r1(config-if)# ip address 192.9.200.179/24
r1(config-if)# ctrl+z
r1(config)# interface eth1
r1(config-if)# ip address 192.168.2.179/24
r1# copy run start
进入第一台机器的rip设置
# service ripd start
# telnet localhost 2602
Password:
ripd> enable
ripd# configure terminal
ripd(config)# hostname r1_ripd !改个名字好辨认
r1_ripd(config)# router rip !启动rip
r1_ripd(config-router)# network 192.9.200.0/24
!RIPv1是有类别路由协议,RIPv2是无类别路由协议,Quagga 默认支持RIPv2,指定网络需要子网掩码
r1的RIP简单配置这样就可用了,下面来检验一下:
ri_ripd#show ip rip status
Routing Protocol is "rip"
  Sending updates every 30 seconds with +/-50%, next due in 10 seconds
  Timeout after 180 seconds, garbage collect after 120 seconds
  Outgoing update filter list for all interface is not set
  Incoming update filter list for all interface is not set
  Default redistribution metric is 1
  Redistributing:
  Default version control: send version 2, receive any version
    Interface        Send  Recv   Key-chain
    eth1             2     1 2
  Routing for Networks:
    192.168.2.0/24
    192.9.200.179
  Routing Information Sources:
    Gateway          BadPackets BadRoutes  Distance Last Update
  Distance: (default is 120)
在shell下 用tail命令查看。
r1_ripd# debug rip events
r1_ripd# debug rip packet
r1_ripd(config)# log file /usr/local/etc/ripd.log
然后我们在shell下查看debug信息
# tail -f /usr/local/etc/ripd.log
--------------------------------8<---------------------------------------<><!-----------------------------------------
2005/08/01 22:17:44 RIP: update timer fire!
2005/08/01 22:17:44 RIP: SEND UPDATE to eth0 ifindex 2
2005/08/01 22:17:44 RIP: multicast announce on eth0
2005/08/01 22:17:44 RIP: update routes on interface eth0 ifindex 2
2005/08/01 22:18:23 RIP: update timer fire!
2005/08/01 22:18:23 RIP: SEND UPDATE to eth0 ifindex 2
2005/08/01 22:18:23 RIP: multicast announce on eth0
2005/08/01 22:18:23 RIP: update routes on interface eth0 ifindex 2
2005/08/01 22:19:04 RIP: update timer fire!
2005/08/01 22:19:04 RIP: SEND UPDATE to eth0 ifindex 2
2005/08/01 22:19:04 RIP: multicast announce on eth0
2005/08/01 22:19:04 RIP: update routes on interface eth0 ifindex 2
--------------------------------8<----------------------------------<><!------------------------------------
RIP每隔30秒发送一次更新,在show ip rip status可以看到Sending updates every 30 seconds with +/-50%
第二台机器的设置
前面的初始化和第一台一样,不过这里名字设成r2便于辨认,IP设成了192.9.200.231 /24
192.168.1.232。
进入第二台机器的rip设置
# service ripd start
shell_2> telnet localhost 2602
Password:
ripd> en
ripd# conf t
ripd(config)# hostname r2_ripd
r2_ripd(config)# router rip
r2_ripd(config-router)# network 192.9.200.0/24
执行完network命令,我们看到第一台机器的tail -f /usr/local/etc/ripd.log输出下面的信息:
--------------------------------8<---------------------------------------<><!-----------------------------------------
2005/08/01 22:19:15 RIP: RECV packet from 192.9.200.231 port 520 on eth0
2005/08/01 22:19:15 RIP: RECV REQUEST version 2 packet size 24
2005/08/01 22:19:15 RIP:   0.0.0.0/0 -> 0.0.0.0 family 0 tag 0 metric 16
2005/08/01 22:19:15 RIP: update routes to neighbor 192.9.200.231
2005/08/01 22:19:35 RIP: update timer fire!
2005/08/01 22:19:35 RIP: SEND UPDATE to eth0 ifindex 2
2005/08/01 22:19:35 RIP: multicast announce on eth0
2005/08/01 22:19:35 RIP: update routes on interface eth0 ifindex 2
--------------------------------8<----------------------------------<><!------------------------------------
r1通过UDP广播接收到192.168.9.200.231的更新包,并且把192.9.200.231设为neighbor
通过show ip rip命令进一步确定rip路由已经启动,如下显示:
Codes: R - RIP, C - connected, S - Static, O - OSPF, B - BGP
Sub-codes:
      (n) - normal, (s) - static, (d) - default, (r) - redistribute,
      (i) - interface
     Network         Next Hop         Metric From            Tag Time
C(i) 192.168.1.0/24     0.0.0.0             1 self                 0
R(n) 192.168.2.0/24     192.9.200.179      2 192.9.200.179         0 02:41
<!------------------------------------
<!-----------------------------------------
<!------------------------------------
<!-----------------------------------------
</!-----------------------------------------
</!------------------------------------
</!-----------------------------------------
</!------------------------------------
 
这样一个完整的Quagga下的RIP路由试验应经成功的完成,请读者牢记上面所涉及的路由命令
用Quagga配置OSPF路由协议
OSPF(开放最短路径优先)路由协议是一项链路状态型技术,是目前IGP中应用最广、性能最优的一个 协议,解决了RIP不能解决的大型、可扩展的网络需求而写的,适用于大规模的网络。
Quagga支持OSPFv2和OSPFv3(用于IPv6的OSPF,CISCO还未对其封装),由于条件所限,下面的OSPF实 验同样是在两台双网卡的RedHat EL 3下做的。
Quagga使用ospfd程序实现OSPF路由功能,但ospfd需要从zebra程序获得接口信息,所以zebra程序必须在 ospfd程序之前运行。ospfd不支持多个OSPF进程,我们不能指定OSPF进程号。
初始化第一台机器:
 

#telnet localhost 2601
Password:
Router> enable
Password:
Router# configure terminal
Router(config)# hostname r1
r1(config)# interface eth0
r1(config-if)# ip address 192.9.200.179/24
r1(config-if)# ctrl+z
r1(config)# interface eth1
r1(config-if)# ip address 192.168.2.179/24
r1# copy run start
 
进入第一台机器的ospf设置
 

#service ospfd start
# telnet localhost 2604
Password:
ospfd> enable
ospfd# configure terminal
ospfd(config)# hostname r1_ospfd
r1_ospfd(config)# router ospf                        !启动ospf
r1_ospfd(config-router)# ospf router-id 192.9.200.179    !设置router-id
r1_ospfd(config-router)# network 192.9.200.0/24 area 0.
r1_ospfd(config-router)# network 192.168.2.0/24 area 2
!最关键的,来标识路由器上哪些IP网络号是OSPF的一部分,对于每个网络,我们必须标识该网络所属 的区域。
对于我们的小网络,ospf就算配好了,下面来检验一下:
r1_ospfd(config-router)# ctrl+z
r1_ospfd# sh ip ospf route
192.9.200.179
============ OSPF network routing table ============
N    192.9.200.0/24        [10] area: 0.0.0.0
                           directly attached to eth0
N    192.168.2.0/24        [10] area: 0.0.0.2
                           directly attached to eth1
============ OSPF router routing table =============
============ OSPF external routing table ===========
r1_ospfd# sh ip ospf interface
eth0 is up
  Internet Address 192.9.200.179/24, Area 0.0.0.0
  Router ID 192.9.200.179, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State Backup, Priority 1
  Designated Router (ID) 192.9.200.231, Interface Address 192.9.200.231
  Backup Designated Router (ID) 192.9.200.179, Interface Address 192.9.200.179
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:07
  Neighbor Count is 0, Adjacent neighbor count is 0
eth1 is up
  Internet Address 192.168.2.179/24, Area 0.0.0.2
  Router ID 192.9.200.179, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State DR, Priority 1
  Designated Router (ID) 192.9.200.179, Interface Address 192.168.2.179
  No backup designated router on this network
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:09
  Neighbor Count is 0, Adjacent neighbor count is 0
由于网络里没有其它的路由器,r1就把自己选为DR(指定路由器)了。Quagga对log处理可能有些问题,使 用log stdout不能显示各种debug信息,所以只能记录到文件,在shell下用tail命令查看。而且debug命令和 实际路由器也有不同。
r1_ospfd# debug ospf event
r1_ospfd(config)# log file /usr/local/etc/ospfd.log
然后我们在shell下查看debug信息
shell_1> tail -f /usr/local/etc/ospfd.log
--------------------------------8<---------------------------------------<></---------------------------------------<>
2005/08/24 14:24:27 OSPF: make_hello: options: 2, int: eth0:192.9.200.179
2005/08/24 14:24:37 OSPF: make_hello: options: 2, int: eth0:192.9.200.179
2005/08/24 14:24:47 OSPF: make_hello: options: 2, int: eth0:192.9.200.179
2005/08/24 14:24:57 OSPF: make_hello: options: 2, int: eth0:192.9.200.179
2005/08/24 14:25:07 OSPF: make_hello: options: 2, int: eth0:192.9.200.179
--------------------------------8<---------------------------------------<></---------------------------------------<>
我们错过了最开始的信息,看到路由器每隔10秒发送一个hello数据包。hello数据包通过多目组播地址 224.0.0.5被发送出去,如果我们打开debug ospf packet all就能很清楚的看到。
第二台机器的设置
前面的初始化和第一台一样,不过这里名字设成r2便于辨认,IP设成了192.9.200.231 /24
192.168.1.232。
进入第二台机器的ospf设置
# service ospfd start
# telnet localhost 2604
Password:
ospfd> enable
ospfd# configure terminal
ospfd(config)# hostname r2_ospfd
r2_ospfd(config)# router ospf
r2_ospfd(config-router)# ospf router-id 192.9.200.231
r2_ospfd(config-router)# network 192.9.200.024 area 0
r2_ospfd(config-router)# network 192.168.1.0/24 area 1
执行完network命令,我们看到第一台机器的tail -f /usr/local/etc/ospfd.log输出下面的信息:
2005/08/07 19:30:58 OSPF: interface 192.9.200.179 join AllSPFRouters Multicast group.
2005/08/07 19:30:58 OSPF: ospf_apiserver_ism_change
2005/08/07 19:30:58 OSPF: oi->ifp->name=eth0
2005/08/07 19:30:58 OSPF: old_state=1
2005/08/07 19:30:58 OSPF: oi->state=3
2005/08/07 19:30:58 OSPF: interface 192.168.4.179 join AllSPFRouters Multicast group.
2005/08/07 19:30:58 OSPF: ospf_apiserver_ism_change
2005/08/07 19:30:58 OSPF: oi->ifp->name=eth1
2005/08/07 19:30:58 OSPF: old_state=1
2005/08/07 19:30:58 OSPF: oi->state=3
2005/08/07 19:30:58 OSPF: interface 192.168.2.179 join AllSPFRouters Multicast group.
2005/08/07 19:30:58 OSPF: ospf_apiserver_ism_change
2005/08/07 19:30:58 OSPF: oi->ifp->name=eth1
2005/08/07 19:30:58 OSPF: old_state=1
2005/08/07 19:30:58 OSPF: oi->state=3
2005/08/07 19:30:58 OSPF: interface 192.168.3.179 join AllSPFRouters Multicast group.
2005/08/07 19:30:58 OSPF: ospf_apiserver_ism_change
2005/08/07 19:30:58 OSPF: oi->ifp->name=eth3
2005/08/07 19:30:58 OSPF: old_state=1
2005/08/07 19:30:58 OSPF: oi->state=3
2005/08/07 19:30:58 OSPF: ospf_apiserver_nsm_change
2005/08/07 19:31:08 OSPF: ospf_apiserver_nsm_change
2005/08/07 19:31:08 OSPF: Packet[DD]: Negotiation done (Slave).
2005/08/07 19:31:08 OSPF: ospf_apiserver_nsm_change
2005/08/07 19:31:08 OSPF: ospf_apiserver_nsm_change
2005/08/07 19:31:08 OSPF: nsm_change_state(): scheduling new router-LSA origination
2005/08/07 19:31:08 OSPF: ospf_apiserver_nsm_change
2005/08/07 19:31:38 OSPF: DR-Election[1st]: Backup 192.9.200.179
2005/08/07 19:31:38 OSPF: DR-Election[1st]: DR     192.9.200.231
2005/08/07 19:31:38 OSPF: DR-Election[2nd]: Backup 192.9.200.179
2005/08/07 19:31:38 OSPF: DR-Election[2nd]: DR     192.9.200.231
2005/08/07 19:31:38 OSPF: interface 192.9.200.179 join AllDRouters
r1收到r2(192.9.200.231)发过来的hello数据包,交换信息后选举DR,由于本身192.9.200.179是DR了,所以 只选举了BDR就好了。这时在r1上就能看到r2了。
r2_ospfd# show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface           RXmtL RqstL DBsmL
192.9.200.231    1  Full/Backup         00:00:36    192.9.200.231   eth0:192.9.200.179     0     0     0
检验其它信息
r1_ospfd# sh ip ospf database
        OSPF Router with ID (192.9.200.179)
                Router Link States (Area 0.0.0.0)
Link ID         ADV Router      Age  Seq#       CkSum  Link count
192.9.200.179   192.9.200.179    256 0x80000003 0x37c2 1
192.9.200.231   192.9.200.231    267 0x80000004 0xcc8f 1
                Net Link States (Area 0.0.0.0)
Link ID         ADV Router      Age  Seq#       CkSum
192.9.200.231   192.9.200.231    267 0x80000001 0xd6cd
                Summary Link States (Area 0.0.0.0)
Link ID         ADV Router      Age  Seq#       CkSum  Route
192.168.1.0     192.9.200.231    374 0x80000001 0x1757 192.168.1.0/24
192.168.2.0     192.9.200.179    257 0x80000001 0x455c 192.168.2.0/24
                Router Link States (Area 0.0.0.2)
Link ID         ADV Router      Age  Seq#       CkSum  Link count
192.9.200.179   192.9.200.179    218 0x80000002 0x7ed0 1
                Summary Link States (Area 0.0.0.2)
Link ID         ADV Router      Age  Seq#       CkSum  Route
192.9.200.0     192.9.200.179    257 0x80000001 0x3644 192.9.200.0/24
192.168.1.0     192.9.200.179    257 0x80000001 0xb4e3 192.168.1.0/24
r1_ospf# show ip ospf int eth0
eth0 is up
  Internet Address 192.9.200.179/24, Area 0.0.0.0
  Router ID 192.9.200.179, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State DR, Priority 1
  Designated Router (ID) 192.9.200.179, Interface Address 192.9.200.179
  Backup Designated Router (ID) 192.9.200.231, Interface Address 192.9.200.231
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:05
  Neighbor Count is 1, Adjacent neighbor count is 1
和前面的输出信息相比,发生了很多变化,两台路由器已经相互识别了。OSPF不象RIP一样,每隔30秒 给所有的邻居广播一次完整的路由表,而是通过IP多目组播地址224.0.0.5每隔10秒发送一个很小的hello 数据包来维护邻居关系,当链路发生变化的时候,才重新计算
保存一下配置
r1_ospfd# copy run start
Configuration saved to /usr/local/etc/ospfd.conf
r2_ospfd# copy run start
Configuration saved to /usr/local/etc/ospfd.conf
以上只是演示了最简单的OSPF的配置,而OSPF在大型网络才广泛的使用,配置也复杂多很多。即使是 Quagga,也还可用做复杂的多的OSPF实验。
<!-----------------------------------------
<!-----------------------------------------
</!-----------------------------------------
</!-----------------------------------------
 
用Quagga设置BGP路由协议
RIP和OSPF都是内部网关协议(IGP),BGP属于外部网关协议(EGP)。BGP广泛用于Internet以连接 ISP,并将企业与ISP互连。
当BGP的影响被完全了解,并且至少下列情况之一存在时,在AS中使用BGP才是最恰当的:
  1 AS允许数据包穿过它到达其它自治系统(例如,某个服务提供商)。
  2 AS有到其它自治系统的多条连接。
  3 必须对进入和离开AS的数据流进行控制。
对于互连的自治系统来说,BGP并不总是恰当的解决方案,如果有如下情况中的一个或多个时,不要使 用BGP:
  1 只有到Internet或另一AS的单一连接。
  2 无需考虑路由策略或路由选择。
  3 路由器缺乏经常性的BGP更新的内存或处理器。
  4 对路由过滤和BGP路径选择过程的了解十分有限。
  5 在自治系统间的带宽较低。
在这些情况下,应该使用静态路由。
 

进入第一台机器的bgp设置
# service bgpd start
启动bgpd,我们看到TCP端口179已经打开。两台BGP路由器相互间建立一条TCP连接,交换消息以打开 和确认连接参数。这两台路由器被称为对等路由器,或者邻居。
# telnet localhost 2605
Password:
bgpd> enable
bgpd# conf t
bgpd(config)# hostname r1_bgpd
r1_bgpd(config)# router bgp 7675
配置里已经指定了AS为7675. AS是一个16bit的数字,其范围从1到 65535。RFC 1930给出了AS编号使用指南。从64512到65535的AS编号范围是留作私用的,类似私有IP。
r1_bgpd(config-router)# network 192.9.200.0/24
r1_bgpd(config-router)# neighbor 192.9.200.179 remote-as 767

【上篇】
【下篇】

抱歉!评论已关闭.