加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

利用quagga进行OSPF实验

(2013-07-21 10:00:27)
标签:

quagga

ubuntu

ospfd

it

分类: linux网络实验
之前有开启zebra与ripd的进程进行实验,所以先把他们关掉
root@ubuntu:/etc/quagga# ps -ef | grep quagga
root      1390  9394  0 10:01 pts/1    00:00:00 grep --color=auto quagga
quagga    3869     0 Jul20 ?        00:00:00 /usr/lib/quagga/zebra --daemon -A 127.0.0.1
quagga    3873     0 Jul20 ?        00:00:00 /usr/lib/quagga/ripd --daemon -A 127.0.0.1
root@ubuntu:/etc/quagga# kill -9 "3869"
root@ubuntu:/etc/quagga# kill -9 "3873"

检查有没有ospfd进程的配置文件
root@ubuntu:/etc/quagga# cd /etc/quagga/
root@ubuntu:/etc/quagga# ls
bgpd.conf  debian.conf  ripd.conf   zebra.conf
daemons    ospfd.conf   vtysh.conf  zebra.conf.sav


修改配置
root@ubuntu:/etc/quagga# gedit daemons
zebra=yes
bgpd=no
ospfd=yes
ospf6d=no
ripd=no
ripngd=no
isisd=no

启动进程
root@ubuntu:/etc/quagga# /etc/init.d/quagga start
Loading capability module if not yet done.
Starting Quagga daemons (prio:10): zebra ospfd.

配置zebra
root@ubuntu:/etc/quagga# telnet localhost 2601
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Hello, this is Quagga (version 0.99.20.1).
Copyright 1996-2005 Kunihiro Ishiguro, et al.


User Access Verification

Password:
R1> en
Password:
R1# show running-config

Current configuration:
!
hostname R1
password zebra
enable password zebra
!
interface eth0
 ip address 218.192.168.170/24
 ipv6 nd suppress-ra
!
interface eth0:0
 ip address 192.168.3.1/24
 ipv6 nd suppress-ra
!
interface lo
!
ip forwarding
!
!
line vty
!
 --More--

注意,之前做ospf的实验,然后发现这个eth0:0的虚拟网卡总是不发送数据,原来是在zebra里面没有启动
R1# show interface description
Interface       Status  Protocol  Description
eth0            up      unknown  
eth0:0          down    down     
lo              up      unknown  
R1# config t
R1(config)# int eth0:0
R1(config-if)# ip address 192.168.3.1/24
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# exit

若实验中出现
R2# config t                  
R2(config)# int eth0:0
R2(config-if)# ip address 192.168.2.1/24
R2(config-if)# no shutdown
Can't up interface

则重新配置eth0:0端口
root@Deng-desktop:/etc/quagga# ifconfig eth0:0 192.168.2.1/24
root@Deng-desktop:/etc/quagga# ifconfig eth0:0
eth0:0    Link encap:以太网  硬件地址 48:5b:39:b8:f9:56 
          inet 地址:192.168.2.1  广播:192.168.2.255  掩码:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  跃点数:1
          中断:27 基本地址:0xe000
 
R2# show interface description
Interface       Status  Protocol  Description
eth0            up      unknown  
eth0:0          down    down     
lo              up      unknown  
R2# config t
R2(config)# int eth0:0
R2(config-if)# no shutdown
R2(config-if)# exit
R2(config)# exit
R2# show interface description
Interface       Status  Protocol  Description
eth0            up      unknown  
eth0:0          up      unknown  
lo              up      unknown  
R2#






R1# exit
Connection closed by foreign host.


配置ospf进程
root@ubuntu:/etc/quagga# telnet localhost 2604

Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Hello, this is Quagga (version 0.99.20.1).
Copyright 1996-2005 Kunihiro Ishiguro, et al.


User Access Verification

Password:
ospfd> en
ospfd# config t
ospfd(config)# hostname ospfd_1
ospfd_1(config)# router ospf
ospfd_1(config-router)# network 218.192.168.0/24 area 0
ospfd_1(config-router)# network 192.138.3.0/24 area 0
注:有的版本这里将
ospfd_1(config-router)# network 192.138.3.0/24 area 1,不知道这样配置行不行
注:有时候用wireshark抓包只有hellopacket,那么问题可能出现在这里
用:
ospfd_2(config)# router ospf
ospfd_2(config-router)# no network 218.192.168.0/24 area 0
ospfd_2(config-router)# network 218.192.168.0/24 area 0  
ospfd_2(config-router)# no network 192.168.2.0/24 area 0 
Can't find specified network area configuration.
ospfd_2(config-router)# network 192.168.2.0/24 area 0  
ospfd_2(config-router)# exit
在重新配置一下就可以了

