OSPF 多区域配置
通过配置OSPF
协议使网络互通。
实验拓扑
如图所示连接,地址规划如下:
名称 | 接口 | IP地址 |
---|---|---|
R1 | f1/0 | 192.168.10.1/24 |
R1 | f0/0 | 192.168.20.1/24 |
R1 | f0/1 | 192.168.50.2/24 |
R2 | f0/0 | 192.168.20.2/24 |
R2 | f0/1 | 192.168.30.1/24 |
R3 | f0/0 | 192.168.30.2/24 |
R3 | f0/1 | 192.168.40.1/24 |
R3 | f1/0 | 192.168.60.1/24 |
R4 | f0/0 | 192.168.40.2/24 |
R4 | f0/1 | 192.168.50.1/24 |
PC1 | e0 | 192.168.10.2/24 |
PC2 | e0 | 192.168.60.2/24 |
配置方法
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 192.168.20.0 0.0.0.255 area 0
R1(config-router)#network 192.168.50.0 0.0.0.255 area 0
R1(config-router)#network 192.168.10.0 0.0.0.255 area 0
R1(config-router)#ex
配置过程
配置接口 IP 地址
- R1
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int f0/0
R1(config-if)#ip add 192.168.20.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#ex
R1(config)#int f0/1
R1(config-if)#ip add 192.168.50.2 255.255.255.0
R1(config-if)#no sh
R1(config-if)#ex
R1(config)#int f1/0
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#ex
R1(config)#do show ip int b
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
- R2
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int f0/0
R2(config-if)#ip add 192.168.20.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#ex
R2(config)#int f0/1
R2(config-if)#ip add 192.168.30.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#ex
R2(config)#do show ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.20.2 YES manual up up
FastEthernet0/1 192.168.30.1 YES manual up up
- R3
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#int f0/0
R3(config-if)#ip add 192.168.30.2 255.255.255.0
R3(config-if)#no sh
R3(config-if)#ex
R3(config)#int f0/1
R3(config-if)#ip add 192.168.40.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#ex
R3(config)#int f1/0
R3(config-if)#ip add 192.168.60.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#ex
R3(config)#do show ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.30.2 YES manual up up
FastEthernet0/1 192.168.40.1 YES manual up up
FastEthernet1/0 192.168.60.1 YES manual up up
- R4
R4#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#int f0/0
R4(config-if)#ip add 192.168.40.2 255.255.255.0
R4(config-if)#no sh
R4(config-if)#ex
R4(config)#int f0/1
R4(config-if)#ip add 192.168.50.1 255.255.255.0
R4(config-if)#no sh
R4(config-if)#ex
R4(config)#do show ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.40.2 YES manual up up
FastEthernet0/1 192.168.50.1 YES manual up up
配置 loopback IP 地址
- R1
R1(config)#int loopback 0
R1(config-if)#ip add 1.1.1.1 255.255.255.255
R1(config-if)#no sh
R1(config-if)#ex
R1(config)#do show ip int b
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
R1(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
C 192.168.10.0/24 is directly connected, FastEthernet1/0
C 192.168.20.0/24 is directly connected, FastEthernet0/0
C 192.168.50.0/24 is directly connected, FastEthernet0/1
- R2
R2(config)#int loopback 0
R2(config-if)#ip add 2.2.2.2 255.255.255.255
R2(config-if)#no sh
R2(config-if)#ex
R2(config)#do show ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.20.2 YES manual up up
FastEthernet0/1 192.168.30.1 YES manual up up
Loopback0 2.2.2.2 YES manual up up
R2(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
C 192.168.30.0/24 is directly connected, FastEthernet0/1
C 192.168.20.0/24 is directly connected, FastEthernet0/0
- R3
R3(config)#int loopback 0
R3(config-if)#ip add 3.3.3.3 255.255.255.255
R3(config-if)#no sh
R3(config-if)#ex
R3(config)#do show ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.30.2 YES manual up up
FastEthernet0/1 192.168.40.1 YES manual up up
FastEthernet1/0 192.168.60.1 YES manual up up
Loopback0 3.3.3.3 YES manual up up
R3(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
C 192.168.30.0/24 is directly connected, FastEthernet0/0
C 192.168.60.0/24 is directly connected, FastEthernet1/0
C 192.168.40.0/24 is directly connected, FastEthernet0/1
- R4
R4(config)#int loopback 0
R4(config-if)#ip add 4.4.4.4 255.255.255.255
R4(config-if)#no sh
R4(config-if)#ex
R4(config)#do show ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.40.2 YES manual up up
FastEthernet0/1 192.168.50.1 YES manual up up
Loopback0 4.4.4.4 YES manual up up
R4(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
4.0.0.0/32 is subnetted, 1 subnets
C 4.4.4.4 is directly connected, Loopback0
C 192.168.40.0/24 is directly connected, FastEthernet0/0
C 192.168.50.0/24 is directly connected, FastEthernet0/1
配置 OSPF
- R1
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 192.168.20.0 0.0.0.255 area 0
R1(config-router)#network 192.168.50.0 0.0.0.255 area 0
R1(config-router)#network 192.168.10.0 0.0.0.255 area 0
R1(config-router)#ex
- R2
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 192.168.20.0 0.0.0.255 area 0
R2(config-router)#network 192.168.30.0 0.0.0.255 area 1
R2(config-router)#ex
- R3
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 192.168.30.0 0.0.0.255 area 1
R3(config-router)#network 192.168.40.0 0.0.0.255 area 1
R3(config-router)#network 192.168.60.0 0.0.0.255 area 1
R3(config-router)#ex
- R4
R4(config)#router ospf 1
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 192.168.40.0 0.0.0.255 area 1
R4(config-router)#network 192.168.50.0 0.0.0.255 area 0
R4(config-router)#ex
查看路由表
- R1
R1(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
O IA 192.168.30.0/24 [110/20] via 192.168.20.2, 00:15:07, FastEthernet0/0
O IA 192.168.60.0/24 [110/21] via 192.168.50.1, 00:00:41, FastEthernet0/1
[110/21] via 192.168.20.2, 00:00:41, FastEthernet0/0
C 192.168.10.0/24 is directly connected, FastEthernet1/0
O IA 192.168.40.0/24 [110/20] via 192.168.50.1, 00:05:52, FastEthernet0/1
C 192.168.20.0/24 is directly connected, FastEthernet0/0
C 192.168.50.0/24 is directly connected, FastEthernet0/1
- R2
R2(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
C 192.168.30.0/24 is directly connected, FastEthernet0/1
O 192.168.60.0/24 [110/11] via 192.168.30.2, 00:01:09, FastEthernet0/1
O 192.168.10.0/24 [110/11] via 192.168.20.1, 00:02:26, FastEthernet0/0
O 192.168.40.0/24 [110/20] via 192.168.30.2, 00:10:33, FastEthernet0/1
C 192.168.20.0/24 is directly connected, FastEthernet0/0
O 192.168.50.0/24 [110/20] via 192.168.20.1, 00:06:15, FastEthernet0/0
- R3
R3(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
C 192.168.30.0/24 is directly connected, FastEthernet0/0
C 192.168.60.0/24 is directly connected, FastEthernet1/0
O IA 192.168.10.0/24 [110/21] via 192.168.40.2, 00:02:35, FastEthernet0/1
[110/21] via 192.168.30.1, 00:02:35, FastEthernet0/0
C 192.168.40.0/24 is directly connected, FastEthernet0/1
O IA 192.168.20.0/24 [110/20] via 192.168.30.1, 00:10:38, FastEthernet0/0
O IA 192.168.50.0/24 [110/20] via 192.168.40.2, 00:06:34, FastEthernet0/1
- R4
R4(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
O 192.168.30.0/24 [110/20] via 192.168.40.1, 00:06:51, FastEthernet0/0
O 192.168.60.0/24 [110/11] via 192.168.40.1, 00:01:27, FastEthernet0/0
4.0.0.0/32 is subnetted, 1 subnets
C 4.4.4.4 is directly connected, Loopback0
O 192.168.10.0/24 [110/11] via 192.168.50.2, 00:02:44, FastEthernet0/1
C 192.168.40.0/24 is directly connected, FastEthernet0/0
O 192.168.20.0/24 [110/20] via 192.168.50.2, 00:06:36, FastEthernet0/1
C 192.168.50.0/24 is directly connected, FastEthernet0/1
验证结果
- 配置
VPC
的IP地址
PC1> ip 192.168.10.2 192.168.10.1
Checking for duplicate address...
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.1
PC2> ip 192.168.60.2 192.168.60.1
Checking for duplicate address...
PC1 : 192.168.60.2 255.255.255.0 gateway 192.168.60.1
- 测试可以相互
ping
通
PC1> ping 192.168.60.2
192.168.60.2 icmp_seq=1 timeout
84 bytes from 192.168.60.2 icmp_seq=2 ttl=61 time=59.831 ms
84 bytes from 192.168.60.2 icmp_seq=3 ttl=61 time=63.507 ms
84 bytes from 192.168.60.2 icmp_seq=4 ttl=61 time=57.735 ms
84 bytes from 192.168.60.2 icmp_seq=5 ttl=61 time=64.449 ms
PC2> ping 192.168.10.2
84 bytes from 192.168.10.2 icmp_seq=1 ttl=61 time=58.141 ms
84 bytes from 192.168.10.2 icmp_seq=2 ttl=61 time=55.996 ms
84 bytes from 192.168.10.2 icmp_seq=3 ttl=61 time=64.000 ms
84 bytes from 192.168.10.2 icmp_seq=4 ttl=61 time=56.732 ms
84 bytes from 192.168.10.2 icmp_seq=5 ttl=61 time=65.020 ms
OSPF 多区域配置的更多相关文章
- OSPF单区域配置
OSPF单区域配置 实验环境:华为模拟器eNSP 现在有这样一个拓扑图: 我想要让R1可以ping通R3,显然目前是不行的: <R1>ping 192.168.2.2 PING 192.1 ...
- OSPF但区域配置
原理概述 实验内容 实验拓扑 实验编址 实验步骤1.基本配置配置完成后,使用ping命令检测 2.部署单区域OSPF网络使用命令ospf创建并运行OSPF 其中1是进程号,如果没有写明进程号,则默认为 ...
- GNS3(1)——OSPF多区域配置
GNS3(1)——OSPF多区域配置 RIP适用于中小网络,比较简单.没有系统内外.系统分区,边界等概念,用到不是分类的路由. OSPF适用于较大规模网络.它把自治系统分成若干个区域,通过系列内外路由 ...
- OSPF多区域配置
1.配置三台路由器IP R1(config)#INTER S1/0 R1(config-if)#IP ADDress 192.1.12.1 255.255.255.0 R1(config-if)#no ...
- eNSP模拟器OSPF单区域配置
实验拓扑图如下 下一步对终端设备与路由器的端口进行基本的ip设置 配置完成后要注意检查是否有小错误,不然会对后面的测试带来麻烦.在进行基础配置的时候一定要细心细心细心. 下一步我们就要进行OSPF的配 ...
- OSPF多区域配置;骨干区域与非骨干区域;ABR边界路由器;LSA和SPF算法
SPF:链路状态路由算法.基本用于OSPF中,但是要求路由器路由数据库足够大,因为链路状态信息包括很多内容,这也是一个缺点. OSPF是一种内部网关协议(IGP) OSPF路由协议是一种典型的链路状态 ...
- OSPF 单区域实验
实验拓扑 实验需求 按照图示配置 IP 地址 按照图示分区域配置 OSPF ,实现全网互通 为了路由结构稳定,要求路由器使用环回口作为 Router-id 实验步骤 每台路由器都要将本地的所有直连网段 ...
- OSPF多区域
目录 一.OSPF的多区域 1.1 生成OSPF多区域的原因 1.2 路由器的类型 1.3 区域的类型 二.链路状态数据库 2.1 链路状态数据库的组成 2.2链路状态通告 三.OSPF多区域配置 四 ...
- OSPF多区域原理与配置
OSPF多区域原理与配置 目录 一.OSPF多区域生成 1.1.生成OSPF多区域的原因 二.OSPF的三种通信量 2.1.域内通信量 2.2.域间通信量 2.3.外部通信量 三.OSPF的路由器类型 ...
随机推荐
- [GXOI/GZOI2019]与或和(位运算,单调栈)
题目链接懒得放了. 题目大意懒得写了. 省选原题哪有找不到的…… 说实话,其实这题是个大水题,被我十秒钟内口胡出来了. 首先位运算除了拆位还能干啥?以下以与为例,或是差不多的. 我们考虑有多少个子矩阵 ...
- centos里的压缩解压命令tar总结
压缩 tar czvf 压缩文件名称.tar.gz 文件或者目录名称 比如:tar czvf backup.tar.gz /etc,把/etc目录打包成文件backup.tar.gz c是打包 z是g ...
- Azure DevOps Server (TFS) 修改Git文件大小限制
签入Git的所有文件将永远保留在存储库中,限制大文件签入到代码库,可以增加磁盘使用效率,提高系统备份还原等日常维护的效率. 通过下面的设置,团队项目管理员可以阻止超过特定大小的文件进入存储库.如果推送 ...
- docker 学习操作记录 5-2
记录5-2 root@53d0a643a2c7:/# quit bash: quit: command not found root@53d0a643a2c7:/# exit exit -->@ ...
- Linux内核宏DEVICE_ATTR使用
1.前言 在Linux驱动程序编写中,使用DEVICE_ATTR宏,可以定义一个struct device_attribute设备属性,并使用sysfs的API函数,便可以在设备目录下创建出属性文件, ...
- mount和umount命令使用
1.mount命令 在Linux系统下,mount命令用于加载文件系统到指定的加载点. (1)命令语法 mount(选项)(参数) (2)常用选项说明 -V:显示版本. -l:显示已加载的文件系统列表 ...
- CloseableHttpClient方式配置代理服务器访问外网
小编最近在负责银行内部项目.其中有模块需要访问天眼查API接口,但由于公司全部内网,所以需要配置代理服务器才可以访问外网接口. 又到了激动人心的上码时刻! public void Connect(Ht ...
- 2014百度之星 Party
Party Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...
- 【Go】go的日志框架-logrus初探
summary logrus是针对go语言开发的一款日志系统,在本片文章中,将会对上手logrus的过程中遇到的一些问题做一个记录.这个记录参考了这篇文章.下面我们开始吧! 上手 package ma ...
- Dart方法基础知识
方法定义: void main(List args){ print(args); print(getPerson('wwk', 32)); } /*String getPerson(String na ...