华为 跨交换机相同VLAN间的通信

241阅读 0评论2012-02-16 wfeng
分类:系统运维

实验三 跨相同VLAN间的通信

【实训背景】
你是企业的网管,企业有两个主要部门:财务部和技术部,每个部门的个人计算机系统分散连接, 他们之间需要相互进行通信,但为了数据安全起见,财务部和技术部需要进行相互隔离。
【实训目的】
掌握交换机Tag VLAN的配置,理解相同VLAN主机通讯,不同VLAN主机隔离的特点。
【技术原理】
TagVIan是基于交换机端口的另外一种类型,主要用于实现跨交换机的相同VLAN内主机之间可以直接访问,同时对于不同VLAN的主机进行隔离。 TagVIan遵循了IEEE802.1q 协议的标准。在利用配置了Tag vIan的接口进行数据传输时,需要在数据帧内添加4个字节的802.1q标签信息,用于标识该数据帧属于哪个VLAN,以便于对端交换机接收到数据帧后 进行准确的过滤。
【实训内容】
1. 根据拓扑将主机和交换机进行连接
2. 测试主机之间可以相互ping通
3. 配置交换机Port VLAN
4. 配置Trunk接口
5. 测试
【实现功能】
使在同一VLAN里的计算机系统能跨交换机进行相互通信,而在不同VLAN里的计算机系统不能进行相互通信。
【实训设备】
S3100(2台),PC(4台)、直连线(5条)
【实训拓扑】
 

实验时,按照拓扑图进行网络的连接,注意主机和交换机连接的端口。

设备型号

实训名称

IP地址/掩码

网关

端口连接情况

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

【主要命令】
port link-type, nudo port link-type,display
【实训步骤】
1、在交换机 SwitchA 上创建 10,并将 0/10 端口划分到 10 中。
system-view !进入全局配置模式。
[H3C]sysname SwitchA
[SwitchA] vlan 10 !创建 Vlan 10。
[SwitchA-VLAN10] name caiwu !将 Vlan 10 命名为 caiwu。
[SwitchA-VLAN10] port F0/10
!//将 F0/10 端口划分到 Vlan 10。
[SwitchA]quit
验证测试:验证已创建了 Vlan 10,并将 0/0/10 端口已划分到 Vlan 10 中。
SwitchA#display vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 caiwu active Fa0/10
2、在交换机 SwitchA 上创建 Vlan 20,并将 0/0/15端口划分到 Vlan 20 中。
system-view l
[SwitchA] vlan 20 !创建 Vlan 20。
[SwitchA-vlan 20] name jishu !将 Vlan 20 命名为 jishu。
[SwitchA-vlan 20] port F0/15
!//将 F0/15 端口划分到 Vlan 20。
[SwitchA-vlan 20]quit

验证测试:验证已创建了Vlan 20,并将 f0/15 端口已划分到Vlan 20 中。
SwitchA#display vlan

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
20 jishu active Fa0/15

3、在交换机 SwitchB 上创建 Vlan 10,并将 0/0/10 端口划分到 Vlan 10 中。
system-view !进入全局配置模式。
[H3C]sysname SwitchB
[SwitchB] vlan 10 !创建 Vlan 10。
[SwitchB-vlan10] name caiwu !将 Vlan 10 命名为 caiwu。
[SwitchB-vlan10] port F0/10
!//将 F0/10 端口划分到 Vlan 10。
[SwitchB-vlan10]quit
验证测试:验证已创建了 Vlan 10,并将 0/0/10 端口已划分到 Vlan 10 中。
SwitchB#display vlan id 10

VLAN Name Status Ports
---- ------------------------ --------- -------------------------------
10 caiwu active Fa0/10

4、在交换机 SwitchB 上创建 Vlan 20,并将 0/15端口划分到 Vlan 20 中。
system-view
[SwitchB] vlan 20 !创建 Vlan 20。
[SwitchB-vlan20] name jishu !将 Vlan 20 命名为 jishu。
[SwitchB-vlan20] port F0/15
!//将 F0/15 端口划分到 Vlan 20。
SwitchB(config- vlan)#end
验证测试:验证已创建了Vlan 20,并将 f0/0/15 端口已划分到Vlan 20 中。
SwitchB#display vlan id 20

VLAN Name Status Ports
---- ------------------------ --------- -------------------------------
20 jishu active Fa0/15

