QCNA学习笔记-VLAN间路由的解决方案

 VLAN隔离广播的同时,也禁止了不同VLAN之间的用户通信,VLAN间的通信成为了新的焦点,VLAN路由(三层路由功能)成功解决了VLAN间的通信。

VLAN间路由必须通过具备三层路由功能的设备完成

解决方案:

  1. 路由器的单臂路由(不推荐)
  2. 3层交换机VLAN接口/交换机虚拟接口(推荐)
  3. 不具备拓展功能的交换机的三层接口功能
  4. 路由器的多臂路由(不推荐)

单臂路由

优点:节省端口数和设备接口

缺点:链路复用,单点故障的同时易引发拥塞

路由器的子接口(逻辑接口)可以识别VLAN TAG

思科华为配置单臂路由

步骤1.交换机连接终端的VLAN的接入
SW4(config)#vlan 20,30
SW4(config)#int e0/1
SW4(config-if)#switchport mode access  
SW4(config-if)#switchport access vlan 20
SW4(config-if)#int e0/2
SW4(config-if)#switchport mo acc
SW4(config-if)# switchport access vlan 30
验证:
SW4#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Et0/0, Et0/3
20   VLAN0020                         active    Et0/1
30   VLAN0030                         active    Et0/2
步骤2.连接路由器接口实施trunk
SW4(config)#int e0/0
SW4(config-if)#switchport trunk encapsulation dot1q 
SW4(config-if)#switchport mode trunk 
验证:
SW4#show int trunk

Port        Mode             Encapsulation  Status        Native vlan
Et0/0       on               802.1q         trunking      1
步骤3.实施路由器的子接口
子接口依附于物理接口
R3(config)#int e0/0
R3(config-if)#no sh //开启物理接口
!
interface Ethernet0/0.20
 encapsulation dot1Q 20 //必须先配置封装VLAN 标记的命令,才可以配置地址
 ip address 10.1.20.30 255.255.255.224
!
interface Ethernet0/0.30
 encapsulation dot1Q 30
 ip address 10.1.30.30 255.255.255.224
R3#show ip route 
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C        10.1.20.0/27 is directly connected, Ethernet0/0.20
L        10.1.20.30/32 is directly connected, Ethernet0/0.20
C        10.1.30.0/27 is directly connected, Ethernet0/0.30
终端的配置和测试(思科)
路由器模拟PC的配置:
PC3(config)#no ip routing
PC3(config)#ip default-gateway 10.1.20.30
PC3(config)#int e0/0
PC3(config-if)#no sh
PC3(config-if)#ip address 10.1.20.1 255.255.255.224
测试:
Server2#ping 10.1.30.30
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.30.30, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/203/1012 ms
Server2#ping 10.1.20.30
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.20.30, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
Server2#ping 10.1.20.1 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.20.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
Server2#traceroute 10.1.20.1 numeric 
Type escape sequence to abort.
Tracing the route to 10.1.20.1
VRF info: (vrf in name/id, vrf out name/id)
  1 10.1.30.30 1 msec 0 msec 1 msec
  2 10.1.20.1 1 msec *  2 msec
============================
HW的单臂路由
步骤1.交换机连接终端的VLAN的接入
[SW4]vlan batch 20 30
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 20
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 30
验证:
[SW4-GigabitEthernet0/0/2]dis port vlan ac
T=TAG U=UNTAG
---------------------------------------------------------------
Port                Link Type    PVID    VLAN List
---------------------------------------------------------------
GE0/0/1             access       20      U: 20
GE0/0/2             access       30      U: 30

步骤2.连接路由器接口实施trunk
interface GigabitEthernet0/0/10
 port link-type trunk
 port trunk allow-pass vlan 20 30

GE0/0/10            trunk        1       U: 1
                                         T: 20 30

步骤3.实施路由器的子接口
interface GigabitEthernet0/0/0.20
 dot1q termination vid 20
 ip address 10.1.20.30 255.255.255.224 
 arp broadcast enable
#
interface GigabitEthernet0/0/0.30
 dot1q termination vid 30
 ip address 10.1.30.30 255.255.255.224 
 arp broadcast enable
介绍一个基础协议,ARP(地址解析协议),2层封装协议,和直连通信有关。需要封装目的IP(网关IP对应的MAC)对应的MAC地址

3层交换机VLAN接口/交换机虚拟接口

 三层交换机内置的三层路由转发引擎执行路由功能

多层交换机的VLAN接口的直连路由

interface Vlanif8
 ip address 10.1.10.13 255.255.255.240
#
interface Vlanif9
 ip address 10.1.10.28 255.255.255.240
#
interface Vlanif10
 ip address 10.1.10.45 255.255.255.240
<SW2>display ip int brief 
        down      
Vlanif8                           10.1.10.12/28        up         up        
Vlanif9                           10.1.10.29/28        up         up        
Vlanif10                          10.1.10.44/28        up         up   
!
interface Vlan8
 ip address 10.1.10.12 255.255.255.240 
 no shut
!
interface Vlan9
 ip address 10.1.10.29 255.255.255.240
  no shut
!
interface Vlan10
 ip address 10.1.10.44 255.255.255.240
 no shut
-------------------------
多层交换机上2层接口转换为3层接口
Cisco:
SW2(config-if)#no switchport 
SW2(config-if)#ip address 10.1.12.2 255.255.255.248
HW:
interface GigabitEthernet0/0/2
 undo portswitch //HW的默认器存在问题

接口的工作状态和如下因素有关:VLAN(是否存在)、Trunk(是否允许通过)、Access(是否划分接口)、开启接口

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值