实验三 以太网VLAN配置实验
一、VLAN的基本配置
1 组网及业务描述
E0/1 E 0/1 E 0/8 E0/9 E0/9 E0/17 E0/16 PCA VLAN2 PCB VLAN2 PCC VLAN3 PCD VLAN3
本实验的主要目的是掌握VLAN的基本配置。在同一交换机内,要求能够达到同一VLAN内的PC可以互通,不同VLAN间的PC不能互通。
2 命令行列表 操 作 创建VLAN 删除VLAN VLAN视图下配置一个或一组端口属于某个VLAN 接口视图下配置该端口属于某个VLAN 命 令 vlan vlan-id [ alias vlan-alias ] undo vlan vlan-id [ |all] port interface-type { interface-num [ to interface-num ] } & <1-10> port access vlan vlan-id 3 配置流程图
开 始 配置各PC的IP地址 配置VLAN及所属接口 4 配置步骤
(1)配置各PC的IP地址
按照上图连接各实验设备,配置PCA IP地址为10.1.1.2/24,PCB IP地址为10.1.1.3/24,PCC IP地址为10.1.2.2/24,PCD IP地址为10.1.2.3/24。
(2)配置VLAN及所属端口 创建两个VLAN:VLAN 2和VLAN 3,配置端口Ethernet 0/1到Ethernet0/8属于VLAN2,
端口Ethernet0/9到Ethernet0/16属于VLAN3。 5 结果验证
同一VLAN内部的PC可以互相访问,在PCA上ping PCB,结果如下: C:\\Documents and Settings\\x99270>ping 10.1.1.3 Pinging 10.1.1.3 with 32 bytes of data:
Reply from 10.1.1.3: bytes=32 time<1ms TTL=128 Reply from 10.1.1.3: bytes=32 time<1ms TTL=128 Reply from 10.1.1.3: bytes=32 time<1ms TTL=128 Reply from 10.1.1.3: bytes=32 time<1ms TTL=128 Ping statistics for 10.1.1.3:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
PCC与PCD属于同一个VLAN 3,在PCC上ping PCD,可以ping通,结果如下: C:\\Documents and Settings\\x99270>ping 10.1.2.3 Pinging 10.1.2.3 with 32 bytes of data:
Reply from 10.1.2.3: bytes=32 time<1ms TTL=128 Reply from 10.1.2.3: bytes=32 time<1ms TTL=128 Reply from 10.1.2.3: bytes=32 time<1ms TTL=128 Reply from 10.1.2.3: bytes=32 time<1ms TTL=128
Ping statistics for 10.1.2.3:
Packets: Sent = 4, Received = 4, Lost = 0 (0 Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
不同VLAN间的PC不能够互相访问。在PCA上ping PCC,不能ping通,结果如下: C:\\Documents and Settings\\x99270>ping 10.1.2.3 Pinging 10.1.2.3 with 32 bytes of data: Destination host unreachable. Destination host unreachable. Destination host unreachable. Destination host unreachable. Ping statistics for 10.1.2.3:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), 6 配置参考
在交换机上做如下配置:
Enter system view , return user view with Ctrl+Z. [Quidway]sysname Switch [Switch]vlan 2
[Switch-vlan2]port Ethernet 0/1 to Ethernet 0/8 [Switch]vlan 3
[Switch-vlan3]port Ethernet 0/9 to Ethernet 0/16
二、Trunk的基本配置
1 组网及业务描述
E 0/17 E0/17 E0/1 E0/9 E 0/1 E 0/9 PCA VLAN2 2 命令行列表 操 作 PCB VLAN3 PCC VLAN2 PCD VLAN3 命 令 port link-type { trunk/access/hybrid} undo port link-type { trunk/access/hybrid} [undo] port trunk permit vlan { {vlan-id [ to vlan-id ]}&<1-10> | all } display vlan vlan-id [/all] 指定端口类型:trunk, access, hybrid 取消端口类型的设置 设置Trunk端口可以通过的VLAN 显示VLAN的信息 3 配置流程图
开 始 配置各PC的IP地址 配置VLAN及所属接口 配置Trunk端口属性 4 配置步骤
配置各PC的IP地址
首先按照上图连接各实验设备,然后配置PCA IP地址为10.1.1.2/24,PCB IP地址为10.1.2.2/24,PCC IP地址为10.1.1.3/24,PCD IP地址为10.1.2.3/24。
配置VLAN及所属端口 创建两个VLAN:VLAN 2和VLAN 3,配置端口Ethernet 0/1到Ethernet0/8属于VLAN2,端口Ethernet0/9到Ethernet0/16属于VLAN3。
配置交换机之间的端口为Trunk端口,并且允许所能通过的VLAN 指定端口Ethernet0/17为Trunk端口,并允许所有VLAN可以通过。
5 结果验证
配置完成后,可以看到,同一VLAN内部的PC可以互相访问,在PCA上ping PCC,结果如下:
C:\\Documents and Settings\\x99270>ping 10.1.1.3 Pinging 10.1.1.3 with 32 bytes of data:
Reply from 10.1.1.3: bytes=32 time<1ms TTL=128 Reply from 10.1.1.3: bytes=32 time<1ms TTL=128 Reply from 10.1.1.3: bytes=32 time<1ms TTL=128 Reply from 10.1.1.3: bytes=32 time<1ms TTL=128 Ping statistics for 10.1.1.3:
Packets: Sent = 4, Received = 4, Lost = 0 (0 Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms 同样,在PCB上ping PCD也可以ping通。
不同VLAN间的PC不能够互相访问,在PCA上ping PCD,得到的结果如下: C:\\Documents and Settings\\x99270>ping 10.1.2.3 Pinging 10.1.2.3 with 32 bytes of data: Destination host unreachable. Destination host unreachable. Destination host unreachable. Destination host unreachable. Ping statistics for 10.1.2.3:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), 6 配置参考
(1)配置VLAN及所属端口 配置Switch A: [Switch A]vlan 2
[Switch A-vlan2]port ethernet 0/1 to ethernet 0/8 [Switch A]vlan 3
[Switch A-vlan3]port Ethernet 0/9 to Ethernet 0/16 配置Switch AB: [Switch B]vlan 2
[Switch B-vlan2]port Ethernet 0/1 to Ethernet 0/8 [Switch B]vlan 3
[Switch B-vlan3]port Ethernet 0/9 to Ethernet 0/16 (2)配置Trunk端口 配置Switch A:
[Switch A] interface Ethernet 0/17
[Switch A-Ethernet0/17] port link-type trunk
[Switch A-Ethernet0/17] port trunk permit vlan all //允许所有VLAN通过Trunk端口 配置Switch B:
[Switch B] interface Ethernet 0/17
[Switch B-Ethernet0/17] port link-type trunk
[Switch B-Ethernet0/17] port trunk permit vlan all //允许所有VLAN通过Trunk端口