是一个最简单的vlan的模型实验
实验采用GNS3模拟。
如图:
PC1:192.168.1.1/24
PC2:192.168.2.1/24
PC3:192.168.2.2/24
PC1属于vlan10,PC2、PC3属于vlan20
第一步:基本配置:
VPC:
VPCS 1 >ip 192.168.1.1 24
VPCS 2 >ip 192.168.2.1 24
VPCS 3 >ip 192.168.2.2 24
SW:
int f1/1
switchport mode access
switchport access vlan10
int ran f1/2 -3
switchport mode access
switchport access vlan20
验证:
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa1/0, Fa1/4, Fa1/5, Fa1/6
Fa1/7, Fa1/8, Fa1/9, Fa1/10
Fa1/11, Fa1/12, Fa1/13, Fa1/14
Fa1/15
10 VLAN0010 active Fa1/1
20 VLAN0020 active Fa1/2, Fa1/3
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
PC2 ping PC3 !!!!!
PC1 ping PC2和PC3 .....
第二步:不同网段的vlan互通
修改VPC的配置:
VPCS 1 >ip 192.168.1.1 192.168.1.100 24
PC1 : 192.168.1.1 255.255.255.0 gateway 192.168.1.100
VPCS 2 >ip 192.168.2.1 192.168.2.100 24
PC2 : 192.168.2.1 255.255.255.0 gateway 192.168.2.100
VPCS 3 >ip 192.168.2.2 192.168.2.100 24
PC3 : 192.168.2.2 255.255.255.0 gateway 192.168.2.100
关键点:要加网关
SW:
int vlan 10
ip add 192.168.1.100 255.255.255.0
int vlan 20
ip add 192.168.2.100 255.255.255.0
验证:
PC1 ping PC2, PC3 !!!!!
PC2 ping PC1, PC3 !!!!!
不同网段可以互相ping通。