某公司网络OSPF单区域配置

1.配置背景:

xx公司网络由三台路由器和一台交换机组成,现在想要三台路由器之间通过OSPF实现互连互通。

2.网络结构如下:

3.具体配置:

3.1路由器 RA 配置:

1.更改主机名称:

复制代码
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname RA
RA(config)#

2.配置接口IP:

复制代码
RA(config)#interface g0/0
RA(config-if)#ip address 192.168.1.1 255.255.255.0
RA(config-if)#no shutdown 

RA(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up

RA(config-if)#
RA(config-if)#exit
RA(config)#interface loopback 0

RA(config-if)#
%LINK-5-CHANGED: Interface Loopback0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up

RA(config-if)#ip add
RA(config-if)#ip address 192.168.31.11 255.255.255.255
RA(config-if)#exit

3.启动OSPF进程并进行宣告:

复制代码
RA(config)#router ospf 1 # 启动OSPF进程,进程号为1,本地有效
RA(config-router)#router-id 192.168.31.11 # 配置路由器ID,一般使用环回接口地址
RA(config-router)#network 192.168.31.11 0.0.0.0 area 0 # 宣告环回接口网段
RA(config-router)#network 192.168.1.0 0.0.0.255 area 0 # 宣告直连网段,反掩码0.0.0.255,区域0

4.保存配置:

复制代码
RA(config)#do wr
Building configuration...
[OK]

3.2路由器 RB 配置:

1.更改主机名称:

复制代码
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname RB
RB(config)#

2.配置接口IP:

复制代码
RB(config)#interface g0/0
RB(config-if)#ip address 192.168.1.2 255.255.255.0
RB(config-if)#no shutdown 

RB(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
RB(config-if)#exit
RB(config)#interface lo
RB(config)#interface loopback 0

RB(config-if)#
%LINK-5-CHANGED: Interface Loopback0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up

RB(config-if)#ip address 192.168.31.22 255.255.255.255
RB(config-if)#exit

3.启动OSPF进程并进行宣告:

复制代码
RB(config)#router ospf 1
RB(config-router)#router-id 192.168.31.22
RB(config-router)#network 192.168.1.0 0.0.0.255 area 0
RB(config-router)#network 192.168.31.22 0.0.0.0 area 0
RB(config-router)#exit

4.保存配置:

复制代码
RB(config)#do wr
Building configuration...
[OK]

3.3路由器 RC 配置:

1.更改主机名称:

复制代码
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname RC
RC(config)#

2.配置接口IP:

复制代码
RC(config)#interface g0/0
RC(config-if)#ip address 192.168.1.3 255.255.255.0
RC(config-if)#no shutdown 

RC(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up

RC(config-if)#
RC(config-if)#exit
RC(config)#interface loopback 0

RC(config-if)#
%LINK-5-CHANGED: Interface Loopback0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up

RC(config-if)#ip address 192.168.31.33 255.255.255.255
RC(config-if)#exit

3.启动OSPF进程并进行宣告:

复制代码
RC(config)#router ospf 1
RC(config-router)#router-id 192.168.31.33
RC(config-router)#network 192.168.31.33 0.0.0.0 area 0
RC(config-router)#network 192.168.1.0 0.0.0.255 area 0
RC(config-router)#exit

4.保存配置:

复制代码
RC(config)#do wr
Building configuration...
[OK]

4.验证:

4.1查看RA\AB\RC邻居关系:

4.2查看RA\RB\RC路由表:

5.测试:

5.1RC访问RA和RB:

5.2RA访问RB和RC:

5.3RB访问RA和RC:

到此实验结束!!!

相关推荐
捷米研发三部19 小时前
Profinet 转 TCP/IP 协议转换网关:打破 PLC 与打标卡协议壁垒的工业通讯利器
网络·网络协议·tcp/ip
TeleostNaCl21 小时前
OpenWrt | 实现限制只有指定设备才能访问 luci 和 使用 SSH 等方式管理设备的方法
网络·经验分享·ssh·智能路由器
蒙娜丽宁21 小时前
Rust 并发编程进阶:线程模型、通道通信与异步任务对比分析
开发语言·网络·rust
Teable任意门互动1 天前
主流多维表格产品深度解析:飞书、Teable、简道云、明道云、WPS
开发语言·网络·开源·钉钉·飞书·开源软件·wps
报错小能手1 天前
计算机网络自顶向下方法2——网络、ISP连接结构介绍
网络·计算机网络
-Excalibur-1 天前
形象解释关于TCP/IP模型——层层封装MAC数据帧的过程
linux·c语言·网络·笔记·单片机·网络协议·tcp/ip
小跌—1 天前
Linux:数据链路层
linux·网络
paishishaba1 天前
数据格式 、序列化和反序列化
网络
linux kernel1 天前
第一部分:网络基础
网络·linux网络
朝新_1 天前
【EE初阶】JVM
java·开发语言·网络·jvm·笔记·算法·javaee