VLAN 间路由的方法
方法一
 
路由器的每个接口对应每个 vlan ,利用路由协议实现 vlan 之间的路由,这种方法受路由器转发能力的限制,且占用大量的路由器端口
方法二
 
利用中继端口( isl 802.1Q )实现多 VLAN 和路由器子接口的模式,实现单臂路由,这种方法转发带宽受中继链路带宽限制
方法三
 
采用集成了路由处理器的交换机( 3 层交换机)完成 VLAN 间路由,这种方法全部采用内部交换链路进行交换,具有速度高,无冲突影响等优点

多层交换机实现 VLAN 间路由
通过使用集成的第 3 层模块或附属卡,可以实现 vlan 间路由的选择,同时可以直接访问背板总线,提高了交换速度。路由器被高度集成到交换机中,使得告诉路由选择特性更容易实现。
下图是相应的路由处理器模块
 
为了实现 VLAN 间的路由,交换机必须使用第 3 层地址来完成。多层交换机支持多种不同类型的第 3 层接口:
1
  路由接口
路由端口是一种物理接口,它类似于传统路有器上配置了第 3 层地址的端口。与接入端口不同的是,路由端口不与特定 VLAN 相关联。路由端口类似于普通的路由器端口,不同之处在与它不能像路由器那样支持子接口。
路由端口用于点对点链路,路由端口的典型应用就是连接 WAN 路由器和安全设备。在多层交换机网络中,路由端口大多数都配置于园区主干子模块中的交换机之间。
配置过程:
1
  进入全局模式   configure terminal
2
  进入接口模式   interface 接口
3
  配置为路由端口
        no switchport
案例:
sw(config)#interface g0/1
sw(config-if)#ip address 192.168.0.1 255.255.255.0
% IP addresses may not be configured on L1 Links
出现错误,因为默认情况下,交换机的接口都是接入模式
sw(config-if)#no switchport
sw(config-if)#ip address 192.168.0.1 255.255.255.0
sw(config-if)#end
案例:
CCIE-LAB(V180)
题目要求:
SW1
SW2 FA0/3 接口与 R3 相连, IP 地址为 YY.YY.13.2/30,YY.YY.31.2/30
配置:
SW1
   Configure terminal
   Interface f0/3
      No switchport
     Ip address 11.11.13.2 255.255.255.252
SW2
   Config termi
   Interface f0/3
      No switchport
      Ip address 11.11.31.2 255.255.255.252
CCIE-LAB(V210)
题目要求:
配置 SW1 FA0/1,FA0/6 SW2 FA0/2,FA0/4,FA0/5 接口的 IP 地址,用于后面的 OSPF 路由所用 ( 具体 IP 地址查看拓扑 )
配置:
SW1
   Config termi
   Interface f0/1
      No switchport
      Ip address 11.11.17.7 255.255.255.0
   Interface f0/6
      No switchport
      Ip address 11.11.67.7 255.255.255.0
SW2
   config termi
   Interface f0/2
      No switchport
      Ip address 11.11.28.8 255.255.255.0
   Interface f0/4
      No switchport
      Ip address 11.11.48.8 255.255.255.0
2
  交换虚拟接口
交换机虚拟接口 (Switch Virtual Interface) 是一种第 3 层接口,它是为在多层交换机上完成 VLAN 间路由选择而配置的接口。 SVI 是一种与 VLAN ID 相关联的虚拟 VLAN 接口,其目的在于启用该 VLAN 上的路由选择能力。
配置过程:
1
  进入全局模式   configure terminal
2
  进入接口模式   interface vlan vlanID
3
  进行第 3 层的配置
          ip address network-address netmask
4
  启用接口
          no shutdown
5
  验证结果
          show running interface vlan

案例:
sw(config)#inteface vlan 10
sw(config-if)#ip address 10.10.1.1 255.0.0.0
sw(config-if)#no shut
sw(config-if)#interface vlan 20
sw(config-if)#ip address 10.20.1.1 255.0.0.0
sw(config-if)#no shut
sw#show running interface vlan 10
sw#show interface vlan 20
案例:
CCIE-LAB(V135)
题目要求:
configure SVI interface for vlan 30 and vlan 50,it is for ospf and EIGRP routing later.
配置:
SW1
   Config termi
   Interface vlan 30
     Ip address 11.11.57.1 255.255.255.0
     No shut
   Interface vlan 50
     Ip address 11.11.37.1 255.255.255.0
     No shut

CCIE-LAB(V142)
题目要求:
SW1
建立 VLANA(vlan2) 端口,地址 142.1.30.7/24 SW1 将参与部分路由
SW2
建立 VLANB(vlan3) 端口,地址 142.1.8.8/24 SW2 不参与路由,但要求在做完 IGP 路由后所有路由器都能访问 Sw1 Sw2 的命令行模式。
配置:
SW1
   Config termi
   Interface vlan 2
     Ip address 142.1.30.7 255.255.255.0
     No shut
  Interface vlan 3
      Ip address 142.1.8.8 255.255.255.0
     No shut
案例:
CCIE-LAB(v148)
题目要求:
Using a switch virtual interface,add Ip address yy.yy.62.8/25 to SW2.Make sure you  do have connectivity to other devices on that network segment.
配置要求:
SW2
Config termin
Interface vlan 62
   Ip address 11.11.62.8 255.255.255.128
   No shut
CCIE-LAB
Vyy
题目要求:
vlan D vlan 14 )启用 SVI IP 地址为 yy.yy.13.7/24
配置:
SW1
   Config ter
   Interface vlan 14
