GNS3中实验拓补图:

实验内容:

R2和R3属于AREA1,R3和R4属于AREA0都是OSPF路由协议,R4和R5之间是RIP路由协议,R6属于一个电信运营商,实现全网的互联互通

实验步骤:

1、根据实验拓扑图的端口环境配置端口地址,及路由协议

a、R1

R1#conf t                                                                                           进入全局模式
R1(config)#int f0/0                                                                           进入接口F0/0
R1(config-if)#ip add 192.168.10.1 255.255.255.0                            配置IP地址
R1(config-if)#no shut                                                                        启动接口
R1(config-if)#int f0/1                                                                           进入接口0/1
R1(config-if)#ip add 192.168.20.1 255.255.255.0                              配置IP地址
R1(config-if)#no shut                                                                       开启
R1(config-if)#ex                                                                                退出接口模式
R1( config)#ip route 0.0.0.0 0.0.0.0 192.168.20.2                             将R1配置为默认路由

b、R2

Rt#conft                                                                                  进入全局模式
R2(config)#intf0/1                                                                       设置接口f0/1
R2(config- if)#ip add 192 168.20.2 255.255 255.0
R2(config- if)#no shut                                                                     开启
R2(config- if)#int f0/0                                                                 设置接口f0/0
R2(config- if)#ip add 192 168.30.1 255.255 255.0
R2(config- if)#no shut                                                                    开启
R2(config-if)#ex                                                                         退出接口模式
R2(config)#ip route 192.168.10.0 255 255.255.0192.168.20.1              设置R2为静态路由
R2(config)#router ospf 1                                                              启动ospf进程 1
R2(config-router)#router-id 2.2.2.2                                              设置路由id
R2(config-router)#network 192 16830.0 0.0.0.255 area 1            宣告30网段在area1中
R2(config-router) #redistribute connected subnets                      将直连的20网段宣告
R2(config-router) #redistribute static subnets                                  宣告默认路由10段
R2(config- router)#ex


c、R3

R3#conft                                           进入全局模式
R3(config)#int f0/0                       设置接口f0/0
R3(config-if)#ip add 192.168.30.2 255 255 255.0                   配置IP地址
R3(config-if)#no shut                                       开启
R3(config-if)#int f0/1                                       设置接口f0/1
R3(config-if)ip add 192.168 40.1255.255 255.0                                 配置IP地址
R3(config-if)#no shut                                         开启
R3(config-if)#int1/0                                                        设置接口f1/0
R3(config-if)ip add 12.0.0.1 255 255.255.0             配置IP地址
R3(config-if)#no shut                                           开启
R3(config-if)#intf2/0                                                      设置接口f2/0
R3(config-if)# ip add 192.168.70.1 255255 255.0          配置IP地址
R3(config-if)#no shut                                                   开启
R3(config-if)#ex
R3(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2                         将R3配置为默认路由
R3(config)#router ospf 1                                                     开启ospf进程1
R3(config-router) #router-id 3.3.33                                       设置路由id
R3(config-router) #network 192.168.30.0 0.0.0.255 area 1       宣告30网段在area1中
R3(config-router) #network 192.168 40.0 0.0.0.255 area 0         宣告40,70网段在area0中
R3(config-router) #network 192.168.70.0 0.0.0.255 area 0 
R3(config-router) #default-information originate                                注入外部默认路由
R3(config- router)#ex
R3(config)#do show ip route查看路由表

d、R4

Rt4#conf t                                                  进入全局模式
R4(config)#int f0/0                                          配置接口f0/0
R4(config- if)#ip add 192 168 40.2 255 255.255.0
R4(config- if)#no shut                                    开启
R4(config- if)#int f0/1                                   配置接口f0/1
R4(config- if)#ip add 192 168. 50.1255 255.255.0
R4(config- if)#no shut                                    开启
R4(config)#router rip                                     进入rip协议
R4(config router)#ver2                                     版本2
R4(config - router )#no auto-summary                       关闭路由汇总
R4(config router #network 192.168.50.0                     宣告50网段
R4(config - router #redistribute ospf 1 metric 5           在rip中注入ospf
R4(config router)#router ospf 1                           开启ospf进程1
R4(config router)#router-id 4.4.4.4                        设置路由id
R4(config router #network 192.168 40.0 0.0.0.255 area 0     告40网段在area0中
R4(config - router #redistribute rip subnets                在ospf中注入rip
R4(config - router)#ex
R4(config)#do show ip route查看路由信息

e、R5

Rrs#conft                                                    进入全局模式
R5(config)#int f0/0                                          配置接口f0/0
R5(config- if)ip add 192.168 50.2255.255.255.0
R5(config - if)#no shut
R5(config- if)#int f0/1                                                  配置接口f0/1
R5(config- if)ip add 192.168.60.1 255 255 255.0
R5(config - if #no shut
R5(config - if)#ex
R5(config)#router rip                                                      进入rip协议
R5(config router)#ver 2                                                  版本2
R5(config-router )#no auto summary                                 关闭路由汇总
R5(config router )#network 192.168.50.0                              宣告50, 60网段
R5(config router )#network 192.168.60.0

f、  R6

R6#conf t进入全局模式
R6(config)#int f0/0配置接口f0/0
R6(config-if)#ip add 12.0.0.2 255 255255.0
R6(config-if)#no shut
R6(config-if)#int f0/1配置接口f0/1
R6(configif)#ip add 13.0.0.1 255.255 255.0
R6(config-if)#no shut
R6(config)#ip route 192.168.0.0 255 255.0.0 12.0.0.1 设置静态路由

2、配置pc机IP地址和网关

a、pc1

ip 192.168.10.2 192.168.10.1              配置pc1IP地址

b、pc2

ip 192.168.70.2 192.168.70.1              配置pc2IP地址

c、pc3

ip 13.0.0.13 13.0.0.1              配置pc3IP地址

d、pc4

ip 192.168.160.2 192.168.60.1              配置pc4IP地址

3、测试全网的互联互通


搭建ospf协议与rip协议综合实验成功。