路由交换笔记(三十一)--三层交换

假设校园网通过一台三层交换机连到校园网出口路由器,路由器再和校园外的另一台路由器连接, 拓扑结构如下图。 现要求使用OSPF路由协议做适当配置,实现校园网内部主机与校园网外部主机的相互通信。
说明:
1)路由器分别命名为R1R2,路由器之间通过串口采用V35 DCE/DTE电缆连接,DCE端连接到R1上。S3550交换机命名为S3550,其上划分有VLAN10VLAN50VLAN10用于连接R1VLAN50用于连接校园网主机。
    2PC1IP地址和缺省网关分别为172.16.5.11172.16.5.1PC2IP地址和缺省网关分别为172.16.3.22172.16.3.1,网络掩码都是255.255.255.0
  路由交换笔记(三十一)--三层交换_第1张图片
   
  【步骤 1 】基本配置
三层交换机基本配置
Switch#config terminal
Switch(config)hostname S3550
S3550(config)#vlan 10
S3550(config-vlan)#exit
S3550(config)#vlan 50
S3550(config-vlan)#exit
 
S3550(config)#interface f0/1
S3550(config-if)#switchport access vlan 10
 
S3550(config-vlan)#exit
S3550(config)#interface f0/5
S3550(config-if)#switchport access vlan 50
 
S3550(config-vlan)#exit
S3550(config)#interface vlan 10
S3550(config-if)#ip address 172.16.1.2 255.255.255.0
 
S3550(config-if)#no shutdown
S3550(config-if)#exit
S3550(config)#interface vlan 50
S3550(config-if)#ip address 172.16.5.1 255.255.255.0
 
S3550(config-if)#no shutdown
S3550(config-if)#exit
 
验证测试:
S3550#show vlan
 
 
 
路由器基本配置
R1:
Router>en
Router# config terminal
Router(config)#hostname R1
R1(config)#interface  f1/0
R1(config-if)#ip address 172.16.1.1 255.255.255.0
R1 (config-if)#no shutdown
R1 (config-if)# exit
R1(config)#interface  s1/2
R1(config-if)#ip address 172.16.2.1 255.255.255.0
R1(config-if)#clock rate 64000
R1 (config-if)#no shutdown
 
R2:
Router>en
Router# config terminal
Router(config)#hostname R2
R2(config)#interface  f1/0
R2(config-if)#ip address 172.16.3.1 255.255.255.0
R2 (config-if)#no shutdown
R2 (config-if)# exit
R2(config)#interface  s1/2
R2(config-if)#ip address 172.16.2.2 255.255.255.0
R2 (config-if)#no shutdown
验证测试:
R1#show ip interface brief
R2#show ip interface brief
 
【步骤 2 】配置 OSPF 路由协议
S3550 配置 OSPF 路由协议
S3550(config)#router ospf
S3550(config-router)#network 172.16.1.0 0.0.0 .255 area 0
S3550(config-router)#network 172.16.5.0 0.0.0 .255 area 0
S3550(config-router)#end
 
R1 配置 OSPF 路由协议
R1(config)#router ospf
R1(config-router)#network 172.16.1.0  0.0.0 .255 area 0
R1(config-router)#network 172.16.2.0  0.0.0 .255 area 0
R1(config-router)#end
 
R2 配置 OSPF 路由协议
R2(config)#router ospf
R2(config-router)#network 172.16.2.0  0.0.0 .255 area 0
R2(config-router)#network 172.16.3.0  0.0.0 .255 area 0
R2(config-router)#end
 
【步骤 3 】验证三台路由设备的路由表,查看是否自动学习了其他网段的路由信息
S3550#show ip route
R1# show ip route
R2# show ip route
【步骤 4 】测试网络的连通性
验证 PC1 PC2 能互相通信
   C:\>ping 172.16.3.22        PC1 ping PC2 

你可能感兴趣的:(职场,休闲,三层交换)