其他分享
首页 > 其他分享> > 大型公司网络之——OSPF高级配置(实验)

大型公司网络之——OSPF高级配置(实验)

作者:互联网

OSPF高级配置

路由重分发:

一.理解路由重分发:

1.一个单一IP路由协议是管理网络中IP路由的首选方案

2.Cisco ISO能执行多个路由协议,每一个路由协议和该路由协议所服务的网络属于同一个自治系统

3.Cisco ISO使用路由重分发特性以交换不同协议创建的路由信息

二.路由重分发的考虑:

1.度量值

2.管理距离

三.重分发到OSPF域中路由的路径类型:


1.类型1的外部路径(type1 external path,E1)

2.类型2的外部路径(type2 external path,E2)

路由重分发配置

一.路由重分发配置命令:

Router(config-router)#redistribute protocol metric metric-value metric-type type-value subnets

二.OSPF与RIP重分发配置实例:

router rip

  redistribute ospf 1metric 10

router ospf 1

  redistribute rip metric 200 subnets
三.OSPF重分发静态路由配置实例:
router ospf 1

  redistribute static metric 100 subnets metric-type2
四.OSPF重分发默认路由配置实例:
router ospf 1

  network 192.168.0.0 0.0.0.255 area 0

  default-information originate metric 10 netric-type 1

ip route 0.0.0.0 0.0.0.0 10.0.1.1

OSPF高级配置实验:(GNS3中拓扑图如下)

大型公司网络之——OSPF高级配置(实验)

实验环境准备:GNS3及与之相连的CRT

实验中需要用到的协议有:默认路由协议、静态路由协议、RIP协议、OSPF协议

打开GNS3后:
1.拖出六个路由器(每台路由器需要右键点击选择configure,在Slots中添加一个端口NM-1FE-TX,点击OK添加)
2.四台PC机
3.将R6的 图标改为cloud(这里作为电信运营商)

其中:
1.area1和area2都为ospf协议
2.R4到R5段为RIP协议
3.R3担任ABR的角色

第一步:根据拓扑图上的端口环境配置端口地址:

R1:

  R1#conf t
  R1(config)#int f0/0    
  R1(config-if)#ip add 192.168.10.1 255.255.255.0
  R1(config-if)#no shut
  R1(config-if)#int f0/1
  R1(config-if)#ip add 192.168.20.1 255.255.255.0
  R1(config-if)#no shut
  R1(config-if)#ex
  R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.20.0                  //末梢网络环境配置默认路由出去,指向下一跳地址