Ip address 11.11.13.7 255.255.255.0
No shut
  
使用交换机虚拟接口实现 VLAN 间路由选择的配置过程:
1
  进入全局模式   config terminal
2
  启用多层交换机的路由功能
        ip routing
3
  选择路由协议,用于 vlan 间的路由 ( 可选)
        router
路由协议
4
  定义 vlan SVI 接口
        interface vlan vlanID
5
  配置第 3 层参数
        ip address
每个 VLAN 的网关地址 掩码
6
  启用接口
         no shut
7
  验证结果
案例:
sw(config)#ip routing
sw(config)#router rip
sw(config-router)#network 192.168.10.0
sw(config-rotuer)#network 192.168.20.0
sw(config)#interface vlan 10
sw(config-if)#ip address 192.168.10.1 255.255.255.0
sw(config-if)#no shut
sw(config-if)#interface vlan 20
sw(config-if)#ip address 192.168.20.1 255.255.255.0
sw(config-if)#no shut

3. 3 Etherchannel 接口

单臂路由
采用单臂路由器的最大优点是节约了交换机和路由器的接口,但可能带来路由器产生过载 每个
vlan
带宽不足或者 IOS 版本过低,导致仅支持 ISL 封装,不支持 dot1q 等情况发生。
单臂路由的配置方法需要路由器支持 Trunk 封装类型,同时还需要路由器支持子接口,并在子接口
上配置各种 3 层路由特性。该接口必须是快速以太口或吉比特接口( >100M
 
配置过程:
路由器部分:
1
  进入全局模式   configure terminal
2
  进入接口模式   interface 接口   (该接口是与交换机相连的 trunk 干道)
3
  主接口中不能配置 ip 地址
no ip address
4
  根据 vlan 的数量建立子接口
interface
接口 . 子接口
5
  设置第 3 层的参数
ip address
对应 vlan 的网关地址 子网掩码
6
  配置链路聚集( trunking )封装和对应的 vlan
encapsulation [dot1q|isl] vlanID
交换机部分:
1
  进入全局模式   configure terminal
2
  进入接口模式   interface 接口   ( 与路由器相连的干道接口 )
3
  配置该接口 trunk 的封装类型
switchport trunk encapsulation [dot1q|isl]
switchport mode trunk
案例:
R1(config)#interface f0/1
R1(config-if)#no ip address
R1(config-if)#no shut
R1(config-if)#interface f0/1.1
R1(config-if)#encapsulation dot1q 10
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#interface f0/1.2
R1(config-if)#encapsulation dot1q 20
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#interface f0/1.3
R1(config-if)#encapsulation dot1q 30
R1(config-if)#ip address 192.168.3.1 255.255.255.0
Sw(config)#interface f0/1
Sw(config-if)#switchport trunk encapsulation dot1q
Sw(config-if)#switchport mode trunk
案例:
CCIE-LAB(V133)
题目要求:
R1
R2 的一个快速以太口,被划到 2 VLAN 中,大家要采用在路由器子接口上封装相应的 VLAN ,并且 TRUNK 模式为 DOT1Q 。相对应交换机的端口为 TURNK ,模式为 dot1Q ,允许相应 VLAN 通过。
 
vlan 10 name vlan bb1
vlan 20 name vlan D
vlan  2 name vlan A
配置:
R1
   Config term
   Interface f0/0
     No ip address
   Interface f0/0.1
     Encapsulation dot1q 10
     Ip address 150.100.1.1 255.255.255.0
   Interface f0/0.2
      Encapsulation dot1q 20
      Ip address 11.11.12.1 255.255.255.0
R2
   Config term
   Interface f0/0
     No ip address
   Interface f0/0.1
     Encapsulation dot1q 20
     Ip address 11.11.12.2 255.255.255.0
   Interface f0/0.2
     Encapsulation dot1q 2
     Ip address 11.11.23.1 255.255.255.0
Sw1
Config terminal
Interface f0/1
   Switchport trunk encapsulation dot1q
   Switchport mode trunk
   Switchport trunk allowed vlan none
   Switchport trunk allowed vlan 10,20
Interface f0/2
   Switchport trunk encap dot1q
   Switchport mode trunk
   Switchport trunk allowed vlan none
   Switchport trunk allowed vlan 2,20

CCIE-LAB(V135)
题目要求:
 
R6
FA0/1 起子接口,封装模式为 DOT1Q ,做单臂路由,只允许相应的 vlan
配置:
R6
Config terminal
Interface f0/1
   No ip address
   No shut
   Interface f0/1.1
      Encapsulation dot1q 13
      Ip address 11.11.68.6 255.255.255.0
   Interface f0/1.2
      Encapsulation dot1q 60
      Ip address 192.2.1.11 255.255.255.0
SW2
Config terminal
Interface f0/6
   Switchport trunk encapsulation dot1q
   Switchport mode trunk
   Switchport trunk allowed vlan none
   Switchport trunk allowed vlan 13,60

CCIE-LAB(YY)
题目要求:
 
R6
fa0/0 使用单臂路由 , 包括两个接口, fa0/0.1 连接 bb1 fa0/0.XX 连接 bb3 ,要限制该有的 vlan
配置:
SW1
config terminal
interface f0/6
   switchport trunk encapsulation dot1q
   switchport mode trunk
   switchport trunk allowed vlan 15,17
R6
config terminal
interface f0/0
   no ip address
   no shut
   inteface f0/0.1
      encapsulation dot1q 15
      ip address 150.1.1.11 255.255.255.0
   interface f0/0.2
      encapsulation dot1q 17
      ip address 192.168.2.11 255.255.255.0