OSPF配置实验!

Posted handsomeboy-东

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OSPF配置实验!相关的知识,希望对你有一定的参考价值。

文章目录

OSPF配置实验

实验要求:配置动态路由协议使全网互通,client1能访问server1的web服务

1)配置好各PC机和client的IP地址,子网掩码和网关,配置server1的IP地址和子网掩码
2)各设备的配置如下
SW1:

[SW1]v b 10 20
[SW1]int e0/0/1
[SW1-Ethernet0/0/1]p l a
[SW1-Ethernet0/0/1]p d v 10
[SW1-Ethernet0/0/1]q
[SW1]int e0/0/2
[SW1-Ethernet0/0/2]p l a
[SW1-Ethernet0/0/2]p d v 10
[SW1-Ethernet0/0/2]q
[SW1]int e0/0/5
[SW1-Ethernet0/0/5]p l t
[SW1-Ethernet0/0/5]p t a v a
[SW1]int Ethernet	
[SW1]int Eth-Trunk 1
[SW1-Eth-Trunk1]trunkport e0/0/3
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1-Eth-Trunk1]trunkport e0/0/4
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1-Eth-Trunk1]p l t 
[SW1-Eth-Trunk1]p t a v a

SW2:

[Huawei]v b 10 20
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]p l a
[Huawei-Ethernet0/0/1]p d v 20
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]p l a
[Huawei-Ethernet0/0/2]p d v 20
[Huawei]int Eth-Trunk 1
[Huawei-Eth-Trunk1]trunkport e0/0/3
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei-Eth-Trunk1]trunkport e0/0/4
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei-Eth-Trunk1]p l t
[Huawei-Eth-Trunk1]p t a v a

R1:

[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]ip add 192.168.1.254 24
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 10
[R1-GigabitEthernet0/0/0.1]arp broadcast enable 
[R1-GigabitEthernet0/0/0.1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]ip add 192.168.2.254 24
[R1-GigabitEthernet0/0/0.2]dot1q termination vid 20
[R1-GigabitEthernet0/0/0.2]arp broadcast enable 
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 10.0.0.1 24
[R1]ospf 1 router-id 1.1.1.1                          //设置OSPF的Route-ID
[R1-ospf-1]area 1                                     //设置area 1域
[R1-ospf-1-area-0.0.0.1]network 10.0.0.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]network 192.168.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]network 192.168.2.0 0.0.0.255

R2:

[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 10.0.0.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 20.0.0.1 24
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]network 10.0.0.0 0.0.0.255
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 20.0.0.0 0.0.0.255

R3:

[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 20.0.0.2 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 40.0.0.1 24
[R3-GigabitEthernet0/0/1]int g2/0/0
[R3-GigabitEthernet2/0/0]ip a 30.0.0.1 24
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0 
[R3-ospf-1-area-0.0.0.0]network 20.0.0.0 0.0.0.255
[R3-ospf-1]area 3
[R3-ospf-1-area-0.0.0.3]network 40.0.0.0 0.0.0.255
[R3-ospf-1-area-0.0.0.3]q
[R3-ospf-1]area 2
[R3-ospf-1-area-0.0.0.2]network 30.0.0.0 0.0.0.255

R4:

[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip a 30.0.0.2 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip a 50.0.0.1 24
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]default-route-advertise always
[R4-ospf-1]area 2
[R4-ospf-1-area-0.0.0.2]network 30.0.0.0 0.0.0.255
[R4-ospf-1-area-0.0.0.2]q
[R4-ospf-1]q
[R4]rip	
[R4]rip 1
[R4-rip-1]version 2
[R4-rip-1]network 50.0.0.0
[R4-rip-1]q
[R4]ospf 1
[R4-ospf-1]import-route rip 1 type 2 cost 1
[R4]rip 1
[R4-rip-1]import-route ospf 1

SW3:

[SW3]v b 10 20 30
[SW3]int g0/0/1
[SW3-GigabitEthernet0/0/1]p l a
[SW3-GigabitEthernet0/0/1]p d v 10
[SW3-GigabitEthernet0/0/1]int g0/0/1
[SW3-GigabitEthernet0/0/2]p l a
[SW3-GigabitEthernet0/0/2]p d v 20
[SW3-GigabitEthernet0/0/2]q
[SW3]int g0/0/3
[SW3-GigabitEthernet0/0/3]q
[SW3]int g0/0/3
[SW3-GigabitEthernet0/0/3]p l a
[SW3-GigabitEthernet0/0/3]p d v 30
[SW3-GigabitEthernet0/0/3]q
[SW3]int v	
[SW3]int Vlanif 10
[SW3-Vlanif10]ip add 192.168.3.254 24
[SW3-Vlanif10]int Vlanif 20
[SW3-Vlanif20]ip add 192.168.4.254 24
[SW3-Vlanif20]int Vlanif 30
[SW3-Vlanif30]ip add 40.0.0.2 24
[SW3]ospf 1 router-id 7.7.7.7
[SW3-ospf-1]area 3
[SW3-ospf-1-area-0.0.0.3]network 40.0.0.0 0.0.0.255
[SW3-ospf-1-area-0.0.0.3]network 192.168.3.0 0.0.0.255
[SW3-ospf-1-area-0.0.0.3]network 192.168.4.0 0.0.0.255

R5:

[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip a 50.0.0.2 24
[R5-GigabitEthernet0/0/0]int g0/0/1
[R5-GigabitEthernet0/0/1]ip a 60.0.0.1 24
[R5]ip route-static 0.0.0.0 0.0.0.0 60.0.0.2
[R5]rip 1 
[R5-rip-1]version 2
[R5-rip-1]network 50.0.0.0
[R5-rip-1]network 60.0.0.0
[R5-rip-1]default-route originate 

R6:

[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ip a 60.0.0.2 24
[R6-GigabitEthernet0/0/0]int g0/0/1
[R6-GigabitEthernet0/0/1]ip add 100.0.0.254 24
[R6]rip 1
[R6-rip-1]version 2
[R6-rip-1]network 60.0.0.0
[R6]acl 2000
[R6-acl-basic-2000]rule permit source any 
[R6-acl-basic-2000]q
[R6]int g0/0/1
[R6-GigabitEthernet0/0/1]nat outbound 2000

在PC1上pingPC2,PC3和server3

在client1上获取server的数据:

以上是关于OSPF配置实验!的主要内容,如果未能解决你的问题,请参考以下文章

实验 OSPF 基本配置

实验 OSPF 基本配置

OSPF配置实验!

实验十三 OSPF 基本配置

OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置

OSPF实验