R2:

  R2#conf t
  R2(config)#int f0/1
  R2(config-if)#ip add 192.168.20.2 255.255.255.0
  R2(config-if)#no shut
  R2(config-if)#ex
  R2(config)#int 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)#router ospf 1                                                                  //启用OSPF进程1
  R2(config-router)#router-id 2.2.2.2                                                 //标注router-id
  R2(config-router)#network 192.168.30.0 0.0.0.255 area 1             //宣告30段落的网段,在area1中
  R2(config-router)#ex
  R2(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.1      //做静态路由
  R2(config)#router ospf 1                                                                  //启用OSPF进程1
  R2(config-router)#redistribute connected subnets                         //直连网段20段落注入
  R2(config-router)#redistribute static subnets                                 //静态网段10段落注入
  R2(config-router)#ex

R3:

  R3#conf t
  R3(config)#int f0/0
  R3(config-if)#ip add 192.168.30.2 255.255.255.0
  R3(config-if)#no shut
  R3(config-if)#int f0/1
  R3(config-if)#ip add 192.168.40.1 255.255.255.0
  R3(config-if)#no shut
  R3(config-if)#int f1/0
  R3(config-if)#ip add 12.0.0.1 255.255.255.0
  R3(config-if)#no shut
  R3(config-if)#int f2/0
  R3(config-if)#ip add 192.168.70.1 255.255.255.0
  R3(config-if)#no shut
  R3(config-if)#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            12.0.0.1                YES manual up                    up      
  FastEthernet2/0            192.168.70.1        YES manual up                    up      
  R3(config-if)#ex
  R3(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2                               //配置默认路由出去,指向下一跳
  R3(config)#router ospf 1                                                            //启用OSPF进程1
  R3(config-router)#router-id 3.3.3.3                                            //标注router-id
  R3(config-router)#network 192.168.30.0 0.0.0.255 area 1        //在area1中宣告30段
  R3(config-router)#network 192.168.40.0 0.0.0.255 area 0        //在area0中宣告40段
  R3(config-router)#network 192.168.70.0 0.0.0.255 area 0        //在area0中宣告70段
  R3(config-router)#default-information originate                         //注入外部默认路由 
  R3(config-router)#ex

R4:

  R4#conf t
  R4(config)#int 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
  R4(config-if)#ip add 192.168.50.1 255.255.255.0
  R4(config-if)#no shut
  R4(config-if)#ex
  R4(config)#router rip                                                         //配rip协议
  R4(config-router)#ver 2
  R4(config-router)#no auto-summary
  R4(config-router)#network 192.168.50.0
  R4(config-router)#redistribute ospf 1 metric 5                  //注入ospf协议包含进程号和度量值
  R4(config-router)#ex
  R4(config)#router ospf 1                                                  //启用OSPF进程1
  R4(config-router)#router-id 4.4.4.4                                  //标注router-id
  R4(config-router)#network 192.168.40.0 0.0.0.255 area 0
  R4(config-router)#redistribute rip subnets                       //注入rip协议
  R4(config-router)#ex

R5:

  R5#conf t
  R5(config)#int f0/0
  R5(config-if)#ip add 192.168.50.2 255.255.255.0
  R5(config-if)#no shut
  R5(config-if)#int 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-if)#router rip                                                           //配rip协议 
  R5(config-router)#ver 2
  R5(config-router)#no auto-summary
  R5(config-router)#network 192.168.50.0
  R5(config-router)#network 192.168.60.0
  R5(config-router)#ex

R6:

  R6#conf t
  R6(config)#int f0/0
  R6(config-if)#ip add 12.0.0.2 255.255.255.0
  R6(config-if)#no shut
  R6(config-if)#int f0/1
  R6(config-if)#ip add 13.0.0.1 255.255.255.0
  R6(config-if)#no shut
  R6(config-if)#ex
  R6(config)#ip route 192.168.0.0 255.255.0.0 12.0.0.1          //配静态路由

第二步:进入四台客户机配置IP地址和网关:

1客户机>ip 192.168.10.2 192.168.10.1
2客户机>ip 192.168.70.2 192.168.70.1
3客户机>ip 13.0.0.13 13.0.0.1
4客户机>ip 192.168.60.2 192.169.60.1

第三步:进行全网互通测试:

进入PC1

PC1>ping 192.168.70.2 -t(长ping测试)
PC1>ping 192.168.60.2 -t(长ping测试)
PC1>ping 13.0.0.13 -t(长ping测试)
结果如下图,达成全网互通,实验成功!

大型公司网络之——OSPF高级配置(实验)

第四步:查看所有网段是否全部互相学习了

R1:

R1(config)#do show ip route
......(省略部分显示)
C    192.168.10.0/24 is directly connected, FastEthernet0/0
C    192.168.20.0/24 is directly connected, FastEthernet0/1
S*   0.0.0.0/0 [1/0] via 192.168.20.2

R2:

R2(config)#do show ip route
......(省略部分显示)
C        192.168.30.0/24 is directly connected, FastEthernet0/0
O  E2 192.168.60.0/24 [110/20] via 192.168.30.2, 00:12:45, FastEthernet0/0
S        192.168.10.0/24 [1/0] via 192.168.20.1
O  IA  192.168.40.0/24 [110/20] via 192.168.30.2, 01:43:09, FastEthernet0/0
C        192.168.20.0/24 is directly connected, FastEthernet0/1
O  E2 192.168.50.0/24 [110/20] via 192.168.30.2, 00:12:45, FastEthernet0/0
O  IA  192.168.70.0/24 [110/11] via 192.168.30.2, 01:42:47, FastEthernet0/0
O *E2 0.0.0.0/0 [110/1] via 192.168.30.2, 01:41:24, FastEthernet0/0

R3:

R3(config)#do show ip route
......(省略部分显示)
C        192.168.30.0/24 is directly connected, FastEthernet0/0
O  E2 192.168.60.0/24 [110/20] via 192.168.40.2, 00:21:06, FastEthernet0/1
O  E2 192.168.10.0/24 [110/20] via 192.168.30.1, 01:51:31, FastEthernet0/0
C        192.168.40.0/24 is directly connected, FastEthernet0/1
O  E2 192.168.20.0/24 [110/20] via 192.168.30.1, 01:51:31, FastEthernet0/0
          12.0.0.0/24 is subnetted, 1 subnets
C        12.0.0.0 is directly connected, FastEthernet1/0
O  E2 192.168.50.0/24 [110/20] via 192.168.40.2, 00:21:07, FastEthernet0/1
C        192.168.70.0/24 is directly connected, FastEthernet2/0
S*       0.0.0.0/0 [1/0] via 12.0.0.2

R4:

R4(config)#do show ip route
......(省略部分显示)
O IA 192.168.30.0/24 [110/20] via 192.168.40.1, 00:24:05, FastEthernet0/0
R    192.168.60.0/24 [120/1] via 192.168.50.2, 00:00:00, FastEthernet0/1
O E2 192.168.10.0/24 [110/20] via 192.168.40.1, 00:24:05, FastEthernet0/0
C    192.168.40.0/24 is directly connected, FastEthernet0/0
O E2 192.168.20.0/24 [110/20] via 192.168.40.1, 00:24:05, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/1
O    192.168.70.0/24 [110/11] via 192.168.40.1, 00:24:05, FastEthernet0/0
O*E2 0.0.0.0/0 [110/1] via 192.168.40.1, 00:24:07, FastEthernet0/0

R5:

R5(config)#do show ip route
......(省略部分显示)
R    192.168.30.0/24 [120/5] via 192.168.50.1, 00:00:20, FastEthernet0/0
C    192.168.60.0/24 is directly connected, FastEthernet0/1
R    192.168.10.0/24 [120/5] via 192.168.50.1, 00:00:20, FastEthernet0/0
R    192.168.40.0/24 [120/5] via 192.168.50.1, 00:00:20, FastEthernet0/0
R    192.168.20.0/24 [120/5] via 192.168.50.1, 00:00:20, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/0
R    192.168.70.0/24 [120/5] via 192.168.50.1, 00:00:20, FastEthernet0/0
R*   0.0.0.0/0 [120/1] via 192.168.50.1, 00:00:10, FastEthernet0/0

R6:

R6(config)#do show ip route
......(省略部分显示)
     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, FastEthernet0/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.0.0.0 is directly connected, FastEthernet0/1
S    192.168.0.0/16 [1/0] via 12.0.0.1

以上实验就是在大型企业网络中会应用到的OSPF的高级配置,希望能给大家带来帮助,大家也可以使用GNS3根据上面的步骤进行操作。谢谢!

标签:24,FastEthernet0,OSPF,高级,192.168,实验,0.0,router,config
来源: https://blog.51cto.com/14464303/2437866