实验拓扑:
实验要求:
配置ip
配置ospf
配置路由汇总
配置路由重分发
1.配置ip
R1:
interface GigabitEthernet 0/0/0
ip add 192.168.1.1 255.255.255.0
undo sh
interface GigabitEthernet 0/0/1
ip add 192.168.3.2 255.255.255.0
undo sh
int loopback0
ip add 1.1.1.1 255.255.255.255
R2:
interface GigabitEthernet 0/0/0
ip add 192.168.1.2 255.255.255.0
undo sh
interface GigabitEthernet 0/0/1
ip add 192.168.2.1 255.255.255.0
undo sh
int loopback0
ip add 2.2.2.2 255.255.255.255
R3:
int Gigab 0/0/0
ip add 192.168.2.2 255.255.255.0
undo sh
int Gigab 0/0/1
ip add 192.168.4.1 255.255.255.0
undo sh
int loop
ip add 3.3.3.3 255.255.255.255
R4:
int Gigab 0/0/0
ip add 192.168.3.1 255.255.255.0
undo sh
ip loop
ip add 4.4.4.4 255.255.255.255
R5:
int Gigab 0/0/0
ip add 192.16.4.2 255.255.255.0
undo sh
int loopback0
ip add 172.16.10.1 255.255.255.255
int loopback1
ip add 172.16.20.1 255.255.255.255
lint loopbakc2
ip add 172.16.30.1 255.255.255.255
int loopbal3
ip add 172.16.40.1 255.255.255.255
配置ospf
R1:
ospf 1 route-id 1.1.1.1
area 0
network 1.1.1.1 0.0.0.0
network 192.168.3.0 0.0.0.255
network 192.168.1.0 0.0.0.255
R2:
ospf 1 route-id 2.2.2.2
area 1
network 2.2.2.2 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.618.2.0 0.0.0.255
R3:
ospf 1 route-id 3.3.3.3
area 1
network 3.3.3.3 0.0.0.0
network 192.168.2.0 0.0.0.255
R4:
ospf 1 route-id 4.4.4.4
area 2
network 4.4.4.4 0.0.0.0
network 192168.3.0 0.0.0.255
配置ospf
R1:
ospf 1 route-id 1.1.1.1
area 0
network 1.1.1.1 0.0.0.0
network 192.168.3.0 0.0.0.255
network 192.168.1.0 0.0.0.255
R2:
ospf 1 route-id 2.2.2.2
area 1
network 2.2.2.2 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.618.2.0 0.0.0.255
R3:
ospf 1 route-id 3.3.3.3
area 1
network 3.3.3.3 0.0.0.0
network 192.168.2.0 0.0.0.255
R4:
ospf 1 route-id 4.4.4.4
area 2
network 4.4.4.4 0.0.0.0
network 192168.3.0 0.0.0.255
二、RIP和OSPE
1.RIP
(1)配置RIPv1
[R1]rip 启动rip进程
[R1-rip-1]network 192.168.1.0 宣告直连路由
(2)配置RIPv2
[R1]rip 启动RIP进程
[R1-rip-1]version 2 指定RIP的版本
[R1-rip-1]network 192.168.1.0 宣告直连路由
[R1-rip-1]undo summary 关闭路由汇总
1.配置单区域的OSPF
(1)启动OSPF进程指定Router
[R1]ospf router-id 1.1.1.1
(2)指定osfp区域
[R1-ospf-1]area 0
(3)宣告直连路由写反掩码
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
(4)查看邻居关系状态
[R3]display ospf peer brief
(5)查看接口的ospf信息
[R3]display ospf interface GigabitEthernet 0/0/1
(6)查看路由表
[R3]display ip routing-table
2.配置多区域ospf
(1)启动ospf进程指定router-id
[R2]ospf 1 router-id 2.2.2.2
(2)指定ospf区域
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]network 192.168.2.0 0.0.0.255
3.配置ospf的特殊区域
(1)配置末梢区域
[R2]ospf 1 启动ospf进程
[R2-ospf-1]area 1 进程ospf的区域1
[R2-ospf-1-area-0.0.0.1]stub设置为末梢区域
(2)配置完全末梢区域
[R2]ospf 1 进入到ospf进程1
[R2-ospf-1]area 1 进入区域1
[R2-ospf-1-area-0.0.0.1]atub no-summary
(3)非纯末梢区域NSSA区域
[R3]ospf 1 进入到ospf进程1
[R3-ospf-1]area 1 进入到ospf区域1
[R3-ospf-1-area-0.0.0.1]nssa default-route-advertise 配置为DSSA区域通过默认路由和其他协议通信
4.配置OSPF路由重分发
(1)将RIP重分发到ospf中
[R3]ospf 1 进入到ospf区域1中
[R3-ospf-1]import-route rip 发布rip到ospf中
(2)将ospf发布到rip中
[R3]rip 1 进入到rip进程
[R3-ospf-1]import-route ospf 1 发布ospf到rip
(3)重分发静态路由
[R3]ospf 1
[R3-ospf-1]import-route static
5.配置路由汇总
(1)配置外部路由汇总
[R3]ospf 1
[R3-ospf-1]asbr-summary 172.16.0.0 255.255.0.0
(2)配置域间汇总
[R3]ospf 1
[R3-ospf-1]area 2
[R3-ospf-1-area-0.0.0.2]abr-summay 172.16.0.0 255.255.0.0