GNS3实验三层交换实现VLAN间通信
图片如下:
环境:GNS3 1.5.2
思路与步骤:
一、三层交换机
打开trunk,配置VLAN;
给vlan配置IP地址;
en
conf t
int f0/0
swit trunk enca dot1q
swit mode trunk
end
vlan data
vtp doamin hello
vtp pass 123
vtp server
vlan 10
vlan 20
exit
conf t
int vlan 10
ip add 192.168.10.254 255.255.255.0
int vlan 20
ip add 192.168.20.254 255.255.255.0
二、二层交换机
上层接口打开trunk;
配置vtp(以同步vlan);
将两台主机划分到不同的vlan;
conf t
int f0/0
swit trunk enca dot1q
swit mode trunk
end
vlan data
vtp domain hello(与上面三层交换机一致)
vtp pass 123(与上面三层交换机一致)
vtp cli
exit
conf t
int f0/1
swit mode acce
swit acce vlan 10
int f0/2
swit mode acce
swit acce vlan 20
end
三、主机
conf t
no ip routing
int f0/0
no shut
ip add 192.168.10.1 255.255.255.0
exit
ip default-gateway 192.168.10.254
conf t
no ip routing
int f0/0
no shut
ip add 192.168.20.1 255.255.255.0
exit
ip default-gateway 192.168.20.254
exit
测试主机R3是否可以与网关,主机R4通信
R3 ping 192.168.10.254
R3 ping 192.168.20.1
可通过下面的命令检验结果排错
- show ip int bri 查看接口情况,IP
- show ip route 查看默认网关
- show vlan-swit 查看vlan情况
- show int trunk 查看trunk情况
***需注意的小地方***
- 1、主机、三层交换机接口需打开;
- 2、主机接口关闭route功能;
- 3、三层交换机与二层交换机配置trunk时需定义封装模式如下:
swit trunk encapsulation qot1q
swit mode trunk