实验拓扑:
实验内容:
一、如图,自己设计IP方案。
二、在交换机上划分vlan。
三、在网关GW上进行配置,使vlan10和vlan20能进行通信。(单臂路由技术)
一、 IP配置过程省略,请读者自行设计并配置。
二、 交换机上vlan的配置
SW1(config)#int f0/1
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10
SW1(config)#int f0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 20
SW1(config)#int f0/0
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk native vlan 10
在SW2上的配置也基本上是相同的(注:如果在小凡上模拟,SW2和GW之间不要有配置native vlan,否则会造成它们之间无法通信)
若是用小凡模拟请参看我的另一篇文章小凡中交换机的使用
配置完之后可以用show vlan [brief]和show int access/trunk等命令查看已有配置,以检查配置是否正确。
注:此时vlan10和vlan20之间是无法通信的
三、 单臂路由配置
GW(config)#int e0/0.10
GW(config-subif)#encapsulation dot1q 10
GW(config-subif)#ip add 10.0.1.254 255.255.255.0
GW(config)#int e0/0.20
GW(config-subif)#encapsulation dot1q 20
GW(config-subif)#ip add 10.0.2.254 255.255.255.0
经路由器GW转发数据之后,vlan10和vlan20间可以进行通信。
转载于:https://blog.51cto.com/itjong/538334