OSPF 开放式最短路径优先

1.1         ping

配置OSPF使PC-91与PC-92互相ping通

PC端配置默认路由为交换机直连接口的IP

1.1.1         拓扑

1.1.2         配置

1)配置相应接口为三层口并按拓扑所示配置好IP

208号机:

xNet#configure terminal

xNet(config)#interface ge1

xNet(config-if)#ip address 192.168.4.208/24

xNet(config-if)#exit

xNet(config)#interface ge48

xNet(config-if)#ip address 20.1.1.2/24

xNet(config-router)#end

xNet#

同样方法配置好207号机接口IP

2)配置OSPF

208号机宣告路由:

xNet#configure terminal

xNet(config)#router ospf 1

xNet(config-router)#network 192.168.4.0/24 area 0

xNet(config-router)#network 20.1.1.0/24 area 0

xNet(config-router)#end

xNet#

207号机同样宣告路由:

xNet#configure terminal

xNet(config)#router ospf 1

xNet(config-router)#network 192.168.3.0/24 area 0

xNet(config-router)#network 20.1.1.0/24 area 0

xNet(config-router)#end

xNet#

1.1.3         结果

当不配置OSPF时,PC-91与PC-92互ping不通

当配置OSPF,宣告网段后,PC-91与PC-92能够互相ping通

查看OSPF相关信息:

1.2         认证

通过配置认证来对路由信息加密

1.2.1         拓扑

1.2.2         配置

1)在208上配置OSPF认证,207暂时不配OSPF认证,观察路由信息

xNet#configure terminal

xNet(config)#router ospf 1

xNet(config-router)#area 0 authentication message-digest /定义认证类型MD5

xNet(config-router)#exit

xNet(config)#interface ge1

xNet(config-if)#ip ospf message-digest-key 1 md5 test /设置key和密码

xNet(config-if)#end

xNet#

xNet#configure terminal

xNet(config)#interface ge48

xNet(config-if)#ip ospf authentication

xNet(config-if)#ip ospf authentication-key test

xNet(config-if)#end

xNet#

查看路由信息,没有207的路由信息

2)同样在207配置OSPF认证,再查看路由信息

xNet#configure terminal

xNet(config)#interface ge48

xNet(config-if)#ip ospf authentication

xNet(config-if)#ip ospf authentication-key test

xNet(config-if)#end

xNet#

这时经过认证以后才相互交换路由信息,可以查看到OSPF路由

1.2.3         结果

当配置OSPF认证后,只有经过认证以后才相互交换路由信息。

1.3         OSPFv3基本功能

配置OSPFv3使PC-91与PC-92互相ping通

PC端配置默认路由为交换机直连接口的IP

1.3.1         拓扑

1.3.2         配置

在PC端用ifconfig配置好相应ipv6 address

如:

$ ifconfig eth0 inet6 add 2003::92/64

PC端添加默认网关:

$ route -A inet6 add ::/0 gw 2003::208

1)配置路由器ID

xNet#con t

xNet(config)#router ipv6 ospf 1

xNet(config-router)#router-id 208.208.208.208

xNet(config-router)#end

xNet#

2)在接口上启用OSPFv3

208为例:

xNet#con t

xNet(config)#interface ge1

xNet(config-if)#ipv6 router ospf tag 1 area 0

xNet(config-if)#exit

xNet(config)#interface ge48

xNet(config-if)#ipv6 router ospf tag 1 area 0

xNet(config-if)#end

xNet#

1.3.3         结果

1)当两台交换机都配置完后,查看OSPFv3路由表

208:

207:

2)使PC-91和PC-92互ping,能够ping通

原文地址:https://www.cnblogs.com/niezhongle/p/11075269.html