三台三层交换机OSPF多区域划分动态路由实验

一、实验拓扑

三台三层交换机OSPF多区域划分动态路由实验_第1张图片

二、实验步骤

1、给主机设置IP,网关;给交换机划分VLAN,给VLAN划分端口,给VLAN设置IP

2、启用OSPF、宣告网段(network 网络地址 反掩码 区域名     其中0区域为主干区域)

 

▲SwitchA 的相关配置

Switch>enable
Switch#config
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hostname SwitchA
SwitchA(config)#vlan 10 SwitchA(config-vlan)#exit SwitchA(config)#vlan 20 SwitchA(config-vlan)#exit SwitchA(config)#vlan 100 SwitchA(config-vlan)#exit
SwitchA(config)#interface range fastEthernet 0/1-10 SwitchA(config-if-range)#switchport access vlan 10 SwitchA(config-if-range)#interface range fastEthernet 0/11-20 SwitchA(config-if-range)#switchport access vlan 20 SwitchA(config-if-range)#interface fastEthernet 0/23 SwitchA(config-if)#switchport access vlan 100 SwitchA(config-if)#
SwitchA(config-if)#interface vlan 100
SwitchA(config-if)#ip address 192.168.100.1 255.255.255.0
SwitchA(config-if)#no shutdown
SwitchA(config-if)#interface vlan 10
SwitchA(config-if)#ip address 192.168.10.1 255.255.255.0
SwitchA(config-if)#no shutdown
SwitchA(config-if)#interface vlan 20
SwitchA(config-if)#ip address 192.168.20.1 255.255.255.0
SwitchA(config-if)#no shutdown
SwitchA(config-if)#exit
SwitchA(config)#router ?
  eigrp  Enhanced Interior Gateway Routing Protocol (EIGRP)
  ospf   Open Shortest Path First (OSPF)
  rip    Routing Information Protocol (RIP)
SwitchA(config)#router ospf ?
  <1-65535>  Process ID
SwitchA(config)#router ospf 1
SwitchA(config-router)#network 192.168.10.0 0.0.0.255 area 0
SwitchA(config-router)#network 192.168.20.0 0.0.0.255 area 0
SwitchA(config-router)#network 192.168.100.0 0.0.0.255 area 0
SwitchA(config-router)#

 

▲SwitchB 的相关配置

Switch>
Switch>enable 
Switch#config
Configuring from terminal, memory, or network [terminal]?  
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 30
Switch(config-vlan)#exit
Switch(config)#vlan 40
Switch(config-vlan)#exit
Switch(config)#vlan 101
Switch(config-vlan)#exit
Switch(config)#vlan 200
Switch(config-vlan)#exit
Switch(config)#hostname SwitchB
SwitchB(config)#interface range fastEthernet 0/1-10 SwitchB(config-if-range)#switchport access vlan 30 SwitchB(config-if-range)#interface range fastEthernet 0/11-20 SwitchB(config-if-range)#switchport access vlan 40 SwitchB(config-if-range)#interface fastEthernet 0/23 SwitchB(config-if)#switchport access vlan 101 SwitchB(config-if)#interface fastEthernet 0/24 SwitchB(config-if)#switchport access vlan 200 SwitchB(config-if)#
SwitchB(config-if)#exit
SwitchB(config)#interface vlan 101
SwitchB(config-if)#ip address 192.168.100.2 255.255.255.0
SwitchB(config-if)#no shutdown
SwitchB(config-if)#interface vlan 200
SwitchB(config-if)#ip address 192.168.200.1 255.255.255.0
SwitchB(config-if)#no shutdown
SwitchB(config-if)#interface vlan 30
SwitchB(config-if)#ip address 192.168.30.1 255.255.255.0
SwitchB(config-if)#no shutdown
SwitchB(config-if)#interface vlan 40
SwitchB(config-if)#ip address 192.168.40.1 255.255.255.0
SwitchB(config-if)#no shutdown
SwitchB(config-if)#exit
SwitchB(config)#route ospf 1 SwitchB(config-router)#network 192.168.100.0 0.0.0.255 area 0 SwitchB(config-router)#network 192.168.30.0 0.0.0.255 area 0 SwitchB(config-router)#network 192.168.200.0 0.0.0.255 area 1 SwitchB(config-router)#network 192.168.40.0 0.0.0.255 area 1 SwitchB(config-router)#

  

▲SwitchC 的相关配置

Switch>
Switch>enable
Switch#config
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hostname SwitchC
SwitchC(config)#vlan 50 SwitchC(config-vlan)#exit SwitchC(config)#vlan 60 SwitchC(config-vlan)#exit SwitchC(config)#vlan 201 SwitchC(config-vlan)#exit SwitchC(config)#interface range fastEthernet 0/1-10 SwitchC(config-if-range)#switchport access vlan 50 SwitchC(config-if-range)#interface range fastEthernet 0/11-20 SwitchC(config-if-range)#switchport access vlan 60 SwitchC(config-if-range)#interface fastEthernet 0/24 SwitchC(config-if)#switchport access vlan 201 SwitchC(config-if)#exit
SwitchC(config)#interface vlan 201
SwitchC(config-if)#ip address 192.168.200.2 255.255.255.0
SwitchC(config-if)#no shutdown 
SwitchC(config-if)#interface vlan 50
SwitchC(config-if)#ip address 192.168.50.100 255.255.255.0
SwitchC(config-if)#no shutdown 
SwitchC(config-if)#interface vlan 60
SwitchC(config-if)#ip address 192.168.60.100 255.255.255.0
SwitchC(config-if)#no shutdown 
SwitchC(config-if)#exit
Switch(config)#router ?
  eigrp  Enhanced Interior Gateway Routing Protocol (EIGRP)
  ospf   Open Shortest Path First (OSPF)
  rip    Routing Information Protocol (RIP)
Switch(config)#router ospf ?
  <1-65535>  Process ID
Switch(config)#router ospf 1
Switch(config-router)#network 192.168.50.0 0.0.0.255 area 1
Switch(config-router)#network 192.168.60.0 0.0.0.255 area 1
Switch(config-router)#network 192.168.200.0 0.0.0.255 area 1
Switch(config-router)#  

当三台交换机都设置好ospf动态路由后,用以下命令查看(在特权模式下)

SwitchC#show ip route

结果如图

三台三层交换机OSPF多区域划分动态路由实验_第2张图片

三、实验结果

所有的PC间全通。

你可能感兴趣的:(三台三层交换机OSPF多区域划分动态路由实验)