前言:
理论知识我在上一篇博客已经写过了,但光是掌握理论,而不去实践就如同纸上谈兵。只有理论与实践相结合,我们下能更深的理解与记忆。闲话少叙,接下来我会直接演示OSPF协议的具体配置过程。本次实验主要分为两个部分:一、基本配置;二、虚链路的配置。
一、OSPF协议基本配置:
1.实验环境
本次实验是在GNS3-1.3.10版本中进行的,具体拓扑图如下:
需要注意的是R1与R3的接口不够,需要分别添加一个NM-1FE-TX单板。
2.R1的配置
(1)给R1各个接口配上IP地址,并检查是否设置成功。
R1#conf t //进入全局模式
R1(config)#int f0/0 //进入f0/0接口
R1(config-if)#ip add 192.168.20.1 255.255.255.0 //设置IP地址与子网掩码
R1(config-if)#no shut //开启接口
R1(config-if)#int f0/1 //进入f0/1接口
R1(config-if)#ip add 192.168.50.2 255.255.255.0 //设置IP地址与子网掩码
R1(config-if)#no shut //开启接口
R1(config-if)#int f1/0 //进入f1/0接口
R1(config-if)#ip add 192.168.10.1 255.255.255.0 //设置IP地址与子网掩码
R1(config-if)#no shut //开启接口
R1(config-if)#exit //退出
R1(config)#do show ip int b //查看接口IP
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.20.1 YES manual up up
FastEthernet0/1 192.168.50.2 YES manual up up
FastEthernet1/0 192.168.10.1 YES manual up up
(2)设置回环网卡的IP,并查看是否设置成功。(我只演示一遍,下面我就直接添加router-id了)
R1(config)#int loopback 0 //进入loopback 0 接口
R1(config-if)#ip add 1.1.1.1 255.255.255.255 //设置IP地址与子网掩码
R1(config-if)#no shut //开启接口
R1(config-if)#exit //退出
R1(config)#do show ip int b //查看接口IP
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.20.1 YES manual up up
FastEthernet0/1 192.168.50.2 YES manual up up
FastEthernet1/0 192.168.10.1 YES manual up up
Loopback0 1.1.1.1 YES manual up up
(3)启用R1的OSPF协议,并进行相关配置。
R1(config)#router ospf 1 //启用OSPF协议,进程号1
R1(config-router)#router-id 1.1.1.1 //设置router-id
R1(config-router)#network 192.168.20.0 0.0.0.255 area 0 //宣告网段,每个网段要宣告在自己的Area内
R1(config-router)#network 192.168.50.0 0.0.0.255 area 0 //宣告网段,每个网段要宣告在自己的Area内
R1(config-router)#network 192.168.10.0 0.0.0.255 area 0 //宣告网段,每个网段要宣告在自己的Area内
R1(config-router)#exit //退出
3.R2的配置
(1)给R2各个接口配上IP地址,并检查是否设置成功。
R2#conf t //进入全局模式
R2(config)#int f0/0 //进入f0/0接口
R2(config-if)#ip add 192.168.20.2 255.255.255.0 //设置IP地址与子网掩码
R2(config-if)#no shut //开启接口
R2(config-if)#int f0/1 //进入f0/1接口
R2(config-if)#ip add 192.168.30.1 255.255.255.0