OSPF实验1

本文详细介绍了在一个小型网络中配置OSPF路由的过程。通过具体的路由器命令行配置示例,展示了如何为不同的路由器设置IP地址、激活接口并启动OSPF进程。此外,还演示了如何指定每个路由器的router-id及宣告相应的网络区域。

拓扑图如下

路由器0配置

Router>en

Router#conf t

Router(config)#hostname Rounter1

Rounter1(config)#int f0/0

Rounter1(config-if)#ip addr 192.168.1.2 255.255.255.0

Rounter1(config-if)#no shu

Rounter1(config-if)#exit

Rounter1(config)#int f0/1

Rounter1(config-if)#ip addr 192.168.10.1 255.255.255.0

Rounter1(config-if)#no shu

Rounter1(config-if)#exit

Rounter1(config)#router ospf 1

Rounter4(config-router)#router-id 1.1.1.1

Rounter4(config-router)#network 192.168.0.228 0.0.0.3  area 0

Rounter4(config-router)#network 192.168.0.232 0.0.0.3  area 0

Rounter4(config-router)#network 192.168.1.16 0.0.0.3    area 0

路由器1配置

 

Rounter>en

Rounter#conf t

Rounter(config)#hostname Router2

Rounter2(config)#int f0/0

Rounter2(config-if)#ip addr 192.168.2.2 255.255.255.0

Rounter2(config-if)#no shu

Rounter2(config-if)#exit

Rounter2(config)#int f0/1

Rounter2(config-if)#ip addr 192.168.20.1 255.255.255.0

Rounter2(config-if)#no shu

Rounter2(config-if)#exit

Router2(config)#router ospf 10

Router2(config-router)#network 192.168.0.228 0.0.0.3 area 0

Router2(config-router)#network 192.168.0.236 0.0.0.3 area 0

Router2(config-router)#network 192.168.1.24 0.0.0.3 area 0

 

路由器2的配置

 

Rounter>en

Rounter#conf t

Rounter(config)#hostname Rounter3

Rounter3(config)#int f0/0

Rounter3(config-if)#ip addr 192.168.3.2 255.255.255.0

Rounter3(config-if)#no shu

Rounter3(config-if)#int f0/1

Rounter3(config-if)#ip addr 192.168.30.1 255.255.255.0

Rounter3(config-if)#no shu

Rounter2(config-if)#exit

Router3(config)#router ospf 10

Router3(config-router)#router-id 3.3.3.3

Router3(config-router)#network 192.168.0.232 0.0.0.3 area 0

Router3(config-router)#network 192.168.0.236 0.0.0.3 area 0

Router3(config-router)#network 192.168.1.20 0.0.0.3 area 0

 

路由器3的配置

 

Rounter>en

Rounter#conf t

Rounter(config)#hostname Rounter4

Rounter4(config)#int f0/1

Rounter4(config-if)#ip addr 192.168.10.2 255.255.255.0

Rounter4(config-if)#no shu

Rounter4(config-if)#exit

Rounter4(config)#int s0/3/0

Rounter4(config-if)#ip addr 10.1.1.1 255.255.255.0

Rounter4(config-if)#no shu

Rounter4(config-if)#exit

Rounter4(config)#int s0/3/1

Rounter4(config-if)#ip addr 30.1.1.1 255.255.255.0

Rounter4(config-if)#no shu

Rounter4(config-if)#exit

Rounter4(config)#router ospf 1

Rounter4(config-router)#router-id 4.4.4.4

Rounter4(config-router)#network 192.168.1.16 0.0.0.3 area 0

Rounter4(config-router)#network 172.16.1.0 0.0.0.255 area 0

 

路由器4的配置

 

Rounter>en

Rounter#conf t

Rounter(config)#hostname Rounter5

Rounter5(config)#int f0/1

Rounter5(config-if)#ip addr 192.168.20.2 255.255.255.0

Rounter5(config-if)#no shu

Rounter5(config-if)#exit

Rounter5(config)#int s0/3/0

Rounter5(config-if)#ip addr 10.1.1.2 255.255.255.0

Rounter5(config-if)#no shu

Rounter5(config-if)#exit

Rounter5(config)#int s0/3/1

Rounter5(config-if)#ip addr 20.1.1.1 255.255.255.0

Rounter5(config-if)#no shu

Rounter5(config-if)#exit

Rounter5(config)#router ospf 1

Rounter5(config-router)#router-id 5.5.5.5

Rounter5(config-router)#network 192.168.1.20 0.0.0.3 area 0

Rounter5(config-router)#network 172.16.2.0 0.0.0.255 area 0

 

路由器5的配置

 

Rounter>en

Rounter#conf t

Rounter(config)#hostname Rounter6

Rounter6(config)#int f0/1

Rounter6(config-if)#ip addr 192.168.30.2 255.255.255.0

Rounter6(config-if)#no shu

Rounter6(config-if)#exit

Rounter6(config)#int s0/3/0

Rounter6(config-if)#ip addr 30.1.1.1 255.255.255.0

Rounter6(config-if)#no shu

Rounter6(config-if)#exit

Rounter6(config)#int s0/3/1

Rounter6(config-if)#ip addr 20.1.1.2 255.255.255.0

Rounter6(config-if)#no shu

Rounter6(config-if)#exit

Rounter6(config)#router ospf 1

Rounter6(config-router)#router-id 6.6.6.6

Rounter6(config-router)#network 192.168.1.24 0.0.0.3 area 0

Rounnter6(config-router)#network 172.16.3.0 0.0.0.255 area 0

用ping命令检查网络是否互通

主机0ping主机1

主机0ping主机2

完成

 

转载于:https://www.cnblogs.com/ruanjie/p/9229628.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值