5、在交换机 SwitchA 上将与 SwitchB 相连的端口(假设为 0/1 端口)定义为 tag vlan模式。
system-view
[SwitchA]interface F0/1 !进入接口配置模式。
[SwitchA- ethernet0/0/1] port link-type trunk !将 Ethernet 0/1 端口设为 tag vlan 模式。
[SwitchA- ethernet0/0/1] port trunk permit vlan ALL
[SwitchA- ethernet0/0/1]quit

验证测试:验证 thernet 0/0/1 端口已被设置为tag vlan 模式。
SwitchA#display interfaces Ethernet 0/1
Interface Switchport Mode Access Native Protected VLAN lists
---------- ---------- --------- ------- -------- --------- --------------------
Fa0/1 Enabled Trunk 1 1 Disabled All

6、在交换机 SwitchB 上将与 SwitchA 相连的端口(假设为 0/1 端口)定义为 tag vlan模式。
system-view
[SwitchB]interface Ethernet 0/0/1 !进入接口配置模式。
[SwitchB-ethernet0/0/1]port link-type trunk !将 ethernet 0/0/1 端口设为 tag vlan 模式。
[SwitchB-ethernet0/0/1]quit

验证测试:验证 Ethernet 0/0/1 端口已被设置为tag vlan模式。
SwitchB#display interfaces Ethernet 0/0/1 switchport
Interface Switchport Mode Access Native Protected VLAN lists
---------- ---------- --------- ------- -------- --------- --------------------
Fa0/1 Enabled Trunk 1 1 Disabled All

验证: PC1 与 PC3 能互相通信,PC2 与 PC4能互相通信。
但PC1 与 PC4 不能互相通信, PC2 与 PC3 不能互相通信。

C:\>ping 192.168.10.2 ! PC4与PC2能互相通信。

Pinging 192.168.10.2 with 32 bytes of data:

Reply from 192.168.10.2: bytes=32 time<1ms TTL=128
Reply from 192.168.10.2: bytes=32 time<1ms TTL=128
Reply from 192.168.10.2: bytes=32 time<1ms TTL=128
Reply from 192.168.10.2: bytes=32 time<1ms TTL=128

Ping statistics for 192.168.10.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\>ping 192.168.10.3 !在 PC1 的命令行方式下验证能 Ping 通 PC3 。
Pinging 192.168.10.30 with 32 bytes of data:

Reply from 192.168.10.3: bytes=32 time
Reply from 192.168.10.3: bytes=32 time
Reply from 192.168.10.3: bytes=32 time
Reply from 192.168.10.3: bytes=32 time

Ping statistics for 192.168.10.3:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\>ping 192.168.10.3 !在 PC2 的命令行方式下验证不能 Ping 通 PC3 。
Pinging 192.168.10.3 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.10.3:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

C:\>ping 192.168.10.1 !pc4与pc1不能互相通信

Pinging 192.168.10.1 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.10.1:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

【注意事项】
1、两台交换机之间相连的端口应该设置为 tag vlan 模式。
2、Trunk接口在默认情况下支持所有vlan的传输
【参考配置】
1、SwitchA配置
[SwitchA]display current-configuration

System software version : 1.66(3) Build Sep 7 2006 Rel

Building configuration...
Current configuration : 459 bytes
!
version 1.0
!
hostname SwitchA
vlan 1
!
vlan 10
name caiwu
!
vlan 20
name jishu
!
enable secret level 1 5 $2>H.Y*T3;C,tZ[V4 enable secret level 14 5 'Ttj9=G13U7R:>H.4^u_;C,t54U0 enable secret level 15 5 $2;C,tZ[30H.Y*T
!
interface Ethernet 0/1
switchport mode trunk
!
interface Ethernet 0/10
switchport access vlan 10
!
interface Ethernet 0/15
switchport access vlan 20
!
end
2、SwitchB配置
[SwitchB]display current-configration

System software version : 1.66(3) Build Sep 7 2006 Rel

Building configuration...
Current configuration : 459 bytes
!
version 1.0
!
hostname SwitchB
vlan 1
!
vlan 10
name caiwu
!
vlan 20
name jishu
!
enable secret level 1 5 $2>H.Y*T3;C,tZ[V4 enable secret level 14 5 'Ttj9=G13U7R:>H.4^u_;C,t54U0 enable secret level 15 5 $2;C,tZ[30H.Y*T
!
interface Ethernet 0/1
switchport mode trunk
!
interface Ethernet 0/10
switchport access vlan 10
!
interface Ethernet 0/15
switchport access vlan 20
!
end



CCIE Security 2009 IOS防火墙合集


上一篇:华为 AR路由器 两种ACL匹配规则的介绍
下一篇:华为 MSR 路由器 根据包大小策略路由的配置