ospfd_1(config-router)# exit
ospfd_1(config)# exit
ospfd_1# show ip ospf
 OSPF Routing Process, Router ID: 218.192.168.170
 Supports only single TOS (TOS0) routes
 This implementation conforms to RFC2328
 RFC1583Compatibility flag is disabled
 OpaqueCapability flag is disabled
 Initial SPF scheduling delay 200 millisec(s)
 Minimum hold time between consecutive SPFs 1000 millisec(s)
 Maximum hold time between consecutive SPFs 10000 millisec(s)
 Hold time multiplier is currently 1
 SPF algorithm last executed 36.498s ago
 SPF timer is inactive
 Refresh timer 10 secs
 Number of external LSA 0. Checksum Sum 0x00000000
 Number of opaque AS LSA 0. Checksum Sum 0x00000000
 Number of areas attached to this router: 1

 Area ID: 0.0.0.0 (Backbone)
   Number of interfaces in this area: Total: 1, Active: 1
   Number of fully adjacent neighbors in this area: 0
   Area has no authentication
   SPF algorithm executed 1 times
   Number of LSA 1
   Number of router LSA 1. Checksum Sum 0x00000b1c
   Number of network LSA 0. Checksum Sum 0x00000000
   Number of summary LSA 0. Checksum Sum 0x00000000
   Number of ASBR summary LSA 0. Checksum Sum 0x00000000
   Number of NSSA LSA 0. Checksum Sum 0x00000000
   Number of opaque link LSA 0. Checksum Sum 0x00000000
   Number of opaque area LSA 0. Checksum Sum 0x00000000

ospfd_1# show running-config

Current configuration:
!
hostname ospfd_1
password zebra
log stdout
!
!
!
interface eth0
!
interface lo
!
router ospf
 network 192.138.3.0/24 area 0.0.0.0
 network 218.192.168.0/24 area 0.0.0.0
!
line vty
!
end
ospfd_1# copy run
% Command incomplete.
ospfd_1# copy running-config startup-config
Configuration saved to /etc/quagga/ospfd.conf
ospfd_1#

配置另一主机的时候
ospfd(config)# hostname ospfd_2
ospfd_2(config)# router ospf
ospfd_2(config-router)# network 218.192.168.0/24 area 0
ospfd_2(config-router)# network 192.138.2.0/24 area 0
ospfd_2(config-router)# exit
ospfd_2(config)# exit


出现问题,感觉eth0:0的端口完全没有发送数据包
root@ubuntu:/etc/quagga# telnet localhost 2601
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Hello, this is Quagga (version 0.99.20.1).
Copyright 1996-2005 Kunihiro Ishiguro, et al.


User Access Verification

Password:
R1> en
Password:
R1# show interface description
Interface       Status  Protocol  Description
eth0            up      unknown  
eth0:0          down    down     
lo              up      unknown  
R1# config t
R1(config)# int eth0:0
R1(config-if)# ip address 192.168.3.1/24
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# exit

之后可以查看路由表:

r1_ospfd# sh ip ospf route

ospfd_1# sh ip ospf route
============ OSPF network routing table ============
   192.168.2.0/24        [20] area: 0.0.0.0
                           via 218.192.168.201, eth0
   192.168.3.0/24        [10] area: 0.0.0.0
                           directly attached to eth0
   218.192.168.0/24      [10] area: 0.0.0.0
                           directly attached to eth0

============ OSPF router routing table =============

============ OSPF external routing table ===========

查看接口

r1_ospfd# sh ip ospf interface

eth0 is up
  ifindex 2, MTU 1500 bytes, BW 0 Kbit <UP,BROADCAST,RUNNING,MULTICAST>
  Internet Address 192.168.3.1/24, Broadcast 192.168.3.255, Area 0.0.0.0
  MTU mismatch detection:enabled
  Router ID 218.192.168.170, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State DR, Priority 1
  Designated Router (ID) 218.192.168.170, Interface Address 192.168.3.1
  No backup designated router on this network
  Multicast group memberships: OSPFAllRouters OSPFDesignatedRouters
  Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
    Hello due in 6.169s
  Neighbor Count is 0, Adjacent neighbor count is 0
  Internet Address 218.192.168.170/24, Broadcast 218.192.168.255, Area 0.0.0.0
  MTU mismatch detection:enabled
  Router ID 218.192.168.170, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State DR, Priority 1
  Designated Router (ID) 218.192.168.170, Interface Address 218.192.168.170
  Backup Designated Router (ID) 218.192.168.201, Interface Address 218.192.168.201
  Saved Network-LSA sequence number 0x80000003
  Multicast group memberships: OSPFAllRouters OSPFDesignatedRouters
  Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
    Hello due in 5.409s
  Neighbor Count is 1, Adjacent neighbor count is 1
lo is up
  ifindex 1, MTU 16436 bytes, BW 0 Kbit <UP,LOOPBACK,RUNNING>
  OSPF not enabled on this interface

用wireshar抓包
http://s16/mw690/68b156d5zx6Be4nPEw7bf&690



http://s8/mw690/68b156d5zx6Be4H9C0Tb7&690


http://blog.chinaunix.net/uid-20775448-id-3498524.html
部分参考以上网址

0

阅读 收藏 喜欢 打印举报/Report
后一篇:ospf
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有