NA-NP-IE系列实验51: 三层交换实现VLAN 间路由

实验51: 三层交换实现VLAN 间路由
1. 实验目的
通过本实验,读者可以掌握如下技能:
1) 理解三层交换的概念
2) 配置三层交换
2. 实验拓扑
拓扑图
NA-NP-IE系列实验51: 三层交换实现VLAN 间路由
3. 实验步骤
注:用SW1 来实现分别处于VLAN1 VLAN2 PC0 PC1 间的通信。
要在三层交换机上启用路由功能,还需要启用CEF(命令为:ip cef),不过这是
默认值。和路由器一样,三层交换机上同样可以运行路由协议
 
 
 
sw1#vlan da
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.
 
sw1(vlan)#vlan 2 name cisco
VLAN 2 added:
    Name: cisco
sw1(vlan)#exit
APPLY completed.
Exiting....
sw1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
sw1(config)#int vlan  1
sw1(config-if)#ip add 172.16.1.1 255.255.255.0//vlan 接口上配置IP 地址即可,VLAN 1 接口上的地址就是PC0 的网关了,VLAN 2 接口上的地址就是PC1的网关了。
 
sw1(config-if)#no sh
 
%LINK-5-CHANGED: Interface Vlan1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
sw1(config-if)#
sw1(config-if)#exit
sw1(config)#int vlan 2
 
%LINK-5-CHANGED: Interface Vlan2, changed state to upsw1(config-if)#
sw1(config-if)#ip add 172.16.2.1 255.255.255.0
sw1(config-if)#no sh
sw1(config-if)#exit
sw1(config)#int f0/2
sw1(config-if)#switch mode access
sw1(config-if)#switch access vlan 2
 
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to upsw1(config-if)#
sw1(config-if)#exit
sw1(config)#ip routing//以上开启SW1 的路由功能,这时SW1 就启用了三层功能。
sw1(config)#
sw1(config)#do sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
 
Gateway of last resort is not set
 
     172.16.0.0/24 is subnetted, 2 subnets
C       172.16.1.0 is directly connected, Vlan1
C       172.16.2.0 is directly connected, Vlan2
//和路由器一样,三层交换机上也有路由表。
 
 
PC0:
PC>ipconfig
 
IP Address......................: 172.16.1.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 172.16.1.1
 
PC>ping 172.16.2.2
 
Pinging 172.16.2.2 with 32 bytes of data:
 
Reply from 172.16.2.2: bytes=32 time=109ms TTL=127
Reply from 172.16.2.2: bytes=32 time=62ms TTL=127
Reply from 172.16.2.2: bytes=32 time=63ms TTL=127
Reply from 172.16.2.2: bytes=32 time=63ms TTL=127
 
Ping statistics for 172.16.2.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 62ms, Maximum = 109ms, Average = 74ms
 
PC>
 
 
PC1:
PC>ipconfig
 
IP Address......................: 172.16.2.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 172.16.2.1
 
PC>ping 172.16.1.2
 
Pinging 172.16.1.2 with 32 bytes of data:
 
Reply from 172.16.1.2: bytes=32 time=62ms TTL=127
Reply from 172.16.1.2: bytes=32 time=62ms TTL=127
Reply from 172.16.1.2: bytes=32 time=62ms TTL=127
Reply from 172.16.1.2: bytes=32 time=62ms TTL=127
 
Ping statistics for 172.16.1.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 62ms, Maximum = 62ms, Average = 62ms
 
PC>


本文转自gauyanm 51CTO博客,原文链接:http://blog.51cto.com/gauyanm/245116,如需转载请自行联系原作者
上一篇:三层交换机实现vlan通信和rip路由


下一篇:Python:Flask-UUID 注册一个uuid的url转换器