1. 程式人生 > >linux下使用quagga配置ospf協議

linux下使用quagga配置ospf協議

環境:三臺(VM虛擬機器)

一、ospf協議

  OSPF(Open Shortest Path First開放式最短路徑優先)是一個內部閘道器協議(Interior Gateway Protocol,簡稱IGP),用於在單一自治系統(autonomous system,AS)內決策路由。是對鏈路狀態路由協議的一種實現,隸屬內部閘道器協議(IGP),故運作於自治系統內部。

PS:這裡不過多講解ospf協議,可在網上自行查詢學習

二、配置

首先下載安裝軟體包,其他yum源以及網路配置就不再介紹了,三臺配置也是一樣的

下載地址:/components/cache/quagga/

本人這裡使用的版本是

quagga-

相關依賴包:gcc readline readline-devel

#tar zxf quagga-
#yum install -y gcc readline readline-devel
#cd quagga-            #進入目錄進行原始碼編譯安裝
#./configure --enable-vtysh--enable-user=root --enable-group=root --enable-vty-group=root
# make && make install

修改配置檔案:

/etc/services檔案裡面新增以下內容:

# vim /etc/services
zebrasrv    2600/tcp     # zebra service
zebra     2601/tcp     # zebra vty
ripd     2602/tcp     # RIPd vty
ripngd     2603/tcp     # RIPngd vty
ospfd     2604/tcp     # OSPFd vty
bgpd     2605/tcp     # BGPd vty
ospf6d     2606/tcp     # OSPF6d vty
ospfapi     2607/tcp     # ospfapi
isid     2608/tcp     # ISISd vty

修改quagga的配置檔案:

# mkdir /usr/local/etc/sample
# mv /usr/local/etc/*.sample/usr/local/etc/sample/
# mv /usr/local/etc//usr/local/etc/sample/

# cp /usr/local/etc/sample//usr/local/etc/
# cp/usr/local/etc/sample/ /usr/local/etc/
# cp/usr/local/etc/sample/ /usr/local/etc/
# cp /usr/local/etc/sample//usr/local/etc/
# cp /usr/local/etc/sample//usr/local/etc/
# cp/usr/local/etc/sample/ /usr/local/etc/
# cp/usr/local/etc/sample/ /usr/local/etc/

修改ospfd的配置檔案:

# vim /usr/local/etc/
! -*- ospf -*-
!
! OSPFd sample configuration file
!
!
hostname ospfd
password zebra
enable password please-set-at-here
 
router ospf
 network /24 area 0                  #將網段宣告進ospf中
log stdout

三、啟動驗證

接下來啟動即可:

# /usr/local/sbin/ospfd -d
# /usr/local/sbin/zebra -d
# vtysh
Hello, this is Quagga (version ).
Copyright 1996-2005 Kunihiro Ishiguro, etal.
# show running-config 
Building configuration...
Current configuration:
hostname Router
hostname ospfd
log stdout
password zebra
enable password zebra
enable password please-set-at-here
interface eth0
 ipv6nd suppress-ra
 interface lo
router ospf
 network /24 area 
line vty
end
# show ip ospf  database 
 
      OSPF Router with ID ()
                Router Link States ()
Link ID         ADV Router      Age Seq#       CkSum  Link count
         3 0x80000003 0x0735 1
         9 0x80000005 0xf832 1
        10 0x80000005 0xf631 1
               Net Link States ()
Link ID         ADV Router      Age Seq#       CkSum
        10 0x80000003 0xe5cf

vtysh是quagga進入模擬路由的,進去可以像正常路由器上面命令一樣去檢視資訊。


我這裡是啟動了三臺ospfd程序,配置都是一樣的,重複上面步驟即可,趕緊get起來吧!!!