实验:VLAN之间的路由
方法1: 使用三层交换机
骨干交换机的配置
Switch# conf t
Switch(config)# vlan 10
Switch(config-vlan)# name vlan10
Switch(config-vlan)# exit
Switch(config)# vlan 20
Switch(config-vlan)# name vlan20
Switch(config-vlan)# exit
Switch(config)# interface vlan 10
Switch(config-if)# ip address 192.168.10.1 255.255.255.0 //给vlan 10 配置IP地址
Switch(config-if)# exit
Switch(config)# interface vlan 20
Switch(config-if)# ip address 192.168.20.1 255.255.255.0 //给vlan 20 配置IP地址
Switch(config)# int f0/1
Switch(config-if)# switchport access vlan 10 //把f0/1端口划分到vlan 10 中
Switch(config-if)# exit
Switch(config)# int f0/2
Switch(config-if)# switchport access vlan 20 //把f0/2端口划分到vlan 20 中
Switch(config-if)# exit
在骨干交换机上执行show ip route
Switch# show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.10.0/24 is directly connected, Vlan10
C 192.168.20.0/24 is directly connected, Vlan20