ospf协议配置
如图所示三台路由器R1、R2、R3,使用路由选择协议:pc1ip:192.168.1.2255.255.255.0
网关:192.168.1.1
pc3 ip:192.168.3.2255.255.255.0
网关:192.168.3.1
R1如下配置
interface Serial1/0
ip address 10.1.2.1 255.255.255.0
no ip directed-broadcast
ip ospf network point-to-point
!
interface Serial1/1
no ip address
no ip directed-broadcast
shutdown
!
interface Ethernet0/0
ip address 192.168.1.1 255.255.255.0
no ip directed-broadcast
ip ospf priority 0
ip ospf network point-to-point
!
interface Ethernet0/1
no ip address
no ip directed-broadcast
shutdown
!
router ospf 10
network 10.1.2.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
!
路由表如下:
C 192.168.1.0 is directly connected, Ethernet0/0
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.2.0 is directly connected, Serial1/0
O 10.2.3.0 via 10.2.3.1, 00:22:12, Serial1/0
R2、R3配置大体如R1 路由表分别为:
R2路由表
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.2.0 is directly connected, Serial1/0
C 10.2.3.0 is directly connected, Serial1/1
O 192.168.1.0 via 192.168.1.1, 00:19:28, Serial1/0
O 192.168.3.0 via 192.168.3.1, 00:12:13, Serial1/1
R3路由表
C 192.168.3.0 is directly connected, Ethernet0/0
10.0.0.0/24 is subnetted, 2 subnets
C 10.2.3.0 is directly connected, Serial1/1
O 10.1.2.0 via 10.2.3.1, 00:18:26, Serial1/1
在路由器R2上能ping通所有接口ip包括pc
但是在pc1和R1上则不能ping通pc3请问这是怎么回事?
最终R1的路由表应该是:
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.2.0 is directly connected, FastEthernet0/1
O 10.1.3.0 via 10.1.2.2, 00:09:10, FastEthernet0/1
C 192.168.1.0/24 is directly connected, FastEthernet0/0
O 192.168.3.0/24 via 10.1.2.2, 00:05:45, FastEthernet0/1
所以肯定是你的配置有错误。 回复 2 # 15980890429 的帖子
能发下你路由器的配置么?
我想参照下
我刚学习ospf有些东西还不太熟悉
谢谢啦 呵呵
0.0!!!!!!!!!!!!!!!!!!!!11
看到LZ的R1路由表中没有去往192.168.3.0网段的路由,同时R3也没有去往192.168.1.0网段的路由,所以不能通。
检查一下配置! R1没有R3直连网段192.168.3.0/24的路由,而R3也没有192.168.1.0/24的路由,既然没有路由,那肯定通不了啊。。。 LZ可以将主要配置贴出来一下,方便大家能够帮到你。 本帖最后由 wantccie 于 2011-5-23 21:31 编辑
ospf的基本配置如下(举个例子)
router ospf 110起进程
router-id 2.2.2.2设置router-id,用于选举DR,BDR
network 10.1.1.1 0.0.0.0 area 0将10.1.1.1这个接口通告进OSPF进程
network 192.168.1.1 0.0.0.0 area 0将192.168.1.1这个接口通告进OSPF进程
以上接口地址并掩码为0.0.0.0,是精确宣告。
一些命令
查看邻居show ip ospf neighbor
查看ospf路由show ip route ospf
debug ospf信息debug ip ospf events
配完底层,再配ospf,然后查看邻居表,如果邻居表里的邻居都正常,路由应该正常,当然如果作了路由过滤另当别论。
供参考。
PS:IGP中OSPF博大精深。。。非常复杂,涉及知识点较多,深刻研究还是蛮有意思的。。。BGP另说~~~
本帖最后由 SPOTO-STSC 于 2011-5-23 21:53 编辑
拓扑图:R1-----R2----R3
==================================
R1配置、路由
--------------------------------
R1#sh ip int b
Interface IP-Address OK? Method Status Protocol
Serial0/0 10.1.2.1 YES manual up up
Serial0/1 unassigned YES unsetadministratively down down
Serial0/2 unassigned YES unsetadministratively down down
Serial0/3 unassigned YES unsetadministratively down down
FastEthernet1/0 192.168.1.1 YES manual up up
Loopback0 1.1.1.1 YES manual up up
R1#
R1#
R1#
R1#sh run |se
R1#sh run |sec
R1#sh run | se
R1#sh run | section ospf
ip ospf network point-to-point
ip ospf priority 0
router ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 10.1.2.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
R1#sh ip ro
R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 2 subnets
O 10.1.3.0 via 10.1.2.2, 00:10:40, Serial0/0
C 10.1.2.0 is directly connected, Serial0/0
C 192.168.1.0/24 is directly connected, FastEthernet1/0
O 192.168.3.0/24 via 10.1.2.2, 00:10:40, Serial0/0
R1#
===========================================
R2 配置、路由
----------------------------------------------------------------------
R2#sh ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unsetadministratively down down
Serial1/0 10.1.2.2 YES manual up up
Serial1/1 10.1.3.1 YES manual up up
Serial1/2 unassigned YES unsetadministratively down down
Serial1/3 unassigned YES unsetadministratively down down
Loopback0 2.2.2.2 YES manual up up
R2#sh run | se
R2#sh run | section ospf
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 10.1.2.0 0.0.0.255 area 0
network 10.1.3.0 0.0.0.255 area 0
R2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.3.0 is directly connected, Serial1/1
C 10.1.2.0 is directly connected, Serial1/0
O 192.168.1.0/24 via 10.1.2.1, 00:04:23, Serial1/0
O 192.168.3.0/24 via 10.1.3.2, 00:04:23, Serial1/1
R2#
==========================================
R3配置、路由
--------------------------------------------------------------------------
R3#sh ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.3.1 YES manual up up
Serial1/0 unassigned YES unsetadministratively down down
Serial1/1 10.1.3.2 YES manual up up
Serial1/2 unassigned YES unsetadministratively down down
Serial1/3 unassigned YES unsetadministratively down down
Loopback2 3.3.3.3 YES manual up up
R3#sh run | se
R3#sh run | section router
router ospf 1
router-id 3.3.3.3
log-adjacency-changes
network 10.1.3.0 0.0.0.255 area 0
network 192.168.3.0 0.0.0.255 area 0
R3#
R3#sh ip ro
R3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback2
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.3.0 is directly connected, Serial1/1
O 10.1.2.0 via 10.1.3.1, 00:05:51, Serial1/1
O 192.168.1.0/24 via 10.1.3.1, 00:05:51, Serial1/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
R3#
======================================================
以上配置根据您的给的要求配置的,测试没有问题,请仔细检查您的配置和路由条目,或者你把配置张贴出来,
如果还有其他问题欢迎您提问题。
回复 9 # SPOTO-STSC 的帖子
log-adjacency-changes
请问这条命令是什么作用呀?
我的配置里没有这条命令
……