拓扑
需求
实现PC1和PC3互联互通
配置步骤
1)配置接口信息
- 配置PC的IP地址
- 配置路由器的接口
2)配置OSPF单区域
- 创建ospf进程,定义router-id
- 指定相应区域
- 宣告网段进入ospf
3)配置OSPF多区域
4) R6配置去往PC3的静态路由
5)R7上配置去往PC1、PC2的静态路由
6)R6上在OSPF进程下引入外部路由
7) 业务连通性测试
- pc1 ping pc3进行连通性测试
配置命令
第一步:配置PC接口IP地址
第二步:配置路由器接口IP地址
第三步:配置OSPF:
R1配置:
interface GigabitEthernet0/0/0
ip address 192.168.12.1 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 192.168.1.254 255.255.255.0
#
ospf 1 router-id 1.1.1.1
area 0.0.0.12
network 192.168.1.0 0.0.0.255
network 192.168.12.0 0.0.0.255
R2配置:
interface GigabitEthernet0/0/0
ip address 192.168.23.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.12.2 255.255.255.0
#
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 192.168.23.0 0.0.0.255
area 0.0.0.12
network 192.168.12.0 0.0.0.255
R3配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.34.3 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.23.3 255.255.255.0
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 192.168.23.0 0.0.0.255
network 192.168.34.0 0.0.0.255
R4配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.45.4 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.34.4 255.255.255.0
#
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 192.168.34.0 0.0.0.255
network 192.168.45.0 0.0.0.255
R5配置:
interface GigabitEthernet0/0/0
ip address 192.168.56.5 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.45.5 255.255.255.0
#
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 192.168.45.0 0.0.0.255
area 0.0.0.56
network 192.168.56.0 0.0.0.255
R6配置
#
interface GigabitEthernet0/0/1
ip address 192.168.56.6 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 192.168.2.254 255.255.255.0
#
ospf 1 router-id 6.6.6.6
area 0.0.0.56
network 192.168.2.0 0.0.0.255
network 192.168.56.0 0.0.0.255
第四步:R6配置去往PC3的静态路由
R6配置
#
interface GigabitEthernet0/0/0
ip address 192.168.67.6 255.255.255.0
#
ip route-static 192.168.3.0 24 192.168.67.7
第五步:R7配置去往PC1/PC2的静态路由
R7配置
interface GigabitEthernet0/0/0
ip address 192.168.67.7 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.3.254 255.255.255.0
#
ip route-static 192.168.0.0 16 192.168.67.6
第六步:R6上在OSPF进程下引入静态路由
R6配置
ospf 1 router-id 6.6.6.6
import-route static
第七步:验证与测试
PC1可以访问PC3