VLAN 路由实验图解(交换机为cisco1900系列)
注:
PC1:192.168.1.2 255.255.255.0
PC2:192.168.2.2 255.255.255.0
PC3:192.168.1.3 255.255.255.0
PC4:192.168.2.3 255.255.255.0
Fa0/0.1:192.168.1.1 255.255.255.0
Fa0/0.2:192.168.2.1 255.255.255.0
配置VLAN路由应该注意:
路由器必须是Cisco2620以上版本,支持快速以太网接口和VLAN路由模块;
配置时路由器的子端口必须和一个VLAN相对应;
配置交换机时要开启干道传输。
配置:
Router1>
Router1>en
Router1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#int fa0/0
Router1(config-if)#no shutdown
%LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
Router1(config-if)#exit
Router1(config)#int fa0/0.1
Router1(config-subif)#ip address 192.168.1.1 255.255.255.0
Router1(config-subif)#encapsulation isl 2
Router1(config-subif)#exit
Router1(config)#int fa0/0.2
Router1(config-subif)#ip address 192.168.2.1 255.255.255.0
Router1(config-subif)#encapsulation isl 3
Router1(config-subif)#exit
Switch1>en
#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch1 (config)#hostname Vlanserver
Vlanserver(config)#vlan 2 name vlan2
Vlanserver(config)#vlan 3 name vlan3
Vlanserver(config)#int e0/1
Vlanserver(config-if)#vlan-membership static 2
Vlanserver(config-if)#exit
Vlanserver(config)#int e0/2
Vlanserver(config-if)#vlan-membership static 3
Vlanserver(config-if)#exit
Vlanserver(config)#int fa0/26
Vlanserver(config-if)#trunk on
Vlanserver(config-if)#exit
Vlanserver(config)#int fa0/27
Vlanserver(config-if)#trunk on
Vlanserver(config-if)#exit
Switch2>en
Switch2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
(config)#hostname Vlanclient
Vlanclient(config)#vtp client
Vlanclient(config)#int e0/1
Vlanclient(config-if)#vlan-membership static 2
Vlanclient(config-if)#exit
Vlanclient(config)#int e0/2
Vlanclient(config-if)#vlan-membership static 3
Vlanclient(config-if)#exit
Vlanclient(config)#int fa0/27
Vlanclient(config-if)#trunk on
Vlanclient(config-if)#exit