见习网工之VLAN

Vlan简介

虚拟局域网(VLAN)是一组由拥有共同需求且与物理位置无关的终端设备所组成的逻辑分组。通过在交换机上划分vlan,可以实现在同一vlan内的用户二层互访,不同vlan中的用户无法互访,既隔绝了广播域,提升安全性和可靠性,又不影响用户通信。


Vlan配置

在这里插入图片描述
SW核心:
vlan batch 10 20 30

interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan all

interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan all

interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan all

SW1:
vlan 10

interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan all

interface Ethernet0/0/2
port link-type access
port default vlan 10

interface Ethernet0/0/3
port link-type access
port default vlan 10

SW2:
vlan 20
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan all
interface Ethernet0/0/2
port link-type access
port default vlan 20

SW3:
vlan 30
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan all

interface Ethernet0/0/2
port link-type access
port default vlan 30


Vlan通信原理

A、PC无法识别和处理带有vlan标签的报文
B、报文在通过access口时,会去除vlan标签
C、报文只有在trunk链路中才会携带标签
D、报文在交换机内部处理时,必须携带标签


Trunk、Access、Hybrid简介

Access类型端口:只能属于1个VLAN,一般用于连接计算机端口。
Trunk类型端口:可以允许多个VLAN通过,可以接收和发送多个VLAN 报文,一般用于交换机与交换机相关的接口。
Hybrid类型端口:可以允许多个VLAN通过,可以接收和发送多个VLAN 报文,可以用于交换机的间连接也可以用于连接用户计算机。


Vlan间路由

(1) 单臂路由在这里插入图片描述

SW1:
vlan batch 10 20
interface Ethernet0/0/1
port link-type access
port default vlan 10

interface Ethernet0/0/2
port link-type access
port default vlan 20

interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan all

R1:
interface Ethernet0/0/0.1
dot1q termination vid 10
ip address 192.168.10.1 255.255.255.0
arp broadcast enable

interface Ethernet0/0/0.2
dot1q termination vid 20
ip address 192.168.20.1 255.255.255.0
arp broadcast enable


(2) SVI路由

在这里插入图片描述核心左:
interface Vlanif10
ip address 192.168.10.1 255.255.255.0

interface Vlanif20
ip address 192.168.20.1 255.255.255.0

interface Vlanif30
ip address 192.168.30.1 255.255.255.0

核心右:

interface Vlanif20
ip address 192.168.20.1 255.255.255.0

interface Vlanif30
ip address 192.168.30.1 255.255.255.0

所有交换机与交换机相连的端口全部配置为trunk,以便让全部的vlan通过。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值