您的位置:首页 > 其它

OSPF LSA的详解

2013-09-03 18:38 435 查看
LSA类型的配置与查看

1基本配置
R1(config)#NO IP DO LO
R1(config)#NO ENAble PAssword
R1(config)#LINe COnsole 0
R1(config-line)#LOGGing SYnchronous
R1(config-line)#EXEC-Timeout 0 0
R1(config-line)#LOGIn

R2(config)#NO IP DO LO
R2(config)#NO ENAble PAssword
R2(config)#LINe COnsole 0
R2(config-line)#LOGGing syn
R2(config-line)#exec-timeout 0 0
R2(config-line)#login

R3(config)#NO IP DO LO
R3(config)#line con 0
R3(config-line)#logging syn
R3(config-line)#exec-time 0 0
R3(config-line)#login

SW(config)#no ip do lo

R1#wr //保存
R2#wr
R3#wr

一、——类型1
配置连线
R1(config)#inter s1/0
R1(config-if)#ip address 192.1.12.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#inter lo 1
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#ip ospf network point-to-point

R1(config-if)#inter s1/1
R1(config-if)#ip add 192.1.13.1 255.255.255.0
R1(config-if)#n shu

R2(config)#inter s1/0
R2(config-if)#ip add 192.1.12.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#inter lo 1
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#ip ospf network point-to-point

R3(config)#inter s1/1
R3(config-if)#ip add 192.1.13.3 255.255.255.0
R3(config-if)#no shut
R3(config-if)#inter lo 1
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config-if)#ip ospf network point-to-point

3、可以查看下接口
R1#show ip inter brief
R2#show run inter s1/0(排错使用)

4、启用OSPF协议
R1(config)#router ospf 100
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 192.1.12.0 0.0.0.255 a 0
R1(config-router)#network 192.1.13.0 0.0.0.255 a 0
R1(config-router)#network 1.1.1.0 0.0.0.255 a 0

R2(config)#router ospf 100
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 192.1.12.0 0.0.0.255 a 0
R2(config-router)#network 2.2.2.0 0.0.0.255 a 0

R3(config)#router ospf 100
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 192.1.13.0 0.0.0.255 a 0
R3(config-router)#network 3.3.3.0 0.0.0.255 a 0

5、查看邻居
R3#show ip ospf neighbor (会显示1.1.1.1的邻居)

6、测试连通
R1#ping 2.2.2.2
R1#ping 3.3.3.3

7查看路由连接类型
R1#show ip ospf database ?
adv-router Advertising Router link states
asbr-summary ASBR summary link states
database-summary Summary of database
external External link states
network Network link states
nssa-external NSSA External link states
opaque-area Opaque Area link states
opaque-as Opaque AS link states
opaque-link Opaque Link-Local link states
router Router link states
self-originate Self-originated link states
summary Network summary link states
| Output modifiers

R1#show ip ospf database router

查看路由
R1#SHOW IP ROUte

R2#show ip ospf database(他们之间的数据是一样的)

二、——查看NETWORKLSA

配置交换机连线
R1(config)#INTER FA0/0
R1(config-if)#IP ADD 192.168.1.1 255.255.255.0
R1(config-if)#NO SHUT

R2(config)#inter fa0/0
R2(config-if)#ip add 192.168.1.2 255.255.255.0
R2(config-if)#no shut

R3(config)#inter fa0/0
R3(config-if)#ip add 192.168.1.3 255.255.255.0
R3(config-if)#no shut

其中会提示不匹配,这时可以配置为100兆
R3(config-if)#speed 100
R3(config-if)#duplex full (改为全双工)

R1(config-if)#speed 100
R1(config-if)#duplex full

R2(config-if)#speed 100
R2(config-if)#duplex full

查看广播地址
R1#show ip inter brief
测试连通
R1#ping 192.168.1.2
R1#ping 192.168.1.3

宣告在一个网络中(宣告的同时会进行BDR选择)
R3(config-if)#router ospf 100
R3(config-router)#network 192.168.1.0 0.0.0.255 a 0

R1(config)#router ospf 100
R1(config-router)#network 192.168.1.0 0.0.0.255 a 0

R2(config-if)#router ospf 100
R2(config-router)#network 192.168.1.0 0.0.0.255 a 0

查看他们之间的状态
R1# show ip ospf neighbor

R1#show ip ospf interface fa0/0

查看类型
R1#show ip ospf database network

三、——查看类型三

配置
R2(config)#inter lo 1
R2(config-if)#inter lo 11
R2(config-if)#ip add 20.20.20.1 255.255.255.0
R2(config-if)#ip ospf network point-to-p(类型为点到点)
宣告到区域1中
R2(config-router)#network 20.20.20.0 0.0.0.255 a 1

R3(config-router)#inter lo 11
R3(config-if)#ip add 30.30.30.1 255.255.255.0
R3(config-if)#ip ospf network point-to-p
R3(config-if)#router ospf 100
R3(config-router)#network 30.30.30.0 0.0.0.255 a 2

配置好后就形成了多区域
查看数据库
R1#show ip ospf database(此时有三个类型)
单独查看——比如查看类型三
R1#show ip ospf database summary
此时路由表中就有OIA(区域1和2的)
R1#show ip route

测试PING一下
R1#ping 20.20.20.1
R1#ping 30.30.30.1

四、——查看类型4(要产生类型4首先需要其他的类型协议涉及进来)
R1(config)#inter lo 2
R1(config-if)#ip add 10.10.10.1 255.255.255.0
R1(config-if)#ip ospf network point-to-p

使用一条重分发命令,重分发直连的路由
R1(config-router)#redistribute connected subnets

查看数据库(此时已经存在类型5)
R1#show ip ospf database
R1#show ip ospf database external(查看类型5详细信息)

查看ASBR及类型4
只有在区域1或2中查看
R2#show ip ospf database
R2#show ip ospf database asbr-summary(查看详细)

查看路由表
R2#show ip route(此时可以看到会有OE2这条外部陆游)

R2#ping 10.10.10.1

查看R3的路由表(同样存在OE2)
R3#show ip rou
R3#ping 10.10.10.1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: