注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 可扩展、高可用、负载均衡..
 帮助

OSPF基本配置


2008-04-21 12:07:55
 标签:OSPF 路由   [推送到技术圈]

很郁闷,图片传不上来。。。。。。。。
 
一,基本配置
R1的配置
R1(config)#interface s 0
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
 
R1(config)#int s 1
R1(config-if)#ip address 192.168.5.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#clock rate 64000
 
R1(config)#interface ethernet 0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
 
R1(config)#router ospf 100
R1(config-router)#network 192.168.2.0  0.0.0.255 area 0
R1(config-router)#network 192.168.5.0  0.0.0.255 area 2
R1(config-router)#network 192.168.1.0  0.0.0.255 area 1
 
R5的配置
R5(config)#interface s 0
R5(config-if)#ip address 192.168.5.2 255.255.255.0
R5(config-if)#no shutdown
 
R5(config)#interface loopback 1
R5(config-if)#ip address 10.0.1.1 255.255.255.0
R5(config)#interface loopback 2
R5(config-if)#ip address 10.0.2.2 255.255.255.0
R5(config)#interface loopback 3
R5(config-if)#ip address 10.0.3.3 255.255.255.0
 
R5(config)#router ospf 100
R5(config-router)#network 192.168.5.0 0.0.0.255 area 2
R5(config-router)#network 10.0.1.0 0.0.0.255 area 2
R5(config-router)#network 10.0.2.0 0.0.0.255 area 2
R5(config-router)#network 10.0.3.0 0.0.0.255 area 2
 
R4的配置
R4(config)#interface s 1
R4(config-if)#ip address 192.168.3.1 255.255.255.0
R4(config-if)#no shutdown
 
R4(config)#interface s 0
R4(config-if)#ip address 192.168.2.2 255.255.255.0
R4(config-if)#no shutdown
 
R4(config)#router ospf 100
R4(config-router)#network 192.168.2.0 0.0.0.255 area 0
R4(config-router)#network 192.168.3.0 0.0.0.255 area 3
 
 
R6的配置
R6(config)#interface  serial 1
R6(config-if)#ip address 192.168.7.1 255.255.255.0
R6(config-if)#no shutdown
R6(config-if)#clock rate 64000        //因为S1口为DCE,所以要配置时钟频率。DTE还是DCE是根据接线的情况。
 
R6(config)#interface serial 0
R6(config-if)#ip address 192.168.3.2 255.255.255.0
R6(config-if)#clock rate 64000
R6(config-if)#no shutdown
 
R6(config)#router ospf 100         
//启用ospf路由协议,进程号为100(进程号可以为0-4294967295的任意一个,本地有效。)
R6(config-router)#network 192.168.3.0 0.0.0.255 area 3  //宣告直连网段,区域号要通告正确。
R6(config-router)#redistribute rip subnets        //rip重发布到ospf中。如果ripv2,使用subnet则可以得到子网路由。
 
R6(config)#router rip                     //将接口S1直连的网络发布到RIP
R6(config-router)#network 192.168.7.0
R6(config-router) redistribute ospf 100 metric 2  //ospf发布到rip中,注意,重发布要在运行两种路由协议的路由器上运行。
 
R7的配置:
R7(config)#interface serial 0
R7(config-if)#ip address 192.168.7.2 255.255.255.0
R7(config-if)#no shutdown
 
R7(config)#interface loopback 1
R7(config-if)#ip add 20.0.1.1 255.255.255.0
R7(config)#interface loopback 2
R7(config-if)#ip address 20.0.2.2 255.255.255.0
R7(config)#interface loopback 3
R7(config-if)#ip address 20.0.3.3 255.255.255.0
 
R7(config)#router rip
R7(config-router)#network 192.168.7.0
R7(config-router)#network 20.0.1.0
R7(config-router)#network 20.0.2.0
R7(config-router)#network 20.0.3.0              
//因为启用的是RIPv1,虽然宣告的是子网,但是查看配置文件时,系统已经自动讲其转换为network 20.0.0.0
 
R2的配置:
R2(config)#interface e 0
R2(config-if)#ip address 192.168.1.2 255.255.255.0
R2(config-if)#no shutdown
 
R2(config)#router ospf 100
R2(config-router)#network 192.168.1.0 0.0.0.255 area 1
 
R3的配置
R3(config)#interface e 0
R3(config-if)#ip address 192.168.1.3 255.255.255.0
R3(config-if)#no shutdown
 
R3(config)#router ospf 100
01:55:52: %OSPF-4-NORTRID: OSPF process 100 cannot start. There must be at least
 one "up" IP interface, for OSPF to use as router ID
因为在配置e0是没有使用no shutdown,所以R3没有一个接口是up.启用ospf时,必须有一个接口是up的才能启用,因为选举DR要用到RID,而RID是根据接口ip地址确定的,一般做法是在启用ospf的路由器上配置loopback口,使其ip地址成为RID
R3(config)#router ospf 100
R3(config-router)#network 192.168.1.0 0.0.0.255 area 1
 
 


上一篇 OSPF通信  下一篇 邻居连接疑难问题



    文章评论
 
2008-04-21 12:59:47
是啊 得有拓扑图才能理解啊

 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: