Configure virtual domains for an 802.1q VLAN trunk

本文档介绍如何在802.1q VLAN Trunk环境中配置透明模式下的FortiGate防火墙,通过虚拟域提供AV/IPS保护。具体包括Cisco设备配置及故障排除方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Introduction
This document describes how to configure virtual domains in Transparent mode to provide AV/IPS protection in an 802.1q VLAN trunk environment.
In a typical 802.1q VLAN trunk environment, the ports that connect the switch and the router are configured in trunk mode. All VLAN traffic passes through one physical cable.
In the Network Diagram below, traffic between the PC and the server is in VLAN 1 while voice traffic is in VLAN 2. Each VLAN is a single layer 2 broadcast domain, and no traffic can be forwarded to another VLAN. However, each VLAN is able to reach the router via the switch and router's trunk interface. A FortiGate-300 firewall in Transparent mode is inserted into the trunk to perform policy control and AV/IPS protection.

Products
·          Cisco Call Manager Express
·          Cisco2611XM
·          Cisco 7910SW IP phones
·          Cisco Cat 3550 Switch with voice VLAN feature

Prerequisites
The configuration is based on the following assumptions
·          Cisco Call Manager Express and the DHCP server are in one  Cisco2611XM.
·          The server and the PC are in Native VLAN 1.
·          The Cisco IP phones are in Voice VLAN 2.
·          Cisco Cat 3550 Switch has the voice VLAN feature

Configurations
Cisco Cat 3550 configuration
interface FastEthernet0/1
 switchport trunk encapsulation dot1q
 switchport mode trunk
interface FastEthernet0/2
 switchport voice VLAN 2
interface FastEthernet0/3
 switchport voice VLAN 2
interface FastEthernet0/13
 switchport voice VLAN 2
 
Cisco Router configuration
interface FastEthernet0/0
!
interface FastEthernet0/0.1
 encapsulation dot1Q 1 native
 ip address 10.11.14.1 255.255.255.0
 ip helper-address 10.202.1.15
interface FastEthernet0/0.2
 encapsulation dot1Q 2
 ip address 10.11.15.1 255.255.255.0
 ip helper-address 10.202.1.15
!
interface FastEthernet0/1
 ip address 10.202.1.1 255.255.255.0
Firewall FortiGate-300 configuration
The FortiGate-300 is configured into two VDOMs: root and Voice. The internal and external interfaces are in the root VDOM. The vlan2-internal and vlan2-external interfaces are in the Voice VDOM. VDOM root is used for data traffic while VDOM Voice is used for voice traffic.
config system vdom
    edit root
    next
    edit Voice
    next
end
config system interface
    edit internal
        set stpforward enable
    next
    edit external
        set stpforward enable
    next
 
    edit vlan2-internal
        set vdom Voice
        set interface internal
        set vlanid 2
    next
    edit vlan2-external
        set vdom Voice
        set interface external
        set vlanid 2
    next
end
config firewall policy
    edit 1
        set srcintf internal
        set dstintf external
        set srcaddr all
        set dstaddr all
        set action accept
        set schedule always
        set service ANY
        set profile_status enable
        set profile scan
    next
end
exec enter Voice
config firewall address
    edit all
    next
end
config firewall policy
    edit 1
        set srcintf vlan2-internal
        set dstintf vlan2-external
        set srcaddr all
        set dstaddr all
        set action accept
        set schedule always
        set service ANY
        set profile_status enable
        set profile scan
    next
    edit 2
        set srcintf vlan2-external
        set dstintf vlan2-internal
        set srcaddr all
        set dstaddr all
        set action accept
        set schedule always
        set service ANY
        set profil
Troubleshooting

·          diagnose debug enable -- enable output on remote console
·          diagnose sniffer packet -- display packets   coming in and
      out on interfaces
·         exec enter [vdom] -- change VDOM
·          exec ping -- ping tool
 
### VLAN 802.1Q 的工作原理 IEEE 802.1Q 是用于支持虚拟局域网(VLAN)技术的标准协议,它定义了如何在以太网帧中插入一个 VLAN 标记(Tag),以便在多个 VLAN 之间区分数据流量。802.1Q 标准通过在以太网帧的源 MAC 地址字段之后插入一个 4 字节的 VLAN Tag 字段来实现这一功能。该字段包含以下关键信息: - **VLAN ID(12位)**:表示数据帧所属的 VLAN 编号,范围为 1 到 4094。 - **CFI(Canonical Format Indicator,1位)**:用于标识以太网帧的格式,0 表示标准以太网格式,1 表示令牌环网格式。 - **Priority(3位)**:表示数据帧的优先级,用于服务质量(QoS)控制[^2]。 当交换机端口接收到数据帧时,它会根据以下规则进行处理: - 如果数据帧带有 VLAN Tag: - 检查接收端口是否属于该 VLAN。如果是,则在该 VLAN 内部进行交换;否则丢弃该帧。 - 如果数据帧未带 VLAN Tag: - 检查接收端口是否有未标记(Untagged)的 VLAN 属性。如果有,则将该帧归类到对应的 VLAN 中进行交换;否则丢弃该帧。 端口的 Untagged VLAN 也被称为端口的 PVID(Port VLAN ID),它是交换机端口的默认 VLAN,所有未标记的数据帧都会被分配到这个 VLAN 中[^3]。 --- ### VLAN 802.1Q 的配置方法 在实际网络中,配置 VLAN802.1Q 需要对交换机进行操作。以下是一个基于 Cisco 交换机的基本配置示例,展示如何创建 VLAN 并配置 Trunk 接口: #### 1. 创建 VLAN ```bash Switch> enable Switch# configure terminal Switch(config)# vlan 10 Switch(config-vlan)# name Sales Switch(config-vlan)# exit Switch(config)# vlan 20 Switch(config-vlan)# name Engineering Switch(config-vlan)# exit ``` #### 2. 将端口分配为 Access 模式并加入 VLAN ```bash Switch(config)# interface FastEthernet0/1 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan 10 Switch(config-if)# exit ``` #### 3. 配置 Trunk 接口以允许多个 VLAN 通过 ```bash Switch(config)# interface FastEthernet0/24 Switch(config-if)# switchport mode trunk Switch(config-if)# switchport trunk allowed vlan 10,20 Switch(config-if)# end Switch# write memory ``` --- ### VLAN 接口类型 在 802.1Q 标准中,交换机的端口可以配置为以下三种模式之一: - **Access 模式**:通常用于连接终端设备(如 PC、打印机等),只能属于一个 VLAN,数据帧在进出端口时自动添加或剥离 VLAN Tag。 - **Trunk 模式**:用于连接其他交换机或支持 VLAN 的设备,允许多个 VLAN 的流量通过,数据帧在传输过程中保留 VLAN Tag。 - **Hybrid 模式**:结合了 Access 和 Trunk 的特性,允许某些 VLAN 的流量以 Untagged 方式传输,而其他 VLAN 的流量则以 Tagged 方式传输。 --- ### VLANIF 接口 VLANIF 接口是三层交换机上的逻辑接口,用于实现 VLAN 间的路由。每个 VLANIF 接口对应一个 VLAN,并可以配置 IP 地址作为该 VLAN 的网关。例如: ```bash Switch(config)# interface Vlan10 Switch(config-if)# ip address 192.168.10.1 255.255.255.0 Switch(config-if)# no shutdown Switch(config-if)# exit ``` --- ### 相关问题 1. 如何在华为交换机上配置 VLANTrunk 接口? 2. 什么是 PVID,它在网络中起到什么作用? 3. VLAN 间通信的实现方式有哪些? 4. Hybrid 接口与 Access 和 Trunk 接口有何不同? 5. VLAN 标记(Tag)是如何插入到以太网帧中的?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值