WO2014067328A1 - Layer 2 forwarding method and forwarding device - Google Patents

Layer 2 forwarding method and forwarding device Download PDF

Info

Publication number
WO2014067328A1
WO2014067328A1 PCT/CN2013/082307 CN2013082307W WO2014067328A1 WO 2014067328 A1 WO2014067328 A1 WO 2014067328A1 CN 2013082307 W CN2013082307 W CN 2013082307W WO 2014067328 A1 WO2014067328 A1 WO 2014067328A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
vlan
mac address
packet
port
Prior art date
Application number
PCT/CN2013/082307
Other languages
French (fr)
Chinese (zh)
Inventor
李坤
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2014067328A1 publication Critical patent/WO2014067328A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4641Virtual LANs, VLANs, e.g. virtual private networks [VPN]

Definitions

  • the present invention relates to a packet forwarding technology in a communication system, and in particular, to a Layer 2 forwarding method and a forwarding device. Background technique
  • the main purpose of the embodiments of the present invention is to provide a Layer 2 forwarding method and a forwarding device, which can perform accurate Layer 2 forwarding for packets of multiple service types of the intelligent terminal, avoid frequent flooding operations, and reduce Occupied network bandwidth.
  • the embodiment of the invention discloses a layer 2 forwarding method, and the method includes:
  • the source media access control (MAC, Media Access Control) address, the destination MAC address, and the virtual local area network identifier carried in the packet are learned to the Forwarding Data Base (FDB) table.
  • FDB Forwarding Data Base
  • the destination MAC address and the source MAC address carried in the packet are indexed, and the outbound port and the outbound port side VLAN ID of the packet are retrieved in the FDB table, and the port side VLAN ID is carried.
  • the message is forwarded from the retrieved out port.
  • the source MAC address, the destination MAC address, the VLAN ID, and the ingress port of the packet are learned into the FDB table, including:
  • the destination MAC address carried in the packet is an index entry sub-entry, and the mapping relationship between the destination MAC address and the VLAN ID carried in the packet is saved.
  • the destination port and the outbound port side VLAN ID of the packet are retrieved in the FDB table by using the destination MAC address and the source MAC address carried in the packet as an index, including:
  • the destination MAC address carried in the packet is used as an index, and the corresponding FDB entry is retrieved in the FDB table, and the egress port in the retrieved FDB entry is used as the egress port of the packet.
  • the source MAC address carried in the packet is used as an index, and the corresponding sub-entry is retrieved from the retrieved FDB entry, and the VLAN ID in the retrieved FDB sub-entry is used as the outbound port side VLAN of the packet. ID.
  • the method further includes:
  • the VLAN ID carried in the packet is learned in the VLAN ID table maintained by the ingress port of the packet.
  • the method further includes:
  • the Untag information is used as a VLAN ID to learn the VLAN ID table maintained for the ingress port of the packet.
  • the method further includes:
  • the VLAN ID table maintained by the port other than the inbound port of the packet is retrieved to obtain the learning for the other ports.
  • the VLAN ID to which the corresponding VLAN is passed, corresponding to the corresponding port Sending the message respectively carrying the VLAN ID learned for the other port.
  • the method further includes: when the source MAC address carried in the packet is an index, and the corresponding sub-entry is retrieved in the retrieved FDB entry, the method further includes:
  • the VLAN ID table maintained by the port of the retrieved packet is retrieved to obtain For the VLAN ID learned by the outbound port of the packet, the packet is forwarded by the packet, and the packet carries the packet for the VLAN ID learned by the outbound port of the packet.
  • the embodiment of the present invention further discloses a layer 2 forwarding device, where the layer 2 forwarding device includes: a receiving unit, a storage unit, a learning unit, a retrieval unit, and a forwarding unit;
  • the receiving unit is configured to receive an uplink packet or a downlink packet
  • the storage unit is configured to store an FDB table
  • the learning unit is configured to learn, when the receiving unit receives the uplink packet or the downlink packet, the source MAC address, the destination MAC address, the VLAN ID, and the ingress port of the packet to be learned into the storage unit. Stored in the FDB table;
  • the search unit is configured to: when the receiving unit receives the uplink packet or the downlink packet, use the destination MAC address and the source MAC address carried in the packet as an index, and search the FDB table stored in the storage unit to retrieve the report.
  • the forwarding unit is configured to: when the search unit retrieves the outbound port and the outbound port side VLAN ID, forward the packet carrying the port side VLAN ID to the retrieved out port.
  • the learning unit is further configured to learn, when the receiving unit receives the uplink packet or the downlink packet, the mapping relationship between the source MAC address carried in the packet and the packet ingress port, and learn to the storage unit.
  • the FDB entry of the saved FDB table which is based on the source MAC address of the packet, and the mapping between the destination MAC address and the VLAN ID of the packet, and learns the FDB entry.
  • the sub-table is established by using the destination MAC address carried in the packet as an index.
  • the retrieving unit is further configured to: when the receiving unit receives the uplink packet or the downlink packet, use the destination MAC address carried in the packet as an index, and retrieve the corresponding FDB in the FDB table saved by the storage unit. An entry to obtain an outbound port of the packet.
  • the source MAC address of the packet is used as an index, and the corresponding sub-entry is retrieved from the retrieved FDB entry to obtain the outbound port side VLAN ID of the packet.
  • the storage unit is further configured to store a VLAN ID table
  • the learning unit is further configured to: when the receiving unit receives the uplink packet or the downlink packet, the VLAN ID carried in the packet is learned by the storage unit to maintain the VLAN ID of the ingress port of the packet. In the table.
  • the learning unit is further configured to: when the packet is an Untag packet that does not carry a VLAN ID, the Untag information is learned as a VLAN ID and is saved by the storage unit and maintained for the ingress port of the packet. In the VLAN ID table.
  • the retrieving unit is further configured to: in the FDB table stored in the storage unit, the FDB corresponding to the destination MAC address carried by the packet is not retrieved by using the destination MAC address carried in the packet as an index.
  • the VLAN ID table maintained by the port other than the inbound port of the packet is retrieved to obtain the VLAN ID learned for the other port;
  • the forwarding unit is further configured to: when the search unit retrieves the VLAN IDs learned by the other ports, respectively, by using the other ports, respectively forwarding the carrying the VLAN IDs learned for the other ports Message.
  • the retrieving unit is further configured to: in the index of the source MAC address carried in the packet, the sub-entry corresponding to the source MAC address carried in the packet is not retrieved in the retrieved FDB entry.
  • the VLAN ID table maintained by the outbound port of the packet is retrieved to obtain the VLAN ID learned by the outbound port of the packet;
  • the forwarding unit is further configured to retrieve, at the retrieval unit, the learning port for the packet When the VLAN ID is obtained, the packet carries the packet with the VLAN ID learned by the outbound port of the packet.
  • the forwarding device when the forwarding device receives the uplink packet or the downlink packet, the source MAC address, the destination MAC address, the VLAN ID, and the ingress port of the packet are carried in the packet. Learning in the FDB table; when receiving the packet that is reversed from the source MAC address and the destination MAC address of the packet, the destination MAC address and the source MAC address of the subsequent packet are indexed, and the FDB table is searched. The outbound port and the outbound port side VLAN ID of the subsequent packet are forwarded by the retrieved outbound port, and the subsequent packet carrying the retrieved outbound port VLAN ID is forwarded. In this way, packets of different VLAN IDs related to the smart terminal can be accurately forwarded at the Layer 2, avoiding frequent flooding operations and saving network bandwidth.
  • FIG. 1 is a schematic flowchart of an implementation process of a layer 2 forwarding method according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of a layer 2 forwarding device according to an embodiment of the present invention.
  • FIG. 3 is a schematic flowchart of an implementation process of forwarding by a layer 2 forwarding device according to an embodiment of the present invention. detailed description
  • FIG. 1 is a schematic flowchart of an implementation process of a Layer 2 forwarding method according to an embodiment of the present invention. As shown in FIG. 1, the method includes:
  • Step 101 When the uplink packet or the downlink packet arrives, the source MAC address, the destination MAC address, the VLAN ID, and the ingress port of the packet carried in the packet are learned into the FDB table.
  • the FDB entry is created in the FDB table by using the source MAC address carried in the packet as an index, and the packet is saved.
  • the mapping between the source MAC address carried in the packet and the inbound port of the packet; in the FDB entry, the sub-entry is created by using the destination MAC address carried in the packet as an index, and the packet is saved.
  • the mapping between the destination MAC address and the VLAN ID where the uplink packet is a packet sent by the user side, and is forwarded by the layer 2 forwarding device to the switching network side; the downlink packet is the switching network side. A packet sent to the user side after being forwarded by the forwarding device.
  • the source MAC address that is carried in the destination message and the inbound port of the arrival message are corresponding to each other.
  • a destination MAC address and an egress port of the packet that is reversed from the source MAC address and the destination MAC address of the arrival packet, and the source MAC address carried in the arrival message and the arrival of the arrival message The mapping relationship between the ports and the FDB table, and the FDB entries established by using the source MAC address of the incoming packet as an index;
  • step 101 when the uplink packet or the downlink packet arrives, the VLAN ID carried in the packet is learned to be the VLAN ID maintained for the ingress port of the packet.
  • the VLAN ID table is established in step 102;
  • the Untag information is learned as a VLAN ID in a VLAN ID table maintained for the ingress port of the packet;
  • the Untag packet is a packet that does not contain a VLAN tag (Tag) field.
  • the VLAN tag is a field that encapsulates the VLAN ID in the packet defined by the IEEE, Institute of Electrical and Electronics Engineers (IEEE, IEEE 802.1Q). The name.
  • the VLAN ID carried in the packet is learned as the VLAN maintained for the ingress port of the packet.
  • the packet includes a unicast packet and a broadcast packet.
  • the learning process for the FDB table follows an aging mechanism, that is, when an uplink packet or a downlink packet arrives, if the MAC address and the destination MAC address carried in the packet are If the VLAN ID and the inbound port of the packet have been learned in the FDB table, the aging time of the entry is extended.
  • the learning process for the VLAN ID table also follows the aging mechanism, that is, when the uplink packet or the downlink packet arrives, if the VLAN ID carried in the packet is learned, the packet is learned to be the ingress port.
  • the aging time of the VLAN ID table is extended.
  • Step 102 Search for the outbound port and the outbound port side VLAN ID of the packet in the FDB table by using the destination MAC address and the source MAC address carried in the packet as the index, and carry the report of the port side VLAN ID. Text, forwarded from the retrieved out port.
  • step 102 when the destination port and the outbound port side VLAN ID of the packet are retrieved in the FDB table by using the destination MAC address and the source MAC address carried in the packet as an index, the following manner can be adopted.
  • the implementation is as follows: the destination MAC address carried in the message is used as an index, and the corresponding FDB entry is retrieved in the FDB table, and the egress port in the retrieved FDB entry is used as the egress port of the packet;
  • the source MAC address carried in the packet is an index, and the corresponding sub-list is retrieved in the retrieved FDB entry, and the VLAN ID in the retrieved FDB sub-entry is used as the outbound port-side VLAN ID of the packet.
  • the destination MAC address carried in the packet is an index, and when the corresponding FDB entry is retrieved in the FDB table,
  • the packet is a broadcast packet sent by the switching network side device, since the active MAC address in the network is not the broadcast address of the 48-bit all-one broadcast address, the destination MAC address cannot be learned.
  • the FDB entry to be forwarded by the broadcast packet Therefore, if the destination MAC address of all the broadcast packets carried by the broadcast packet is used as the index, the corresponding FDB entry cannot be retrieved in the FDB table. Then, when the broadcast packet is When the switch is connected to the switching network port, the broadcast packet will be carried on the operation. If the broadcast packet reaches the user-side port, the FDB table cannot be retrieved, so the user-side VLAN ID cannot be forwarded for accurate forwarding.
  • the packet is an unknown unicast packet
  • the destination MAC address carried in the unicast packet is used as an index, and the corresponding FDB entry cannot be retrieved in the FDB table, and the packet is processed according to the related technical processing method.
  • the port flooding operation that is, the packet will be forwarded through the other ports except the inbound port.
  • the unicast packet will be carried by the carrier in advance.
  • the VLAN ID of the switching network on the port is forwarded and forwarded.
  • the unicast packet reaches the user-side port, the FDB table cannot be retrieved. Therefore, the user-side VLAN ID cannot be forwarded for accurate forwarding. .
  • step 102 the problem that the above-mentioned message cannot be accurately forwarded is also solved, and the frequent message flooding operation is reduced, and the above technical effects can be achieved by the following methods:
  • the VLAN ID table maintained by the port other than the inbound port of the packet is retrieved to obtain the learning for the other ports.
  • the obtained VLAN IDs are respectively forwarded by the other ports, and the corresponding packets respectively carry the packets learned by the other ports.
  • the Untag packet carrying the VLAN ID is forwarded through the port.
  • the source MAC address carried in the packet is an index, and when the corresponding VLAN ID is retrieved in the sub-item of the retrieved FDB entry, if the packet is For the downlink unicast message that the broadcast packet of the originating service is first responded to, because the network does not have the active MAC address as the broadcast address, in step 101, only the source MAC address of the broadcast message is In the mapping between the inbound ports and the FDB entry that is set up with the source MAC address as the index, the destination MAC address of the broadcast packet is all 48 bits. The mapping between the address and the VLAN ID is learned, and the sub-entry of the FDB entry is learned.
  • step 102 the source MAC address of the downlink unicast packet is used as an index, and the unicast downlink is used. If the destination MAC address is the FDB entry of the index, the sub-entry corresponding to the source MAC address of the downlink unicast packet cannot be retrieved, and the downlink unicast packet cannot carry the port-side VLAN ID. For accurate forwarding.
  • the source MAC address carried in the file is used as an index, and the corresponding VLAN ID is not retrieved in the sub-item of the retrieved FDB entry, and the search is performed.
  • the VLAN ID table maintained by the outbound interface of the packet is configured to obtain a VLAN ID that is learned by the outbound port of the packet, and the outbound port carries the VLAN ID learned for the outbound port of the packet.
  • the Untag message carrying the VLAN ID is forwarded through the outgoing port of the packet.
  • FIG. 2 is a schematic structural diagram of a Layer 2 forwarding device according to an embodiment of the present invention.
  • the Layer 2 forwarding device includes: a receiving unit 21 and a storage unit 22 The learning unit 23, the retrieving unit 24, and the forwarding unit 25; wherein, the receiving unit 21 is configured to receive an uplink packet or a downlink packet;
  • the storage unit 22 is configured to store the FDB table
  • the learning unit 23 is configured to learn to store the source MAC address, the destination MAC address, the VLAN ID, and the ingress port of the packet when the receiving unit 21 receives the uplink packet or the downlink packet.
  • the retrieving unit 24 is configured to: when the receiving unit 21 receives the uplink packet or the downlink packet, the destination MAC address and the source MAC address carried in the packet are indexed, and the FDB table stored in the storage unit 22 searches the FDB table. Outbound port and outbound port side VLAN ID of the packet;
  • the forwarding unit 25 is configured to forward the packet carrying the port-side VLAN ID from the retrieved egress port when the retrieving unit 24 retrieves the egress port and the egress port-side VLAN ID.
  • the learning unit 23 is further configured to: when the receiving unit 21 receives the uplink packet or the downlink packet, learn the mapping relationship between the source MAC address carried in the packet and the packet ingress port, and learn to the storage unit 22 In the FDB table of the saved FDB table, the source MAC address carried in the packet is an FDB entry, and the mapping between the destination MAC address and the VLAN ID of the packet is learned, and the FDB entry is learned.
  • the sub-table is established by using the destination MAC address carried in the packet as an index.
  • the search unit 24 is further configured to: when the receiving unit 21 receives the uplink packet or the downlink packet, retrieve the corresponding FDB in the FDB table saved by the storage unit 22 by using the destination MAC address carried in the packet as an index. An entry to obtain an outbound port of the packet.
  • the source MAC address of the packet is used as an index, and the corresponding sub-entry is retrieved from the retrieved FDB entry to obtain the outbound port side VLAN ID of the packet.
  • the storage unit 22 is further configured to store a VLAN ID table.
  • the learning unit 23 is further configured to: when the receiving unit 21 receives the uplink packet or the downlink packet, the VLAN ID carried by the packet is learned by the storage unit 22 and is the ingress port of the packet. Maintained in the VLAN ID table.
  • the learning unit 23 is further configured to: when the packet is an Untag packet that does not carry the VLAN ID, the Untag information is used as a VLAN ID, and is learned by the storage unit 22 and maintained for the ingress port of the packet. In the VLAN ID table.
  • the search unit 24 is further configured to: in the FDB table stored in the storage unit 22, the FDB table corresponding to the destination MAC address carried in the packet is not retrieved by using the destination MAC address carried in the packet as an index.
  • the VLAN ID table maintained by the port other than the inbound port of the packet is retrieved to obtain the VLAN ID learned by the learning unit 23 for the other ports.
  • the forwarding unit 25 is further configured to: when the retrieval unit 24 retrieves the VLAN IDs learned for the other ports, respectively, by using the other ports, forwarding and carrying the other The packet of the VLAN ID learned by the port.
  • the search unit 24 is further configured to: when the source MAC address carried in the packet is used as an index, and the sub-entry corresponding to the source MAC address carried in the packet is not retrieved in the retrieved FDB entry, In the storage unit 22, the VLAN ID table maintained by the outgoing port of the packet is retrieved to obtain the VLAN ID learned by the learning unit 23 for the outgoing port of the packet;
  • the forwarding unit 25 is further configured to: when the retrieval unit 24 retrieves the VLAN ID learned for the packet egress port, forward the packet to the VLAN ID learned by the egress port. The message.
  • the receiving unit 21, the learning unit 23, the retrieving unit 24, and the forwarding unit 25 may each be a central processing unit (CPU) in the layer 2 forwarding device, and a digital signal processor (DSP, Digital). Signal Processor) or Field Programmable Gate Array (FPGA) implementation;
  • CPU central processing unit
  • DSP digital signal processor
  • FPGA Field Programmable Gate Array
  • the storage unit 22 can be implemented by a memory in a Layer 2 forwarding device.
  • the following is a description of the Layer 2 forwarding method and the Layer 2 forwarding device provided by the embodiment of the present invention by using the Layer 2 forwarding device as the home gateway.
  • the smart gateway can be connected to the smart terminal.
  • the IPTV service for the uplink packet and the downlink packet of the foregoing service, is described in this embodiment from the first initiation of the service by the home gateway to the device, and the completion of the uplink and downlink packets of the service to the home gateway.
  • the process of the FDB table, in which the process of the home gateway performing Layer 2 forwarding is as shown in FIG. 3, including:
  • Step 301 The smart terminal broadcasts an uplink packet for the Internet service and the IPTV service.
  • the smart terminal when the service is first initiated, the smart terminal does not have a MAC address corresponding to the switching network side device. Therefore, the destination MAC address field of the uplink message carries a 48-bit all-1 broadcast address to the home gateway. The uplink message is broadcasted through the home gateway.
  • the source MAC address field of the uplink packet carries the MAC address MAC-1 of the smart terminal, and the uplink packet for the Internet service is an Untag packet that does not carry the VLAN ID.
  • the VLAN ID carried in the uplink packet of the IPTV service is VLAN-ID-IPTV.
  • the service type can be classified by the VLAN ID carried in the user-side packet. If the packet is an Untag packet that does not carry the VLAN ID, the The packet is a message for the Internet service.
  • Step 302 The home gateway receives the uplink packet, learns the FDB table and the VLAN ID table, and forwards the uplink packet.
  • the home gateway When receiving the uplink packet, the home gateway learns the mapping relationship between the source MAC address MAC-1 carried in the uplink packet and the inbound port Port-1 of the uplink packet, and learns that the FDB table is indexed by MAC-1. In the FDB entry;
  • the destination MAC address of the uplink packet is a broadcast address. Therefore, the mapping between the destination MAC address and the VLAN ID carried in the uplink packet is not learned in the sub-entry of the FDB entry.
  • the home gateway learns the VLAN ID table maintained for the port Port-1 by using the VLAN-ID-IPTV carried in the uplink packet of the IPTV service and the Untag information of the uplink packet for the Internet service. in.
  • the uplink packet is a broadcast packet, and the FDB table is empty when the service is first initiated. Therefore, port flooding is performed on the uplink packet, that is, The uplink packet is forwarded out through the port other than the port port-1; and when the uplink packet arrives at the home gateway switching network port, the port is pre-allocated for the switching network port.
  • the switching network side VLAN ID is forwarded by the switching network side port, and the switching network side port is assigned a unique and different switching network side VLAN ID, and the switching network side VLAN ID is determined by the operator. Different business types are pre-allocated.
  • Step 303 The home gateway receives the downlink packet, learns the FDB table and the VLAN ID table, and forwards the downlink packet.
  • the home gateway receives the downlink packet for the Internet service and the downlink packet for the IPTV service by using the network port Port-2 and the port port-3, and the The downlink packet of the IPTV service carries the MAC address MAC-2 and MAC-3 of the device that responds to the Internet service and the IPTV service on the switching network side as the source MAC address, and carries the VLAN-ID-Port-2 and VLAN-ID.
  • Port-3 and respectively carrying the MAC address MAC-1 of the smart terminal as the destination MAC address, wherein the VLAN-ID-Port-2 and VLAN-ID-Port-3 are correspondingly assigned to the port Port-2, Port -3 Switched network side VLAN ID.
  • learning the FDB table may be implemented by:
  • the mapping between the source MAC address MAC-2 and the inbound port Port-2 of the downlink packet carried in the downlink packet of the Internet service is learned in the FDB entry in which the FDB table is indexed by using the MAC-2 index;
  • the mapping between the destination MAC address MAC-1 and the VLAN-ID-Port-2 carried in the downlink information is learned, and the FDB entry is learned by using MAC-1 as an index.
  • the child table entry In the child table entry;
  • the mapping between the source MAC address MAC-3 carried in the downlink packet of the IPTV service and the inbound port Port-3 of the downlink packet is learned in the FDB entry in which the FDB table is indexed by using the MAC-3 index;
  • the mapping between the destination MAC address MAC-1 and the VLAN-ID-Port-3 carried in the downlink packet is learned, and the FDB entry is learned by using MAC-1 as an index.
  • the child table entry In the child table entry.
  • the learning of the VLAN ID table can be implemented by:
  • VLAN-ID-Port-2 carried in the downlink packet for the Internet service is learned in the VLAN ID table maintained for the port Port-2.
  • the VLAN-ID-Port-3 carried in the downlink packet for the IPTV service is learned in the VLAN ID table maintained for the port Port-3.
  • the home gateway forwards the downlink packet, which can be implemented by: using the destination MAC address MAC-1 carried in the downlink packet for the Internet service as an index, The corresponding FDB entry is retrieved in the FDB table.
  • the FDB entry is indexed in the FDB table, and the outgoing port Port-1 of the downlink packet is retrieved.
  • the sub-entry is not established in the FDB entry.
  • the source MAC address MAC-2 of the downlink packet is used as an index, and the outbound port side VLAN of the downlink packet cannot be retrieved.
  • ID according to step 302, for the port Port-1, the VLAN-ID-IPTV and Untag information in the VLAN ID table have been learned, and the following operations are performed:
  • the port-port-1 is used to forward the downlink packets carrying the VLAN-ID-IPTV and the Untag packets carrying the VLAN ID.
  • the smart terminal can ensure that the downlink packet is received for the Internet service.
  • the destination MAC address MAC-1 carried in the downlink packet for the IPTV service is used as an index, and the corresponding FDB entry is retrieved in the FDB table.
  • the FDB is already in the FDB.
  • An FDB entry with the MAC-1 as the index is established in the table, and the outbound port Port-1 of the downlink packet is retrieved;
  • the outbound port side VLAN of the downlink packet cannot be retrieved by using the source MAC address MAC-3 of the downlink packet as an index.
  • ID according to step 302, for the port Port-1, the VLAN-ID-IPTV and Untag information in the VLAN ID table have been learned, and the following operations are performed:
  • the port-port-1 is used to forward the downlink packets carrying the VLAN-ID-IPTV and the Untag packets carrying the VLAN ID.
  • the smart terminal can ensure that the downlink message is received for the IPTV service.
  • Step 304 The smart terminal sends an uplink packet for the Internet service and the IPTV service.
  • the uplink packet is an uplink packet sent by the smart terminal after receiving the downlink packet for the Internet service and the IPTV service forwarded by the home gateway.
  • step 303 when the smart terminal receives the downlink packet for the Internet service and the IPTV service, the smart terminal learns the exchange network device corresponding to the Internet service and the IPTV service from the received message.
  • the MAC addresses are MAC-2 and MAC-3 respectively. Therefore, in this step, the uplink packets corresponding to the Internet service and the IPTV service sent by the intelligent terminal are MAC-2 and MAC-3.
  • the source MAC address and the VLAN ID carried in the uplink packet of the Internet service and the IPTV service are the same as described in step 301.
  • Step 305 The home gateway receives the uplink packet, learns the FDB table and the VLAN ID table, and forwards the uplink packet.
  • learning the FDB table may be implemented by:
  • the FDB that is established by the home gateway in the source MAC address MAC-1 carried in the uplink packet according to the destination MAC address MAC-2 and Untag information carried in the uplink packet of the Internet service.
  • the sub-table is created by using the MAC-2 as an index, and the mapping relationship between the MAC-2 and the Untag information is saved.
  • the home gateway is configured with the source MAC address MAC-1 carried in the uplink packet, which is established in step 302, according to the destination MAC address MAC-3 and the VLAN-ID-IPTV carried in the uplink packet for the IPTV service.
  • a sub-table is created by using the MAC-3 as an index, and the mapping relationship between the MAC-3 and the VLAN-ID-IPTV is saved.
  • the learning of the VLAN ID table can be implemented by:
  • the VLAN ID table of the VLAN-ID-IPTV carried in the uplink packet for the IPTV service and the Untag information of the uplink packet for the Internet service are learned. Aging time.
  • the home gateway forwards the uplink packet, which can be implemented by: searching for the corresponding FDB entry in the FDB table by using the destination MAC address MAC-2 carried in the uplink file for the Internet service, step 303
  • the FDB entry indexed by the MAC-2 is established in the FDB table, and the outbound port Port-2 of the uplink packet is retrieved;
  • the source MAC address MAC-1 carried in the uplink packet of the Internet service is used as an index, and the corresponding sub-entry is retrieved from the retrieved FDB entry, and the outbound port side VLAN of the uplink packet is retrieved.
  • ID is VLAN-ID-Port-2;
  • the outbound port of the uplink packet for the IPTV service is port-3, and the outbound port side VLAN ID of the uplink packet is VLAN-ID-Port-3, and the retrieved port port is retrieved.
  • -3 Forwarding the uplink packet carrying the VLAN-ID-Port-3.
  • Step 306 The home gateway receives the downlink packet, learns the FDB table and the VLAN ID table, and forwards the downlink packet.
  • the downlink packet is a packet that responds to the uplink packet in step 305, and includes a downlink packet that responds to the Internet service and the IPTV service, and the downlink packet that responds to the Internet service and the IPTV service, Corresponding to the MAC address MAC-2 and MAC-3 of the device that responds to the Internet service and the IPTV service on the switching network side as the source MAC address, which carries the VLAN-ID-Port-2 and VLAN-ID-Port-3, and simultaneously The MAC address MAC-1 of the intelligent terminal is carried as the destination MAC address.
  • learning the FDB table may be implemented by:
  • the learning of the VLAN ID table can be implemented by:
  • the VLAN-ID-Port-2 carried in the downlink packet of the Internet service has been learned in the VLAN ID table maintained for the port Port-2, and the aging time of the VLAN ID table is extended.
  • the VLAN-ID-Port-3 carried in the downlink packet of the IPTV service has been learned in the VLAN ID table maintained for the port port-3, and the aging time of the VLAN ID table is extended.
  • the home gateway forwards the downlink packet, and the method is as follows:
  • the destination MAC address MAC-1 carried in the downlink packet of the Internet service is used as an index, and the corresponding FDB entry is retrieved in the FDB table, in step 302.
  • the FDB entry with the MAC-1 as the index has been established in the FDB table, and the outbound port Port-1 of the downlink packet is retrieved at this time;
  • the source MAC address MAC-2 carried in the downlink packet for the Internet service is used as an index, and the corresponding sub-entry is retrieved in the retrieved FDB entry.
  • the FDB entry that has been retrieved is already in the In the sub-item, the mapping between the MAC-2 and the Untag information is saved, and the downlink packet is retrieved as an Untag packet that does not carry the VLAN ID.
  • the outbound port of the downlink packet for the IPTV service is retrieved as Port-1, and the downlink packet is The outbound port side VLAN ID is VLAN-ID-IPTV, and the downlink packet carrying the VLAN-ID-IPTV is forwarded through the retrieved outbound port Port-3.
  • Step 307 The home gateway receives the uplink packet, learns the FDB table and the VLAN ID table, and forwards the uplink packet.
  • learning the FDB table may be implemented by:
  • step 305 the source MAC address, the destination MAC address, the VLAN ID, and the ingress port of the uplink packet carried in the uplink packet are completely learned in the entry corresponding to the FDB table.
  • the aging time of the FDB entry is extended.
  • the learning of the VLAN ID table can be implemented by:
  • the VLAN-ID-IPTV carried in the uplink packet for the IPTV service and the Untag information of the uplink packet for the Internet service are discovered.
  • the VLAN ID maintained for the port Port-1 has been learned.
  • the aging time of the VLAN ID table is extended.
  • the home gateway forwards the uplink packet, which can be implemented by: searching for the corresponding FDB entry in the FDB table by using the destination MAC address MAC-2 carried in the uplink file for the Internet service, step 303 An FDB entry indexed by the MAC-2 is set in the FDB table. The outgoing port Port-2 of the upstream packet is retrieved.
  • the source MAC address MAC- carried in the uplink packet for the Internet service is configured. 1 is an index, and the corresponding sub-list is retrieved in the retrieved FDB entry, and the outbound port side VLAN ID of the uplink packet is VLAN-ID-Port-2;
  • the outbound port of the uplink packet for the IPTV service is port-3, and the outbound port side VLAN ID of the uplink packet is VLAN-ID-Port-3, and the retrieved port port is retrieved.
  • -3 Forwarding the uplink packet carrying the VLAN-ID-Port-3.
  • the home gateway has completely learned the FDB table and the VLAN ID table for the uplink packet and the downlink packet of the Internet service and the IPTV service, and repeatedly performs the subsequent receiving of the uplink packet or the downlink packet.
  • step 306 and step 307 accurate Layer 2 forwarding of the uplink packet or the downlink packet is implemented. Step 306 and step 307 are not limited in sequence.

Abstract

Disclosed are a layer 2 forwarding method and a layer 2 forwarding device. The method comprises: when an uplink message or a downlink message arrives, learning the source media access control (MAC) address, destination MAC address, virtual local area network identity (VLAN ID) and the ingress port of the message, which are carried by the message, to a forwarding database (FDB) table; and using the destination MAC address and the source MAC address carried by the message as an index, retrieving in the FDB table the egress port of the message and the VLAN ID of the egress port side, and forwarding the message. Using the technical solutions of the embodiments of the present invention solves the problem in the related art whereby a layer 2 forwarding device fails to accurately perform layer 2 forwarding on messages of different types of services related to intelligent terminals, avoids frequent flooding operations, and saves network bandwidth.

Description

二层转发方法及转发设备 技术领域  Layer 2 forwarding method and forwarding device
本发明涉及通信系统中的报文转发技术, 尤其涉及一种二层转发方法 及转发设备。 背景技术  The present invention relates to a packet forwarding technology in a communication system, and in particular, to a Layer 2 forwarding method and a forwarding device. Background technique
随着三网融合业务的推进, 基于因特网的语音传输协议(VoIP, Voice over Internet Protocol ) 电话、 交互式网络电视 ( IPTV , Internet Protocol TV/Interactive Personal TV )等业务不断发展, 目前, 家庭网关对于上述智 能终端的业务相关的报文进行处理时, 无法准确进行二层转发, 只能进行 频繁的洪泛操作, 如此, 将占用大量网络带宽, 容易造成网路拥塞。 发明内容  With the advancement of the triple play service, services such as Voice over Internet Protocol (VoIP), Internet Protocol TV/Interactive Personal TV (IPTV), etc. are constantly evolving. Currently, the home gateway When the service-related packets of the smart terminal are processed, the Layer 2 forwarding cannot be performed accurately. Only frequent flooding operations can be performed. As a result, a large amount of network bandwidth is occupied, which may cause network congestion. Summary of the invention
有鉴于此, 本发明实施例的主要目的在于提供一种二层转发方法及转 发设备, 能够针对智能终端多种业务类型的报文, 进行准确的二层转发, 避免频繁洪泛操作, 减小占用的网络带宽。  In view of the above, the main purpose of the embodiments of the present invention is to provide a Layer 2 forwarding method and a forwarding device, which can perform accurate Layer 2 forwarding for packets of multiple service types of the intelligent terminal, avoid frequent flooding operations, and reduce Occupied network bandwidth.
为达到上述目的, 本发明实施例的技术方案是这样实现的:  To achieve the above objective, the technical solution of the embodiment of the present invention is implemented as follows:
本发明实施例公开了一种二层转发方法, 所述方法包括:  The embodiment of the invention discloses a layer 2 forwarding method, and the method includes:
上行报文或下行报文到达时, 将所述报文携带的源介质接入控制 ( MAC, Media Access Control )地址、 目的 MAC地址、 虚拟局域网标识 学习到转发数据库(FDB, Forwarding Data Base )表中;  When the uplink packet or the downlink packet arrives, the source media access control (MAC, Media Access Control) address, the destination MAC address, and the virtual local area network identifier carried in the packet are learned to the Forwarding Data Base (FDB) table. Medium
以所述报文携带的目的 MAC地址、 源 MAC地址为索引, 在 FDB表 中检索所述报文的出端口和出端口侧 VLAN ID ,将携带出端口侧 VLAN ID 的所述报文, 从检索到的出端口转发出去。 The destination MAC address and the source MAC address carried in the packet are indexed, and the outbound port and the outbound port side VLAN ID of the packet are retrieved in the FDB table, and the port side VLAN ID is carried. The message is forwarded from the retrieved out port.
优选地, 所述将报文携带的源 MAC地址、 目的 MAC地址、 VLAN ID 以及所述报文的入端口学习到 FDB表中, 包括:  Preferably, the source MAC address, the destination MAC address, the VLAN ID, and the ingress port of the packet are learned into the FDB table, including:
以所述报文携带的源 MAC地址为索引在 FDB表中建立 FDB表项,保 存所述报文携带的源 MAC地址和所述报文入端口的映射关系;在上述 FDB 表项中, 以所述报文携带的目的 MAC地址为索引建立子表项,保存所述报 文携带的目的 MAC地址和 VLAN ID的映射关系。  Establishing an FDB entry in the FDB table by using the source MAC address carried in the packet as an index, and storing a mapping relationship between the source MAC address carried in the packet and the inbound port of the packet; in the FDB entry, The destination MAC address carried in the packet is an index entry sub-entry, and the mapping relationship between the destination MAC address and the VLAN ID carried in the packet is saved.
优选地,所述以报文携带的目的 MAC地址、源 MAC地址为索引在 FDB 表中检索所述报文的出端口和出端口侧 VLAN ID , 包括:  Preferably, the destination port and the outbound port side VLAN ID of the packet are retrieved in the FDB table by using the destination MAC address and the source MAC address carried in the packet as an index, including:
以所述报文携带的目的 MAC地址为索引,在 FDB表中检索对应的 FDB 表项, 将检索到的 FDB表项中的出端口作为所述报文的出端口;  The destination MAC address carried in the packet is used as an index, and the corresponding FDB entry is retrieved in the FDB table, and the egress port in the retrieved FDB entry is used as the egress port of the packet.
以所述报文携带的源 MAC地址为索引, 在检索到的 FDB表项中检索 对应的子表项, 将检索到的 FDB子表项中的 VLAN ID作为所述报文的出 端口侧 VLAN ID。  The source MAC address carried in the packet is used as an index, and the corresponding sub-entry is retrieved from the retrieved FDB entry, and the VLAN ID in the retrieved FDB sub-entry is used as the outbound port side VLAN of the packet. ID.
优选地, 所述方法还包括:  Preferably, the method further includes:
上行报文或下行报文到达时,将所述报文携带的 VLAN ID学习到与所 述报文的入端口维护的 VLAN ID表中。  When the uplink packet or the downlink packet arrives, the VLAN ID carried in the packet is learned in the VLAN ID table maintained by the ingress port of the packet.
优选地, 所述方法还包括:  Preferably, the method further includes:
若所述报文为不携带 VLAN ID的未打标签( Untag )报文, 则将 Untag 信息作为 VLAN ID, 学习到为所述报文的入端口维护的 VLAN ID表中。  If the packet is an untagged packet that does not carry a VLAN ID, the Untag information is used as a VLAN ID to learn the VLAN ID table maintained for the ingress port of the packet.
优选地, 所述以报文携带的目的 MAC地址为索引, 在 FDB表中检索 对应的 FDB表项时, 所述方法还包括:  Preferably, when the destination MAC address carried by the packet is used as an index, and the corresponding FDB entry is retrieved in the FDB table, the method further includes:
若没有检索到与所述报文携带的目的 MAC地址对应的 FDB表项, 则 检索为除所述报文入端口外的其他端口分别维护的 VLAN ID表, 以获取针 对所述其他端口分别学习到的 VLAN ID , 分别通过所述其他端口, 对应转 发分别携带针对所述其他端口学习到的 VLAN ID的所述报文。 If the FDB entry corresponding to the destination MAC address of the packet is not retrieved, the VLAN ID table maintained by the port other than the inbound port of the packet is retrieved to obtain the learning for the other ports. The VLAN ID to which the corresponding VLAN is passed, corresponding to the corresponding port Sending the message respectively carrying the VLAN ID learned for the other port.
优选地, 所述以报文携带的源 MAC地址为索引, 在检索到的 FDB表 项中检索对应的子表项时, 所述方法还包括:  Preferably, the method further includes: when the source MAC address carried in the packet is an index, and the corresponding sub-entry is retrieved in the retrieved FDB entry, the method further includes:
若在检索到的 FDB表项中, 但没有检索到与所述报文携带的源 MAC 地址对应的子表项,则检索为所述检索到的报文出端口维护的 VLAN ID表, 以获取针对所述报文出端口学习到的 VLAN ID , 通过所述报文出端口, 转 发分别携带针对所述报文出端口学习到的 VLAN ID的所述报文。  If the sub-list corresponding to the source MAC address carried in the packet is not found in the retrieved FDB entry, the VLAN ID table maintained by the port of the retrieved packet is retrieved to obtain For the VLAN ID learned by the outbound port of the packet, the packet is forwarded by the packet, and the packet carries the packet for the VLAN ID learned by the outbound port of the packet.
本发明实施例还公开了一种二层转发设备, 所述二层转发设备包括: 接收单元、 存储单元、 学习单元、 检索单元和转发单元; 其中,  The embodiment of the present invention further discloses a layer 2 forwarding device, where the layer 2 forwarding device includes: a receiving unit, a storage unit, a learning unit, a retrieval unit, and a forwarding unit;
所述接收单元, 配置为接收上行报文或下行报文;  The receiving unit is configured to receive an uplink packet or a downlink packet;
所述存储单元, 配置为存储 FDB表;  The storage unit is configured to store an FDB table;
所述学习单元, 配置为在接收单元接收到上行报文或下行报文时, 将 所述报文携带的源 MAC地址、 目的 MAC地址、 VLAN ID以及所述报文的 入端口学习到存储单元存储的 FDB表中;  The learning unit is configured to learn, when the receiving unit receives the uplink packet or the downlink packet, the source MAC address, the destination MAC address, the VLAN ID, and the ingress port of the packet to be learned into the storage unit. Stored in the FDB table;
所述检索单元, 配置为在接收单元接收到上行报文或下行报文时, 以 所述报文携带的目的 MAC地址、 源 MAC地址为索引, 在存储单元保存的 FDB表中检索所述报文的出端口和出端口侧 VLAN ID;  The search unit is configured to: when the receiving unit receives the uplink packet or the downlink packet, use the destination MAC address and the source MAC address carried in the packet as an index, and search the FDB table stored in the storage unit to retrieve the report. The outgoing port and outgoing port side VLAN IDs of the text;
所述转发单元, 配置为在检索单元检索到出端口和出端口侧 VLAN ID 时, 将携带出端口侧 VLAN ID的所述报文, 从检索到的出端口转发出去。  The forwarding unit is configured to: when the search unit retrieves the outbound port and the outbound port side VLAN ID, forward the packet carrying the port side VLAN ID to the retrieved out port.
优选地, 所述学习单元, 还配置为在接收单元接收到上行报文或下行 报文时,将所述报文携带的源 MAC地址和所述报文入端口的映射关系, 学 习到存储单元保存的 FDB表的、 以所述报文携带的源 MAC地址为索引建 立的 FDB表项中;将所述报文携带的目的 MAC地址和 VLAN ID的映射关 系, 学习到上述 FDB表项的、 以所述报文携带的目的 MAC地址为索引建 立的子表项中。 优选地, 所述检索单元, 还配置为在接收单元接收到上行报文或下行 报文时,以所述报文携带的目的 MAC地址为索引,在存储单元保存的 FDB 表中检索对应的 FDB表项, 以获取所述报文的出端口; Preferably, the learning unit is further configured to learn, when the receiving unit receives the uplink packet or the downlink packet, the mapping relationship between the source MAC address carried in the packet and the packet ingress port, and learn to the storage unit. The FDB entry of the saved FDB table, which is based on the source MAC address of the packet, and the mapping between the destination MAC address and the VLAN ID of the packet, and learns the FDB entry. The sub-table is established by using the destination MAC address carried in the packet as an index. Preferably, the retrieving unit is further configured to: when the receiving unit receives the uplink packet or the downlink packet, use the destination MAC address carried in the packet as an index, and retrieve the corresponding FDB in the FDB table saved by the storage unit. An entry to obtain an outbound port of the packet.
以所述报文携带的源 MAC地址为索引, 在检索到的 FDB表项中检索 对应的子表项, 以获取所述报文的出端口侧 VLAN ID。  The source MAC address of the packet is used as an index, and the corresponding sub-entry is retrieved from the retrieved FDB entry to obtain the outbound port side VLAN ID of the packet.
优选地, 所述存储单元, 还配置为存储 VLAN ID表;  Preferably, the storage unit is further configured to store a VLAN ID table;
所述学习单元, 还配置为在接收单元接收到上行报文或下行报文时, 将所述报文携带的 VLAN ID学习到存储单元保存的、 为所述报文的入端口 维护的 VLAN ID表中。  The learning unit is further configured to: when the receiving unit receives the uplink packet or the downlink packet, the VLAN ID carried in the packet is learned by the storage unit to maintain the VLAN ID of the ingress port of the packet. In the table.
优选地, 所述学习单元, 还配置为在所述报文为不携带 VLAN ID 的 Untag报文时, 将 Untag信息作为 VLAN ID学习到存储单元保存的、 为所 述报文的入端口维护的 VLAN ID表中。  Preferably, the learning unit is further configured to: when the packet is an Untag packet that does not carry a VLAN ID, the Untag information is learned as a VLAN ID and is saved by the storage unit and maintained for the ingress port of the packet. In the VLAN ID table.
优选地, 所述检索单元,还配置为在以所述报文携带的目的 MAC地址 为索引, 在存储单元保存的 FDB表中, 没有检索到与所述报文携带的目的 MAC地址对应的 FDB表项时, 在存储单元中, 检索为除所述报文入端口 外的其他端口维护的 VLAN ID表, 以获取针对所述其他端口分别学习到的 VLAN ID;  Preferably, the retrieving unit is further configured to: in the FDB table stored in the storage unit, the FDB corresponding to the destination MAC address carried by the packet is not retrieved by using the destination MAC address carried in the packet as an index. In the storage unit, the VLAN ID table maintained by the port other than the inbound port of the packet is retrieved to obtain the VLAN ID learned for the other port;
所述转发单元, 还配置为在检索单元检索到针对所述其他端口各自学 习到的 VLAN ID时, 分别通过所述其他端口, 对应转发携带针对所述其他 端口分别学习到的 VLAN ID的所述报文。  The forwarding unit is further configured to: when the search unit retrieves the VLAN IDs learned by the other ports, respectively, by using the other ports, respectively forwarding the carrying the VLAN IDs learned for the other ports Message.
优选地,所述检索单元,还配置为在以报文携带的源 MAC地址为索引, 在检索到的 FDB表项中, 没有检索到与所述报文携带的源 MAC地址对应 的子表项时, 在存储单元中, 检索为所述报文出端口维护的 VLAN ID表, 以获取所述报文出端口学习到的 VLAN ID;  Preferably, the retrieving unit is further configured to: in the index of the source MAC address carried in the packet, the sub-entry corresponding to the source MAC address carried in the packet is not retrieved in the retrieved FDB entry. In the storage unit, the VLAN ID table maintained by the outbound port of the packet is retrieved to obtain the VLAN ID learned by the outbound port of the packet;
所述转发单元, 还配置为在检索单元检索到针对所述报文出端口学习 到的 VLAN ID时, 通过所述报文出端口, 转发分别携带针对所述报文出端 口学习到的 VLAN ID的所述报文。 The forwarding unit is further configured to retrieve, at the retrieval unit, the learning port for the packet When the VLAN ID is obtained, the packet carries the packet with the VLAN ID learned by the outbound port of the packet.
本发明实施例所提供的技术方案中, 转发设备接收上行报文或下行报 文时, 将所述报文携带的源 MAC地址、 目的 MAC地址、 VLAN ID、 以及 所述报文的入端口, 学习到 FDB表中; 后续接收到与所述报文源 MAC地 址和目的 MAC地址相颠倒的报文时, 以所述后续报文的目的 MAC地址、 源 MAC地址为索引, 在 FDB表中检索所述后续报文的出端口和出端口侧 VLAN ID , 通过检索到的出端口, 转发携带检索到的出端口 VLAN ID的所 述后续报文。 如此, 针对与智能终端相关的不同 VLAN ID的报文, 可准确 地进行二层转发, 避免了频繁的洪泛操作, 节省了网络带宽。 附图说明  In the technical solution provided by the embodiment of the present invention, when the forwarding device receives the uplink packet or the downlink packet, the source MAC address, the destination MAC address, the VLAN ID, and the ingress port of the packet are carried in the packet. Learning in the FDB table; when receiving the packet that is reversed from the source MAC address and the destination MAC address of the packet, the destination MAC address and the source MAC address of the subsequent packet are indexed, and the FDB table is searched. The outbound port and the outbound port side VLAN ID of the subsequent packet are forwarded by the retrieved outbound port, and the subsequent packet carrying the retrieved outbound port VLAN ID is forwarded. In this way, packets of different VLAN IDs related to the smart terminal can be accurately forwarded at the Layer 2, avoiding frequent flooding operations and saving network bandwidth. DRAWINGS
图 1为本发明实施例二层转发方法的实现流程示意图;  1 is a schematic flowchart of an implementation process of a layer 2 forwarding method according to an embodiment of the present invention;
图 2为本发明实施例二层转发设备的组成结构示意图;  2 is a schematic structural diagram of a layer 2 forwarding device according to an embodiment of the present invention;
图 3为本发明实施例二层转发设备进行转发的实现流程示意图。 具体实施方式  FIG. 3 is a schematic flowchart of an implementation process of forwarding by a layer 2 forwarding device according to an embodiment of the present invention. detailed description
下面结合附图及具体实施例对本发明实施例再作进一步详细的说明。 图 1所示为本发明实施例二层转发方法的实现流程示意图, 如图 1所 示, 所述方法包括:  The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. 1 is a schematic flowchart of an implementation process of a Layer 2 forwarding method according to an embodiment of the present invention. As shown in FIG. 1, the method includes:
步驟 101 : 上行报文或下行报文到达时, 将所述报文携带的源 MAC地 址、 目的 MAC地址、 VLAN ID以及所述报文的入端口, 学习到 FDB表中。  Step 101: When the uplink packet or the downlink packet arrives, the source MAC address, the destination MAC address, the VLAN ID, and the ingress port of the packet carried in the packet are learned into the FDB table.
在步驟 101 的一个优选的实施方式中, 上行 ·^艮文或下行 ·^艮文到达时, 以所述报文携带的源 MAC地址为索引在 FDB表中建立 FDB表项,保存所 述报文携带的源 MAC地址和所述报文入端口的映射关系; 在上述 FDB表 项中, 以所述报文携带的目的 MAC地址为索引建立子表项,保存所述报文 携带的目的 MAC地址和 VLAN ID的映射关系; 其中, 所述上行报文为用 户侧发起, 经过二层转发设备转发, 向交换网络侧方向传输的报文; 所述 下行报文为交换网络侧发起, 经过转发设备转发, 向用户侧方向传输的报 文。 In a preferred embodiment of the step 101, when the uplink packet or the downlink packet arrives, the FDB entry is created in the FDB table by using the source MAC address carried in the packet as an index, and the packet is saved. The mapping between the source MAC address carried in the packet and the inbound port of the packet; in the FDB entry, the sub-entry is created by using the destination MAC address carried in the packet as an index, and the packet is saved. And the mapping between the destination MAC address and the VLAN ID, where the uplink packet is a packet sent by the user side, and is forwarded by the layer 2 forwarding device to the switching network side; the downlink packet is the switching network side. A packet sent to the user side after being forwarded by the forwarding device.
在步驟 101的又一个优选的实施方式中, 上行 ·^艮文或下行 ·^艮文到达时, 将所述到达 4艮文携带的源 MAC地址和所述到达 ^艮文的入端口,对应作为与 所述到达报文的源 MAC地址和目的 MAC地址相颠倒的报文的目的 MAC 地址和出端口,并将所述到达 ^艮文携带的源 MAC地址和所述到达 ^艮文的入 端口的映射关系, 学习到 FDB表, 以所述到达报文携带的源 MAC地址为 索引建立的 FDB表项中;  In a further preferred embodiment of the step 101, when the uplink packet or the downlink packet arrives, the source MAC address that is carried in the destination message and the inbound port of the arrival message are corresponding to each other. As a destination MAC address and an egress port of the packet that is reversed from the source MAC address and the destination MAC address of the arrival packet, and the source MAC address carried in the arrival message and the arrival of the arrival message The mapping relationship between the ports and the FDB table, and the FDB entries established by using the source MAC address of the incoming packet as an index;
将所述到达报文携带的目的 MAC地址和 VLAN ID, 对应作为与所述 到达报文的源 MAC地址和目的 MAC地址相颠倒的 ^艮文的源 MAC地址和 出端口侧 VLAN ID , 并将所述到达报文携带的目的 MAC地址和 VLAN ID 的映射关系,学习到以所述到达报文的目的 MAC地址为索弓 I建立的子表项 中。  Passing the destination MAC address and the VLAN ID carried in the arrival packet as the source MAC address and the outbound port side VLAN ID of the packet that is reversed from the source MAC address and the destination MAC address of the arrival packet, and The mapping between the destination MAC address and the VLAN ID carried in the packet is learned, and the destination MAC address of the arrival packet is learned as a sub-entry established by the packet.
在步驟 101的另一个优选的实施方式中, 上行 ·^艮文或下行 ·^艮文到达时, 还将所述报文携带的 VLAN ID 学习到为所述报文的入端口维护的 VLAN ID表中, 具体为何建立 VLAN ID表将在步驟 102中详细说明;  In another preferred embodiment of step 101, when the uplink packet or the downlink packet arrives, the VLAN ID carried in the packet is learned to be the VLAN ID maintained for the ingress port of the packet. In the table, specifically why the VLAN ID table is established will be detailed in step 102;
特别地, 若所述报文为不携带 VLAN ID的未打标签(Untag )报文, 则将 Untag信息作为 VLAN ID学习到为所述报文的入端口维护的 VLAN ID 表中; 这里, 所述 Untag报文为不含有 VLAN标签(Tag ) 字段的报文, VLAN Tag 为电气和电子工程师十办会 (IEEE, Institute of Electrical and Electronics Engineers ) 802.1Q定义的在报文中封装 VLAN ID的字段的名 称。  Specifically, if the packet is an unlabeled (Untag) packet that does not carry a VLAN ID, the Untag information is learned as a VLAN ID in a VLAN ID table maintained for the ingress port of the packet; The Untag packet is a packet that does not contain a VLAN tag (Tag) field. The VLAN tag is a field that encapsulates the VLAN ID in the packet defined by the IEEE, Institute of Electrical and Electronics Engineers (IEEE, IEEE 802.1Q). The name.
上述将报文携带的 VLAN ID学习到为所述报文的入端口维护的 VLAN ID表中的流程中, 所述报文包括单播报文和广播报文。 The VLAN ID carried in the packet is learned as the VLAN maintained for the ingress port of the packet. In the process in the ID table, the packet includes a unicast packet and a broadcast packet.
在步驟 101的再一个优选的实施方式中,所述针对 FDB表的学习流程, 遵循老化机制, 即在上行报文或下行报文到达时, 若所述报文携带的 MAC 地址、 目的 MAC地址、 VLAN ID以及所述报文的入端口, 已经对应学习 到 FDB表的表项中, 则延长所述表项的老化时间;  In a further preferred implementation of the step 101, the learning process for the FDB table follows an aging mechanism, that is, when an uplink packet or a downlink packet arrives, if the MAC address and the destination MAC address carried in the packet are If the VLAN ID and the inbound port of the packet have been learned in the FDB table, the aging time of the entry is extended.
相应地, 所述针对 VLAN ID表的学习流程, 也遵循老化机制, 即在上 行报文或下行报文到达时, 若所述报文携带的 VLAN ID, 已经学习到为所 述报文入端口维护的 VLAN ID表中,则延长所述 VLAN ID表的老化时间。  Correspondingly, the learning process for the VLAN ID table also follows the aging mechanism, that is, when the uplink packet or the downlink packet arrives, if the VLAN ID carried in the packet is learned, the packet is learned to be the ingress port. In the maintained VLAN ID table, the aging time of the VLAN ID table is extended.
步驟 102: 以所述 ^艮文携带的目的 MAC地址、 源 MAC地址为索引在 FDB 表中检索所述报文的出端口和出端口侧 VLAN ID, 将携带出端口侧 VLAN ID的所述报文, 从检索到的出端口转发出去。  Step 102: Search for the outbound port and the outbound port side VLAN ID of the packet in the FDB table by using the destination MAC address and the source MAC address carried in the packet as the index, and carry the report of the port side VLAN ID. Text, forwarded from the retrieved out port.
在步驟 102的一个优选的实施方式中,将以报文携带的目的 MAC地址、 源 MAC地址为索引在 FDB表中检索所述报文的出端口和出端口侧 VLAN ID时, 可以通过以下方式实现: 以所述 ^艮文携带的目的 MAC地址为索引, 在 FDB表中检索对应的 FDB表项, 将检索到的 FDB表项中的出端口作为 所述报文的出端口; 以所述报文携带的源 MAC地址为索引, 在检索到的 FDB表项中检索对应的子表项, 将检索到的 FDB子表项中的 VLAN ID作 为所述报文的出端口侧 VLAN ID;  In a preferred implementation of step 102, when the destination port and the outbound port side VLAN ID of the packet are retrieved in the FDB table by using the destination MAC address and the source MAC address carried in the packet as an index, the following manner can be adopted. The implementation is as follows: the destination MAC address carried in the message is used as an index, and the corresponding FDB entry is retrieved in the FDB table, and the egress port in the retrieved FDB entry is used as the egress port of the packet; The source MAC address carried in the packet is an index, and the corresponding sub-list is retrieved in the retrieved FDB entry, and the VLAN ID in the retrieved FDB sub-entry is used as the outbound port-side VLAN ID of the packet.
其中, 所述以报文携带的目的 MAC地址为索引, 在 FDB表中检索对 应的 FDB表项时,  The destination MAC address carried in the packet is an index, and when the corresponding FDB entry is retrieved in the FDB table,
若所述报文为交换网络侧设备发送的广播报文, 由于网络中不会有源 MAC地址为 48位全 1的广播地址的 ^艮文, 导致无法学习到针对目的 MAC 地址 48位全 1的广播报文转发的 FDB表项, 因此, 以所述广播报文携带 的全 1的目的 MAC地址为索引,在 FDB表中将无法检索对应的 FDB表项, 那么, 当所述广播报文到达交换网络侧端口时, 该广播报文将携带上运营 商预先为网络侧端口分配的交换网络侧 VLAN ID, 并转发出去; 但当所述 广播报文到达用户侧端口时, 由于无法检索 FDB表, 所以, 无法携带用户 侧 VLAN ID以进行准确转发; If the packet is a broadcast packet sent by the switching network side device, since the active MAC address in the network is not the broadcast address of the 48-bit all-one broadcast address, the destination MAC address cannot be learned. The FDB entry to be forwarded by the broadcast packet. Therefore, if the destination MAC address of all the broadcast packets carried by the broadcast packet is used as the index, the corresponding FDB entry cannot be retrieved in the FDB table. Then, when the broadcast packet is When the switch is connected to the switching network port, the broadcast packet will be carried on the operation. If the broadcast packet reaches the user-side port, the FDB table cannot be retrieved, so the user-side VLAN ID cannot be forwarded for accurate forwarding.
若所述报文为未知单播报文,以所述单播报文携带的目的 MAC地址为 索引,在 FDB表中将无法检索对应的 FDB表项,按照相关技术的处理方法, 针对该报文进行端口洪泛操作, 即: 该报文将被通过除入端口外的其他端 口转发出去; 当所述单播报文到达交换网络侧的端口时, 该单播报文将携 带上运营商预先为网络侧端口分配的交换网络侧 VLAN ID, 并转发出去; 当所述单播报文到达用户侧端口时, 由于无法检索 FDB表, 所以, 无法携 带用户侧 VLAN ID以进行准确转发, 只能进行洪泛操作。  If the packet is an unknown unicast packet, the destination MAC address carried in the unicast packet is used as an index, and the corresponding FDB entry cannot be retrieved in the FDB table, and the packet is processed according to the related technical processing method. The port flooding operation, that is, the packet will be forwarded through the other ports except the inbound port. When the unicast packet reaches the port on the switching network, the unicast packet will be carried by the carrier in advance. The VLAN ID of the switching network on the port is forwarded and forwarded. When the unicast packet reaches the user-side port, the FDB table cannot be retrieved. Therefore, the user-side VLAN ID cannot be forwarded for accurate forwarding. .
在步驟 102 的又一个优选的实施方式中, 还解决了上述 ·^艮文无法准确 转发的问题, 并减少频繁的报文洪泛操作, 可以通过以下方式来达到上述 技术效果:  In a further preferred embodiment of the step 102, the problem that the above-mentioned message cannot be accurately forwarded is also solved, and the frequent message flooding operation is reduced, and the above technical effects can be achieved by the following methods:
若没有检索到与所述报文携带的目的 MAC地址对应的 FDB表项, 则 检索为除所述报文入端口外的其他端口分别维护的 VLAN ID表, 以获取针 对所述其他端口分别学习到的 VLAN ID , 分别通过所述其他端口, 对应转 发分别携带针对所述其他端口学习到的 VLAN ID的所述报文;  If the FDB entry corresponding to the destination MAC address of the packet is not retrieved, the VLAN ID table maintained by the port other than the inbound port of the packet is retrieved to obtain the learning for the other ports. The obtained VLAN IDs are respectively forwarded by the other ports, and the corresponding packets respectively carry the packets learned by the other ports.
特别地, 若为除所述报文入端口外的某端口维护的 VLAN ID表中含有 Untag信息, 则通过所述端口, 转发不携带 VLAN ID的 Untag报文。  In particular, if the VLAN ID table maintained by a port other than the inbound port of the packet contains Untag information, the Untag packet carrying the VLAN ID is forwarded through the port.
在步驟 102的另一个优选的实施方式中,所述以报文携带的源 MAC地 址为索引, 在检索到的 FDB表项的子表项中检索对应的 VLAN ID时, 若所述报文为针对发起业务的广播报文首次响应的下行单播报文, 由 于网络中不会有源 MAC地址为广播地址的报文, 因此, 步驟 101中, 只将 所述广播 4艮文的源 MAC地址和入端口的映射关系, 学习到以所述源 MAC 地址为索引建立的 FDB表项中,不会将所述广播报文 48位全 1的目的 MAC 地址及 VLAN ID的映射关系, 学习到所述 FDB表项的子表项中, 如此, 在步驟 102中, 以所述下行单播报文的源 MAC地址为索引,在以所述单播 下行报文的目的 MAC地址为索引建立的 FDB表项中, 将无法检索到与所 述下行单播报文的源 MAC地址对应的子表项,导致所述下行单播报文将不 能携带出端口侧 VLAN ID以进行准确转发。 In another preferred implementation of step 102, the source MAC address carried in the packet is an index, and when the corresponding VLAN ID is retrieved in the sub-item of the retrieved FDB entry, if the packet is For the downlink unicast message that the broadcast packet of the originating service is first responded to, because the network does not have the active MAC address as the broadcast address, in step 101, only the source MAC address of the broadcast message is In the mapping between the inbound ports and the FDB entry that is set up with the source MAC address as the index, the destination MAC address of the broadcast packet is all 48 bits. The mapping between the address and the VLAN ID is learned, and the sub-entry of the FDB entry is learned. In this manner, in step 102, the source MAC address of the downlink unicast packet is used as an index, and the unicast downlink is used. If the destination MAC address is the FDB entry of the index, the sub-entry corresponding to the source MAC address of the downlink unicast packet cannot be retrieved, and the downlink unicast packet cannot carry the port-side VLAN ID. For accurate forwarding.
在步驟 102的再一个优选的实施方式中, 还以所述 ^艮文携带的源 MAC 地址为索引, 在检索到的 FDB表项的子表项中没有检索对应的 VLAN ID , 则检索为所述报文出端口维护的 VLAN ID表, 以获取针对所述报文出端口 学习到的 VLAN ID , 通过所述报文出端口, 转发分别携带针对所述报文出 端口学习到的 VLAN ID的所述报文;  In a further preferred implementation of step 102, the source MAC address carried in the file is used as an index, and the corresponding VLAN ID is not retrieved in the sub-item of the retrieved FDB entry, and the search is performed. The VLAN ID table maintained by the outbound interface of the packet is configured to obtain a VLAN ID that is learned by the outbound port of the packet, and the outbound port carries the VLAN ID learned for the outbound port of the packet. The message;
特别地, 若为所述报文出端口维护的 ¥!^^ 10表中含有111^8信息, 则通过所述报文出端口, 转发不携带 VLAN ID的 Untag报文。  In particular, if the ¥!^^10 table maintained for the packet out port contains 111^8 information, the Untag message carrying the VLAN ID is forwarded through the outgoing port of the packet.
本发明实施例还记载一种二层转发设备, 图 2为本发明实施例二层转 发设备的组成结构示意图, 如图 2所示, 所述二层转发设备包括: 接收单 元 21、 存储单元 22、 学习单元 23、 检索单元 24和转发单元 25; 其中, 接收单元 21 , 配置为接收上行报文或下行报文;  The embodiment of the present invention further describes a Layer 2 forwarding device. FIG. 2 is a schematic structural diagram of a Layer 2 forwarding device according to an embodiment of the present invention. As shown in FIG. 2, the Layer 2 forwarding device includes: a receiving unit 21 and a storage unit 22 The learning unit 23, the retrieving unit 24, and the forwarding unit 25; wherein, the receiving unit 21 is configured to receive an uplink packet or a downlink packet;
存储单元 22, 配置为存储 FDB表;  The storage unit 22 is configured to store the FDB table;
学习单元 23, 配置为在接收单元 21接收到上行报文或下行报文时,将 所述报文携带的源 MAC地址、 目的 MAC地址、 VLAN ID以及所述报文的 入端口, 学习到存储单元 22存储的 FDB表中;  The learning unit 23 is configured to learn to store the source MAC address, the destination MAC address, the VLAN ID, and the ingress port of the packet when the receiving unit 21 receives the uplink packet or the downlink packet. The FDB table stored by the unit 22;
检索单元 24, 配置为在接收单元 21接收到上行报文或下行报文时, 以 所述报文携带的目的 MAC地址、 源 MAC地址为索引, 在存储单元 22保 存的 FDB表中检索所述报文的出端口和出端口侧 VLAN ID;  The retrieving unit 24 is configured to: when the receiving unit 21 receives the uplink packet or the downlink packet, the destination MAC address and the source MAC address carried in the packet are indexed, and the FDB table stored in the storage unit 22 searches the FDB table. Outbound port and outbound port side VLAN ID of the packet;
转发单元 25 ,配置为在检索单元 24检索到出端口和出端口侧 VLAN ID 时, 将携带出端口侧 VLAN ID的所述报文, 从检索到的出端口转发出去。 其中, 学习单元 23 ,还配置为在接收单元 21接收到上行报文或下行报 文时,将所述报文携带的源 MAC地址和所述报文入端口的映射关系, 学习 到存储单元 22保存的 FDB表的、以所述报文携带的源 MAC地址为索引建 立的 FDB表项中;将所述报文携带的目的 MAC地址和 VLAN ID的映射关 系, 学习到上述 FDB表项的、 以所述报文携带的目的 MAC地址为索引建 立的子表项中。 The forwarding unit 25 is configured to forward the packet carrying the port-side VLAN ID from the retrieved egress port when the retrieving unit 24 retrieves the egress port and the egress port-side VLAN ID. The learning unit 23 is further configured to: when the receiving unit 21 receives the uplink packet or the downlink packet, learn the mapping relationship between the source MAC address carried in the packet and the packet ingress port, and learn to the storage unit 22 In the FDB table of the saved FDB table, the source MAC address carried in the packet is an FDB entry, and the mapping between the destination MAC address and the VLAN ID of the packet is learned, and the FDB entry is learned. The sub-table is established by using the destination MAC address carried in the packet as an index.
其中,检索单元 24,还配置为在接收单元 21接收到上行报文或下行报 文时,以所述报文携带的目的 MAC地址为索引,在存储单元 22保存的 FDB 表中检索对应的 FDB表项, 以获取所述报文的出端口;  The search unit 24 is further configured to: when the receiving unit 21 receives the uplink packet or the downlink packet, retrieve the corresponding FDB in the FDB table saved by the storage unit 22 by using the destination MAC address carried in the packet as an index. An entry to obtain an outbound port of the packet.
以所述报文携带的源 MAC地址为索引, 在检索到的 FDB表项中检索 对应的子表项, 以获取所述报文的出端口侧 VLAN ID。  The source MAC address of the packet is used as an index, and the corresponding sub-entry is retrieved from the retrieved FDB entry to obtain the outbound port side VLAN ID of the packet.
其中, 存储单元 22, 还配置为存储 VLAN ID表;  The storage unit 22 is further configured to store a VLAN ID table.
相应地, 学习单元 23,还配置为在接收单元 21接收到上行报文或下行 报文时, 将所述报文携带的 VLAN ID学习到存储单元 22保存的、 为所述 报文的入端口维护的 VLAN ID表中。  Correspondingly, the learning unit 23 is further configured to: when the receiving unit 21 receives the uplink packet or the downlink packet, the VLAN ID carried by the packet is learned by the storage unit 22 and is the ingress port of the packet. Maintained in the VLAN ID table.
其中, 学习单元 23, 还配置为在所述报文为不携带 VLAN ID的 Untag 报文时, 将 Untag信息作为 VLAN ID, 学习到存储单元 22保存的、 为所述 报文的入端口维护的 VLAN ID表中。  The learning unit 23 is further configured to: when the packet is an Untag packet that does not carry the VLAN ID, the Untag information is used as a VLAN ID, and is learned by the storage unit 22 and maintained for the ingress port of the packet. In the VLAN ID table.
其中, 检索单元 24, 还配置为在以所述报文携带的目的 MAC地址为 索引, 在存储单元 22保存的 FDB表中, 没有检索到与所述报文携带的目 的 MAC地址对应的 FDB表项时, 在存储单元 22中,检索为除所述报文入 端口外的其他端口维护的 VLAN ID表, 以获取学习单元 23针对所述其他 端口分别学习到的 VLAN ID;  The search unit 24 is further configured to: in the FDB table stored in the storage unit 22, the FDB table corresponding to the destination MAC address carried in the packet is not retrieved by using the destination MAC address carried in the packet as an index. In the storage unit 22, the VLAN ID table maintained by the port other than the inbound port of the packet is retrieved to obtain the VLAN ID learned by the learning unit 23 for the other ports.
所述转发单元 25,还配置为在检索单元 24检索到针对所述其他端口分 别学习到的 VLAN ID时, 分别通过所述其他端口, 对应转发携带所述其他 端口分别学习到的 VLAN ID的所述报文。 The forwarding unit 25 is further configured to: when the retrieval unit 24 retrieves the VLAN IDs learned for the other ports, respectively, by using the other ports, forwarding and carrying the other The packet of the VLAN ID learned by the port.
其中, 检索单元 24, 还配置为在以报文携带的源 MAC地址为索引, 在检索到的 FDB表项中, 没有检索到与所述报文携带的源 MAC地址对应 的子表项时, 在存储单元 22中, 检索为所述报文出端口维护的 VLAN ID 表, 以获取学习单元 23针对所述报文出端口学习到的 VLAN ID;  The search unit 24 is further configured to: when the source MAC address carried in the packet is used as an index, and the sub-entry corresponding to the source MAC address carried in the packet is not retrieved in the retrieved FDB entry, In the storage unit 22, the VLAN ID table maintained by the outgoing port of the packet is retrieved to obtain the VLAN ID learned by the learning unit 23 for the outgoing port of the packet;
转发单元 25,还配置为在检索单元 24检索到针对所述报文出端口学习 到的 VLAN ID时, 通过所述报文出端口, 转发分别携带针对所述报文出端 口学习到的 VLAN ID的所述报文。  The forwarding unit 25 is further configured to: when the retrieval unit 24 retrieves the VLAN ID learned for the packet egress port, forward the packet to the VLAN ID learned by the egress port. The message.
实际应用中, 所述接收单元 21、 学习单元 23、 检索单元 24和转发单 元 25均可由所述二层转发设备中的中央处理器(CPU, Central Processing Unit ), 数字信号处理器(DSP, Digital Signal Processor )或现场可编程门阵 歹 'J ( FPGA, Field Programmable Gate Array ) 实现;  In a practical application, the receiving unit 21, the learning unit 23, the retrieving unit 24, and the forwarding unit 25 may each be a central processing unit (CPU) in the layer 2 forwarding device, and a digital signal processor (DSP, Digital). Signal Processor) or Field Programmable Gate Array (FPGA) implementation;
所述存储单元 22可由二层转发设备中的存储器实现。  The storage unit 22 can be implemented by a memory in a Layer 2 forwarding device.
下面以二层转发设备为家庭网关为例对本发明实施例提供的二层转发 方法和二层转发设备作进一步说明, 其中, 所述家庭网关下挂智能终端, 所述智能终端可开展上网业务和 IPTV业务,针对上述业务的上行报文和下 行报文, 本实施例描述的是从家庭网关下挂设备首次发起业务开始, 至家 庭网关针对所述业务的上行报文和下行报文完整学习到 FDB表的过程, 该 过程中, 家庭网关进行二层转发的流程如图 3所示, 包括:  The following is a description of the Layer 2 forwarding method and the Layer 2 forwarding device provided by the embodiment of the present invention by using the Layer 2 forwarding device as the home gateway. The smart gateway can be connected to the smart terminal. The IPTV service, for the uplink packet and the downlink packet of the foregoing service, is described in this embodiment from the first initiation of the service by the home gateway to the device, and the completion of the uplink and downlink packets of the service to the home gateway. The process of the FDB table, in which the process of the home gateway performing Layer 2 forwarding is as shown in FIG. 3, including:
步驟 301: 智能终端广播针对上网业务和 IPTV业务的上行报文。  Step 301: The smart terminal broadcasts an uplink packet for the Internet service and the IPTV service.
这里, 所述业务首次发起时, 智能终端本地没有对应交换网络侧设备 的 MAC地址, 因此,将所述上行 4艮文的目的 MAC地址字段携带 48位全 1 的广播地址, 发往家庭网关, 以通过家庭网关广播所述上行报文。  Here, when the service is first initiated, the smart terminal does not have a MAC address corresponding to the switching network side device. Therefore, the destination MAC address field of the uplink message carries a 48-bit all-1 broadcast address to the home gateway. The uplink message is broadcasted through the home gateway.
其中, 所述上行报文的源 MAC地址字段携带智能终端的 MAC地址 MAC-1 , 所述针对上网业务的上行报文为不携带 VLAN ID的 Untag报文, 针对 IPTV业务的上行报文携带的 VLAN ID为 VLAN-ID-IPTV, 如此, 可 通过用户侧报文携带的 VLAN ID区分业务类型,若报文为不携带 VLAN ID 的 Untag报文, 则所述报文为针对上网业务的报文。 The source MAC address field of the uplink packet carries the MAC address MAC-1 of the smart terminal, and the uplink packet for the Internet service is an Untag packet that does not carry the VLAN ID. The VLAN ID carried in the uplink packet of the IPTV service is VLAN-ID-IPTV. The service type can be classified by the VLAN ID carried in the user-side packet. If the packet is an Untag packet that does not carry the VLAN ID, the The packet is a message for the Internet service.
步驟 302:家庭网关接收上行报文,进行 FDB表和 VLAN ID表的学习, 并转发所述上行报文。  Step 302: The home gateway receives the uplink packet, learns the FDB table and the VLAN ID table, and forwards the uplink packet.
所述家庭网关接收上行报文时 ,将上行报文携带的源 MAC地址 MAC-1 以及所述上行报文的入端口 Port-1 的映射关系, 学习到 FDB表以 MAC-1 为索引建立的 FDB表项中;  When receiving the uplink packet, the home gateway learns the mapping relationship between the source MAC address MAC-1 carried in the uplink packet and the inbound port Port-1 of the uplink packet, and learns that the FDB table is indexed by MAC-1. In the FDB entry;
其中, 所述上行报文的目的 MAC为广播地址, 因此, 不会将所述上行 报文携带的目的 MAC地址及 VLAN ID的映射关系,学习到所述 FDB表项 的子表项中。  The destination MAC address of the uplink packet is a broadcast address. Therefore, the mapping between the destination MAC address and the VLAN ID carried in the uplink packet is not learned in the sub-entry of the FDB entry.
所述家庭网关接收上行报文时, 将针对 IPTV 业务的上行报文携带的 VLAN-ID-IPTV, 以及针对上网业务的上行报文的 Untag信息, 学习到为端 口 Port-1维护的 VLAN ID表中。  When receiving the uplink packet, the home gateway learns the VLAN ID table maintained for the port Port-1 by using the VLAN-ID-IPTV carried in the uplink packet of the IPTV service and the Untag information of the uplink packet for the Internet service. in.
这里, 所述家庭网关转发上行报文时, 由于所述上行报文为广播报文, 且业务首次发起时 FDB表为空, 因此,将针对所述上行报文进行端口洪泛, 即: 将所述上行 ·^艮文通过入端口 Port-1 外的其他端口转发出去; 并且, 当 所述上行报文到达家庭网关交换网络侧端口时, 将携带上为所述交换网络 侧端口预先分配的交换网络侧 VLAN ID, 并通过所述交换网路侧端口转发 出去; 其中, 所述交换网络侧的端口分配唯一且不同的交换网络侧 VLAN ID, 且所述交换网络侧 VLAN ID为运营商根据不同的业务类型预先分配。  Here, when the home gateway forwards the uplink packet, the uplink packet is a broadcast packet, and the FDB table is empty when the service is first initiated. Therefore, port flooding is performed on the uplink packet, that is, The uplink packet is forwarded out through the port other than the port port-1; and when the uplink packet arrives at the home gateway switching network port, the port is pre-allocated for the switching network port. The switching network side VLAN ID is forwarded by the switching network side port, and the switching network side port is assigned a unique and different switching network side VLAN ID, and the switching network side VLAN ID is determined by the operator. Different business types are pre-allocated.
步驟 303:家庭网关接收下行报文,进行 FDB表和 VLAN ID表的学习, 并转发所述下行报文。  Step 303: The home gateway receives the downlink packet, learns the FDB table and the VLAN ID table, and forwards the downlink packet.
这里, 家庭网关通过交换网络侧端口 Port-2和端口 Port-3,对应接收针 对上网业务的下行报文和响应 IPTV业务的下行报文,所述针对上网业务和 IPTV业务的下行报文, 对应将交换网侧响应上网业务和 IPTV业务的设备 的 MAC 地址 MAC-2、 MAC-3 作为源 MAC 地址携带, 对应携带 VLAN-ID-Port-2 和 VLAN-ID-Port-3 , 并分别将智能终端的 MAC 地址 MAC-1 作为目的 MAC 地址携带, 其中, 所述 VLAN-ID-Port-2 和 VLAN-ID-Port-3为对应分配给端口 Port-2、 Port-3的交换网络侧 VLAN ID。 Here, the home gateway receives the downlink packet for the Internet service and the downlink packet for the IPTV service by using the network port Port-2 and the port port-3, and the The downlink packet of the IPTV service carries the MAC address MAC-2 and MAC-3 of the device that responds to the Internet service and the IPTV service on the switching network side as the source MAC address, and carries the VLAN-ID-Port-2 and VLAN-ID. Port-3, and respectively carrying the MAC address MAC-1 of the smart terminal as the destination MAC address, wherein the VLAN-ID-Port-2 and VLAN-ID-Port-3 are correspondingly assigned to the port Port-2, Port -3 Switched network side VLAN ID.
这里, 所述家庭网关接收下行报文时, 进行 FDB表的学习, 可以通过 以下方式实现:  Here, when the home gateway receives the downlink packet, learning the FDB table may be implemented by:
将针对上网业务的下行报文携带的源 MAC地址 MAC-2和所述下行报 文的入端口 Port-2的映射关系,学习到 FDB表以 MAC-2为索引建立的 FDB 表项中; 并在所述 FDB 表项中, 将所述下行 ^艮文携带的目的 MAC地址 MAC-1和 VLAN-ID-Port-2 的映射关系,学习到所述 FDB表项中以 MAC-1 为索引建立的子表项中;  The mapping between the source MAC address MAC-2 and the inbound port Port-2 of the downlink packet carried in the downlink packet of the Internet service is learned in the FDB entry in which the FDB table is indexed by using the MAC-2 index; In the FDB entry, the mapping between the destination MAC address MAC-1 and the VLAN-ID-Port-2 carried in the downlink information is learned, and the FDB entry is learned by using MAC-1 as an index. In the child table entry;
将针对 IPTV业务的下行报文携带的源 MAC地址 MAC-3和所述下行 报文的入端口 Port-3的映射关系, 学习到 FDB表以 MAC-3为索引建立的 FDB表项中; 并在所述 FDB表项中, 将所述下行报文携带的目的 MAC地 址 MAC-1 和 VLAN-ID-Port-3 的映射关系, 学习到所述 FDB 表项中以 MAC-1为索引建立的子表项中。  The mapping between the source MAC address MAC-3 carried in the downlink packet of the IPTV service and the inbound port Port-3 of the downlink packet is learned in the FDB entry in which the FDB table is indexed by using the MAC-3 index; In the FDB entry, the mapping between the destination MAC address MAC-1 and the VLAN-ID-Port-3 carried in the downlink packet is learned, and the FDB entry is learned by using MAC-1 as an index. In the child table entry.
这里, 所述家庭网关接收下行报文时, 进行 VLAN ID表的学习, 可以 通过以下方式实现:  Here, when the home gateway receives the downlink packet, the learning of the VLAN ID table can be implemented by:
将针对上网业务的下行报文携带的 VLAN-ID-Port-2 , 学习到为端口 Port-2维护的 VLAN ID表中;  The VLAN-ID-Port-2 carried in the downlink packet for the Internet service is learned in the VLAN ID table maintained for the port Port-2.
将针对 IPTV业务的下行报文携带的 VLAN-ID-Port-3 , 学习到为端口 Port-3维护的 VLAN ID表中。  The VLAN-ID-Port-3 carried in the downlink packet for the IPTV service is learned in the VLAN ID table maintained for the port Port-3.
这里, 所述家庭网关转发下行报文, 可以通过以下方式实现: 以针对上网业务的下行报文携带的目的 MAC地址 MAC-1为索引, 在 FDB表中检索对应的 FDB表项, 步驟 302 中, 已经在 FDB表中建立以 MAC-1为索引 FDB表项, 此时检索到所述下行报文的出端口 Port-1; Here, the home gateway forwards the downlink packet, which can be implemented by: using the destination MAC address MAC-1 carried in the downlink packet for the Internet service as an index, The corresponding FDB entry is retrieved in the FDB table. In step 302, the FDB entry is indexed in the FDB table, and the outgoing port Port-1 of the downlink packet is retrieved.
由于步驟 302中, 在所述 FDB表项中没有建立子表项, 此时以所述下 行报文的源 MAC地址 MAC-2为索引, 将无法检索到所述下行报文的出端 口侧 VLAN ID,则根据步驟 302中,针对端口 Port-1 , 已经学习到 VLAN ID 表中的 VLAN-ID-IPTV和 Untag信息, 进行如下操作:  In the step 302, the sub-entry is not established in the FDB entry. In this case, the source MAC address MAC-2 of the downlink packet is used as an index, and the outbound port side VLAN of the downlink packet cannot be retrieved. ID, according to step 302, for the port Port-1, the VLAN-ID-IPTV and Untag information in the VLAN ID table have been learned, and the following operations are performed:
通过端口 Port-1 , 转发携带 VLAN-ID-IPTV的下行报文, 以及不携带 VLAN ID的 Untag下行 4艮文。  The port-port-1 is used to forward the downlink packets carrying the VLAN-ID-IPTV and the Untag packets carrying the VLAN ID.
如此, 可保证智能终端接收到针对上网业务的下行报文。  In this way, the smart terminal can ensure that the downlink packet is received for the Internet service.
相应地, 转发针对 IPTV业务的下行报文时, 以针对 IPTV业务的下行 报文携带的目的 MAC地址 MAC-1为索引, 在 FDB表中检索对应的 FDB 表项, 步驟 302中, 已经在 FDB表中建立以 MAC-1为索引 FDB表项, 此 时将检索到所述下行报文的出端口 Port-1;  Correspondingly, when the downlink packet for the IPTV service is forwarded, the destination MAC address MAC-1 carried in the downlink packet for the IPTV service is used as an index, and the corresponding FDB entry is retrieved in the FDB table. In step 302, the FDB is already in the FDB. An FDB entry with the MAC-1 as the index is established in the table, and the outbound port Port-1 of the downlink packet is retrieved;
由于步驟 302中, 在所述 FDB表项中没有建立子表项, 此时以所述下 行报文的源 MAC地址 MAC-3为索引, 将无法检索到所述下行报文的出端 口侧 VLAN ID,则根据步驟 302中,针对端口 Port-1 , 已经学习到 VLAN ID 表中的 VLAN-ID-IPTV和 Untag信息, 进行如下操作:  If the sub-entry is not established in the FDB entry, the outbound port side VLAN of the downlink packet cannot be retrieved by using the source MAC address MAC-3 of the downlink packet as an index. ID, according to step 302, for the port Port-1, the VLAN-ID-IPTV and Untag information in the VLAN ID table have been learned, and the following operations are performed:
通过端口 Port-1 , 转发携带 VLAN-ID-IPTV的下行报文, 以及不携带 VLAN ID的 Untag下行 4艮文。  The port-port-1 is used to forward the downlink packets carrying the VLAN-ID-IPTV and the Untag packets carrying the VLAN ID.
如此, 可保证智能终端接收到针对 IPTV业务的下行报文。  In this way, the smart terminal can ensure that the downlink message is received for the IPTV service.
步驟 304: 智能终端发送针对上网业务和 IPTV业务的上行报文。  Step 304: The smart terminal sends an uplink packet for the Internet service and the IPTV service.
这里, 所述上行报文为智能终端在接收到家庭网关转发的针对上网业 务和 IPTV业务的下行报文之后, 发送的上行报文。  The uplink packet is an uplink packet sent by the smart terminal after receiving the downlink packet for the Internet service and the IPTV service forwarded by the home gateway.
步驟 303中,智能终端接收到针对上网业务和 IPTV业务的下行报文时, 从接收到的报文中得知对应上网业务和 IPTV 业务的交换网络侧设备的 MAC地址分别为 MAC-2和 MAC-3 , 因此, 本步驟中, 智能终端发送的针 对上网业务和 IPTV业务的上行报文,对应携带的目的 MAC地址为 MAC-2 和 MAC-3,所述针对上网业务和 IPTV业务的上行报文携带的源 MAC地址 和 VLAN ID与步驟 301所述相同。 In step 303, when the smart terminal receives the downlink packet for the Internet service and the IPTV service, the smart terminal learns the exchange network device corresponding to the Internet service and the IPTV service from the received message. The MAC addresses are MAC-2 and MAC-3 respectively. Therefore, in this step, the uplink packets corresponding to the Internet service and the IPTV service sent by the intelligent terminal are MAC-2 and MAC-3. The source MAC address and the VLAN ID carried in the uplink packet of the Internet service and the IPTV service are the same as described in step 301.
步驟 305:家庭网关接收上行报文,进行 FDB表和 VLAN ID表的学习, 并转发所述上行报文。  Step 305: The home gateway receives the uplink packet, learns the FDB table and the VLAN ID table, and forwards the uplink packet.
这里, 所述家庭网关接收上行报文时, 进行 FDB表的学习, 可以通过 以下方式实现:  Here, when the home gateway receives the uplink packet, learning the FDB table may be implemented by:
家庭网关根据针对上网业务的上行报文携带的目的 MAC地址 MAC-2 和 Untag信息, 在步驟 302中已经建立的、 以所述上行 ·^艮文携带的源 MAC 地址 MAC-1为索引的 FDB表项中, 以 MAC-2为索引建立子表项, 保存 MAC-2和 Untag信息的映射关系;  The FDB that is established by the home gateway in the source MAC address MAC-1 carried in the uplink packet according to the destination MAC address MAC-2 and Untag information carried in the uplink packet of the Internet service. In the entry, the sub-table is created by using the MAC-2 as an index, and the mapping relationship between the MAC-2 and the Untag information is saved.
家庭网关根据针对 IPTV业务的上行报文携带的目的 MAC地址 MAC-3 和 VLAN-ID-IPTV, 在在步驟 302中已经建立的、 以所述上行报文携带的 源 MAC地址 MAC-1为索引的 FDB表项中,以 MAC-3为索引建立子表项, 保存 MAC-3和 VLAN-ID-IPTV的映射关系。  The home gateway is configured with the source MAC address MAC-1 carried in the uplink packet, which is established in step 302, according to the destination MAC address MAC-3 and the VLAN-ID-IPTV carried in the uplink packet for the IPTV service. In the FDB entry, a sub-table is created by using the MAC-3 as an index, and the mapping relationship between the MAC-3 and the VLAN-ID-IPTV is saved.
这里, 所述家庭网关接收上行报文时, 进行 VLAN ID表的学习, 可以 通过以下方式实现:  Here, when the home gateway receives the uplink packet, the learning of the VLAN ID table can be implemented by:
发现针对 IPTV业务的上行报文携带的 VLAN-ID-IPTV,以及针对上网 业务的上行报文的 Untag信息, 已经学习到为端口 Port-1维护的 VLAN ID 表中, 则延长所述 VLAN ID表的老化时间。  The VLAN ID table of the VLAN-ID-IPTV carried in the uplink packet for the IPTV service and the Untag information of the uplink packet for the Internet service are learned. Aging time.
这里, 所述家庭网关转发上行报文, 可以通过以下方式实现: 以针对上网业务的上行 4艮文携带的目的 MAC地址 MAC-2为索引, 在 FDB表中检索对应的 FDB表项, 步驟 303 中, 已经在 FDB表中建立以 MAC-2为索引的 FDB表项, 此时检索到所述上行报文的出端口 Port-2; 以针对上网业务的上行报文携带的源 MAC地址 MAC-1为索引, 在所 述检索到的 FDB表项中检索对应的子表项, 此时检索到所述上行报文的出 端口侧 VLAN ID为 VLAN-ID-Port-2; Here, the home gateway forwards the uplink packet, which can be implemented by: searching for the corresponding FDB entry in the FDB table by using the destination MAC address MAC-2 carried in the uplink file for the Internet service, step 303 The FDB entry indexed by the MAC-2 is established in the FDB table, and the outbound port Port-2 of the uplink packet is retrieved; The source MAC address MAC-1 carried in the uplink packet of the Internet service is used as an index, and the corresponding sub-entry is retrieved from the retrieved FDB entry, and the outbound port side VLAN of the uplink packet is retrieved. ID is VLAN-ID-Port-2;
通过检索到的出端口 Port-2, 转发携带 VLAN-ID-Port-2的所述上行报 文;  And forwarding, by using the retrieved port port-2, the uplink packet carrying the VLAN-ID-Port-2;
相应地, 可检索到针对 IPTV业务的上行报文的出端口为 Port-3 , 以及 所述上行报文的出端口侧 VLAN ID为 VLAN-ID-Port-3,则通过检索到的出 端口 Port-3, 转发携带 VLAN-ID-Port-3的所述上行报文。  Correspondingly, the outbound port of the uplink packet for the IPTV service is port-3, and the outbound port side VLAN ID of the uplink packet is VLAN-ID-Port-3, and the retrieved port port is retrieved. -3: Forwarding the uplink packet carrying the VLAN-ID-Port-3.
步驟 306:家庭网关接收下行报文,进行 FDB表和 VLAN ID表的学习, 并转发所述下行报文。  Step 306: The home gateway receives the downlink packet, learns the FDB table and the VLAN ID table, and forwards the downlink packet.
这里, 所述下行报文为针对步驟 305 中上行报文进行响应的报文, 包 括针对上网业务和 IPTV 业务进行响应的下行报文, 所述针对上网业务和 IPTV业务进行响应的下行报文, 对应将交换网侧响应上网业务和 IPTV业 务的设备的 MAC地址 MAC-2、 MAC-3作为源 MAC地址携带, 对应携带 VLAN-ID-Port-2 和 VLAN-ID-Port-3 , 并同时将智能终端的 MAC 地址 MAC-1作为目的 MAC地址携带。  Here, the downlink packet is a packet that responds to the uplink packet in step 305, and includes a downlink packet that responds to the Internet service and the IPTV service, and the downlink packet that responds to the Internet service and the IPTV service, Corresponding to the MAC address MAC-2 and MAC-3 of the device that responds to the Internet service and the IPTV service on the switching network side as the source MAC address, which carries the VLAN-ID-Port-2 and VLAN-ID-Port-3, and simultaneously The MAC address MAC-1 of the intelligent terminal is carried as the destination MAC address.
这里, 所述家庭网关接收下行报文时, 进行 FDB表的学习, 可以通过 以下方式实现:  Here, when the home gateway receives the downlink packet, learning the FDB table may be implemented by:
发现所述下行 4艮文的携带的源 MAC地址、 目的 MAC地址、 VLAN ID 以及所述下行报文的入端口, 在步驟 303中, 已经对应学习到 FDB表的表 项中, 则延长所述 FDB表项的老化时间。  And discovering the source MAC address, the destination MAC address, the VLAN ID, and the inbound port of the downlink packet that are carried in the downlink packet, and in step 303, if the entry in the FDB table is learned, the extension is performed. The aging time of FDB entries.
这里, 所述家庭网关接收下行报文时, 进行 VLAN ID表的学习可以通 过以下方式实现:  Here, when the home gateway receives the downlink packet, the learning of the VLAN ID table can be implemented by:
针对上网业务的下行报文携带的 VLAN-ID-Port-2, 已经学习到为端口 Port-2维护的 VLAN ID表中, 则延长所述 VLAN ID表的老化时间; 针对 IPTV业务的下行报文携带的 VLAN-ID-Port-3, 已经学习到为端 口 Port-3维护的 VLAN ID表中, 则延长所述 VLAN ID表的老化时间。 这里, 所述家庭网关转发下行报文, 可以通过以下方式实现: 以针对上网业务的下行报文携带的目的 MAC地址 MAC-1为索引, 在 FDB表中检索对应的 FDB表项, 步驟 302 中, 已经在 FDB表中建立以 MAC-1为索引 FDB表项, 此时检索到所述下行报文的出端口 Port-1; The VLAN-ID-Port-2 carried in the downlink packet of the Internet service has been learned in the VLAN ID table maintained for the port Port-2, and the aging time of the VLAN ID table is extended. The VLAN-ID-Port-3 carried in the downlink packet of the IPTV service has been learned in the VLAN ID table maintained for the port port-3, and the aging time of the VLAN ID table is extended. Here, the home gateway forwards the downlink packet, and the method is as follows: The destination MAC address MAC-1 carried in the downlink packet of the Internet service is used as an index, and the corresponding FDB entry is retrieved in the FDB table, in step 302. The FDB entry with the MAC-1 as the index has been established in the FDB table, and the outbound port Port-1 of the downlink packet is retrieved at this time;
以针对上网业务的下行报文携带的源 MAC地址 MAC-2为索引, 在所 述检索到 FDB表项中检索对应的子表项, 步驟 305中, 已经在所述检索到 的 FDB表项的子表项中, 保存 MAC-2和 Untag信息的映射关系, 此时检 索到所述下行报文应当为不携带 VLAN ID的 Untag报文;  The source MAC address MAC-2 carried in the downlink packet for the Internet service is used as an index, and the corresponding sub-entry is retrieved in the retrieved FDB entry. In step 305, the FDB entry that has been retrieved is already in the In the sub-item, the mapping between the MAC-2 and the Untag information is saved, and the downlink packet is retrieved as an Untag packet that does not carry the VLAN ID.
通过检索到的出端口 Port-1 , 转发不携带 VLAN ID的所述下行报文; 相应地, 可检索到针对 IPTV业务的下行报文的出端口为 Port-1 , 以及 所述下行报文的出端口侧 VLAN ID为 VLAN-ID-IPTV, 则通过检索到的出 端口 Port-3, 转发携带 VLAN-ID-IPTV的所述下行报文。  And forwarding the downlink packet that does not carry the VLAN ID by using the retrieved port port-1; correspondingly, the outbound port of the downlink packet for the IPTV service is retrieved as Port-1, and the downlink packet is The outbound port side VLAN ID is VLAN-ID-IPTV, and the downlink packet carrying the VLAN-ID-IPTV is forwarded through the retrieved outbound port Port-3.
步驟 307:家庭网关接收上行报文,进行 FDB表和 VLAN ID表的学习, 并转发所述上行报文。  Step 307: The home gateway receives the uplink packet, learns the FDB table and the VLAN ID table, and forwards the uplink packet.
这里, 所述家庭网关接收上行报文时, 进行 FDB表的学习, 可以通过 以下方式实现:  Here, when the home gateway receives the uplink packet, learning the FDB table may be implemented by:
由于步驟 305中,已将所述上行报文的携带的源 MAC地址、目的 MAC 地址、 VLAN ID以及所述上行报文的入端口, 完整学习到 FDB表对应的表 项中, 此时, 将延长所述 FDB表项的老化时间。  In step 305, the source MAC address, the destination MAC address, the VLAN ID, and the ingress port of the uplink packet carried in the uplink packet are completely learned in the entry corresponding to the FDB table. The aging time of the FDB entry is extended.
这里, 所述家庭网关接收上行报文时, 进行 VLAN ID表的学习, 可以 通过以下方式实现:  Here, when the home gateway receives the uplink packet, the learning of the VLAN ID table can be implemented by:
发现针对 IPTV业务的上行报文携带的 VLAN-ID-IPTV,以及针对上网 业务的上行报文的 Untag信息, 已经学习到为端口 Port-1维护的 VLAN ID 表中, 则延长所述 VLAN ID表的老化时间。 The VLAN-ID-IPTV carried in the uplink packet for the IPTV service and the Untag information of the uplink packet for the Internet service are discovered. The VLAN ID maintained for the port Port-1 has been learned. In the table, the aging time of the VLAN ID table is extended.
这里, 所述家庭网关转发上行报文, 可以通过以下方式实现: 以针对上网业务的上行 4艮文携带的目的 MAC地址 MAC-2为索引, 在 FDB表中检索对应的 FDB表项, 步驟 303 中, 已经在 FDB表中建立以 MAC-2为索引的 FDB表项, 此时检索到所述上行报文的出端口 Port-2; 以针对上网业务的上行报文携带的源 MAC地址 MAC-1为索引, 在所 述检索到的 FDB表项中检索对应的子表项, 此时检索到所述上行报文的出 端口侧 VLAN ID为 VLAN-ID-Port-2;  Here, the home gateway forwards the uplink packet, which can be implemented by: searching for the corresponding FDB entry in the FDB table by using the destination MAC address MAC-2 carried in the uplink file for the Internet service, step 303 An FDB entry indexed by the MAC-2 is set in the FDB table. The outgoing port Port-2 of the upstream packet is retrieved. The source MAC address MAC- carried in the uplink packet for the Internet service is configured. 1 is an index, and the corresponding sub-list is retrieved in the retrieved FDB entry, and the outbound port side VLAN ID of the uplink packet is VLAN-ID-Port-2;
通过检索到的出端口 Port-2, 转发携带 VLAN-ID-Port-2的所述上行报 文;  And forwarding, by using the retrieved port port-2, the uplink packet carrying the VLAN-ID-Port-2;
相应地, 可检索到针对 IPTV业务的上行报文的出端口为 Port-3 , 以及 所述上行报文的出端口侧 VLAN ID为 VLAN-ID-Port-3,则通过检索到的出 端口 Port-3, 转发携带 VLAN-ID-Port-3的所述上行报文。  Correspondingly, the outbound port of the uplink packet for the IPTV service is port-3, and the outbound port side VLAN ID of the uplink packet is VLAN-ID-Port-3, and the retrieved port port is retrieved. -3: Forwarding the uplink packet carrying the VLAN-ID-Port-3.
通过步驟 301 ~步驟 305 , 家庭网关已经针对上网业务和 IPTV业务的 上行报文和下行报文完整进行了 FDB表和 VLAN ID表的学习, 后续接收 到上行报文或下行报文时, 重复执行步驟 306和步驟 307, 即可实现对上行 报文或下行报文的准确二层转发, 其中, 步驟 306和步驟 307没有先后顺 序的限制。  Through the steps 301 to 305, the home gateway has completely learned the FDB table and the VLAN ID table for the uplink packet and the downlink packet of the Internet service and the IPTV service, and repeatedly performs the subsequent receiving of the uplink packet or the downlink packet. In step 306 and step 307, accurate Layer 2 forwarding of the uplink packet or the downlink packet is implemented. Step 306 and step 307 are not limited in sequence.
以上所述, 仅为本发明的较佳实施例而已, 并非用于限定本发明的保 护范围。  The above is only the preferred embodiment of the present invention and is not intended to limit the scope of the present invention.

Claims

权利要求书 claims
1、 一种二层转发方法, 所述方法包括: 1. A layer 2 forwarding method, the method includes:
上行报文或下行报文到达时, 将所述报文携带的源介质接入控制 MAC 地址、 目的 MAC地址、 虚拟局域网标识号 VLAN ID以及所述 4艮文的入端 口, 学习到转发数据库 FDB表中; When an uplink message or a downlink message arrives, the source medium access control MAC address, destination MAC address, virtual LAN identification number VLAN ID and the ingress port of the message carried in the message are learned from the forwarding database FDB. in the table;
以所述报文携带的目的 MAC地址、 源 MAC地址为索引, 在 FDB表 中检索所述报文的出端口和出端口侧 VLAN ID ,将携带出端口侧 VLAN ID 的所述报文, 从检索到的出端口转发出去。 Using the destination MAC address and source MAC address carried in the message as indexes, the outgoing port and outgoing port side VLAN ID of the message are retrieved in the FDB table, and the message carrying the outgoing port side VLAN ID is retrieved from The retrieved egress port is forwarded.
2、 根据权利要求 1所述的方法, 其中, 所述将报文携带的源 MAC地 址、 目的 MAC地址、 VLAN ID以及所述报文的入端口学习到 FDB表中, 包括: 2. The method according to claim 1, wherein said learning the source MAC address, destination MAC address, VLAN ID carried by the message and the ingress port of the message into the FDB table includes:
以所述报文携带的源 MAC地址为索引在 FDB表中建立 FDB表项,保 存所述报文携带的源 MAC地址和所述报文入端口的映射关系;在上述 FDB 表项中, 以所述报文携带的目的 MAC地址为索引建立子表项,保存所述报 文携带的目的 MAC地址和 VLAN ID的映射关系。 Create an FDB entry in the FDB table using the source MAC address carried in the message as an index, and save the mapping relationship between the source MAC address carried in the message and the incoming port of the message; in the above FDB entry, use The destination MAC address carried in the message is a sub-entry of the index, and the mapping relationship between the destination MAC address carried in the message and the VLAN ID is saved.
3、 根据权利要求 2所述的方法, 其中, 所述以报文携带的目的 MAC 地址、 源 MAC地址为索引在 FDB表中检索所述报文的出端口和出端口侧 VLAN ID, 包括: 3. The method according to claim 2, wherein the egress port and egress port side VLAN ID of the message are retrieved in the FDB table using the destination MAC address and source MAC address carried in the message as indexes, including:
以所述报文携带的目的 MAC地址为索引,在 FDB表中检索对应的 FDB 表项, 将检索到的 FDB表项中的出端口作为所述报文的出端口; Using the destination MAC address carried in the message as an index, search the corresponding FDB entry in the FDB table, and use the egress port in the retrieved FDB entry as the egress port of the message;
以所述报文携带的源 MAC地址为索引, 在检索到的 FDB表项中检索 对应的子表项, 将检索到的 FDB子表项中的 VLAN ID作为所述报文的出 端口侧 VLAN ID。 Using the source MAC address carried in the message as an index, search the corresponding sub-entry in the retrieved FDB entry, and use the VLAN ID in the retrieved FDB sub-entry as the egress port side VLAN of the message. ID.
4、 根据权利要求 3所述的方法, 其中, 所述方法还包括: 4. The method according to claim 3, wherein the method further includes:
上行报文或下行报文到达时,将所述报文携带的 VLAN ID学习到与所 述报文的入端口维护的 VLAN ID表中。 When an uplink packet or a downlink packet arrives, the VLAN ID carried in the packet is learned to match the in the VLAN ID table maintained by the inbound port of the above message.
5、 根据权利要求 4所述的方法, 其中, 所述方法还包括: 5. The method according to claim 4, wherein the method further includes:
若所述报文为不携带 VLAN ID的未打标签 Untag报文, 则将 Untag信 息作为 VLAN ID, 学习到为所述报文的入端口维护的 VLAN ID表中。 If the packet is an untagged Untag packet that does not carry a VLAN ID, the Untag information is used as the VLAN ID and learned into the VLAN ID table maintained for the incoming port of the packet.
6、 根据权利要求 3、 4或 5所述的方法, 其中, 所述以报文携带的目 的 MAC地址为索引, 在 FDB表中检索对应的 FDB表项时, 所述方法还包 括: 6. The method according to claim 3, 4 or 5, wherein when retrieving the corresponding FDB entry in the FDB table using the destination MAC address carried in the message as an index, the method further includes:
若没有检索到与所述报文携带的目的 MAC地址对应的 FDB表项, 则 检索为除所述报文入端口外的其他端口分别维护的 VLAN ID表, 以获取针 对所述其他端口分别学习到的 VLAN ID , 分别通过所述其他端口, 对应转 发分别携带针对所述其他端口学习到的 VLAN ID的所述报文。 If the FDB entry corresponding to the destination MAC address carried in the message is not retrieved, the VLAN ID tables maintained separately for other ports except the message inlet port are retrieved to obtain the VLAN ID tables separately learned for the other ports. The received VLAN IDs are respectively forwarded through the other ports, and the packets respectively carrying the VLAN IDs learned for the other ports are correspondingly forwarded.
7、 根据权利要求 3、 4或 5所述的方法, 其中, 所述以报文携带的源 MAC地址为索引, 在检索到的 FDB表项中检索对应的子表项时, 所述方 法还包括: 7. The method according to claim 3, 4 or 5, wherein when searching for the corresponding sub-entry in the retrieved FDB entry using the source MAC address carried in the message as an index, the method further include:
若在检索到的 FDB表项中, 但没有检索到与所述报文携带的源 MAC 地址对应的子表项,则检索为所述检索到的报文出端口维护的 VLAN ID表, 以获取针对所述报文出端口学习到的 VLAN ID , 通过所述报文出端口, 转 发分别携带针对所述报文出端口学习到的 VLAN ID的所述报文。 If the sub-entry corresponding to the source MAC address carried in the message is not retrieved in the retrieved FDB entry, the VLAN ID table maintained for the outbound port of the retrieved message is retrieved to obtain For the VLAN ID learned at the message outgoing port, forward the messages carrying the VLAN ID learned at the message outgoing port through the message outgoing port.
8、 一种二层转发设备, 所述二层转发设备包括: 接收单元、存储单元、 学习单元、 检索单元和转发单元; 其中, 8. A layer 2 forwarding device, the layer 2 forwarding device includes: a receiving unit, a storage unit, a learning unit, a retrieval unit and a forwarding unit; wherein,
所述接收单元, 配置为接收上行报文或下行报文; The receiving unit is configured to receive uplink messages or downlink messages;
所述存储单元, 配置为存储 FDB表; The storage unit is configured to store the FDB table;
所述学习单元, 配置为在接收单元接收到上行报文或下行报文时, 将 所述报文携带的源 MAC地址、 目的 MAC地址、 VLAN ID以及所述报文的 入端口学习到存储单元存储的 FDB表中; 所述检索单元, 配置为在接收单元接收到上行报文或下行报文时, 以 所述报文携带的目的 MAC地址、 源 MAC地址为索引, 在存储单元保存的 FDB表中检索所述报文的出端口和出端口侧 VLAN ID; The learning unit is configured to, when the receiving unit receives an uplink message or a downlink message, learn the source MAC address, destination MAC address, VLAN ID carried in the message and the inlet port of the message to the storage unit stored in the FDB table; The retrieval unit is configured to, when the receiving unit receives an uplink message or a downlink message, use the destination MAC address and source MAC address carried in the message as indexes to retrieve the message in the FDB table saved in the storage unit. The egress port and egress port side VLAN ID of the document;
所述转发单元, 配置为在检索单元检索到出端口和出端口侧 VLAN ID 时, 将携带出端口侧 VLAN ID的所述报文, 从检索到的出端口转发出去。 The forwarding unit is configured to, when the retrieval unit retrieves the egress port and the egress port side VLAN ID, forward the message carrying the egress port side VLAN ID out of the retrieved egress port.
9、 根据权利要求 8所述的二层转发设备, 其中, 9. The layer 2 forwarding device according to claim 8, wherein,
所述学习单元, 还配置为在接收单元接收到上行报文或下行报文时, 将所述报文携带的源 MAC地址和所述报文入端口的映射关系,学习到存储 单元保存的 FDB表的、 以所述报文携带的源 MAC地址为索弓 I建立的 FDB 表项中; 将所述报文携带的目的 MAC地址和 VLAN ID的映射关系, 学习 到上述 FDB表项的、 以所述报文携带的目的 MAC地址为索引建立的子表 项中。 The learning unit is also configured to, when the receiving unit receives an uplink message or a downlink message, learn the mapping relationship between the source MAC address carried in the message and the message incoming port to the FDB stored in the storage unit. In the FDB entry of the table, the source MAC address carried in the message is used as the index; the mapping relationship between the destination MAC address carried in the message and the VLAN ID is learned, and the FDB entry is The destination MAC address carried in the packet is in the sub-entry created by the index.
10、 根据权利要求 9所述的二层转发设备, 其中, 10. The layer 2 forwarding device according to claim 9, wherein,
所述检索单元, 还配置为在接收单元接收到上行报文或下行报文时, 以所述报文携带的目的 MAC地址为索引, 在存储单元保存的 FDB表中检 索对应的 FDB表项, 以获取所述报文的出端口; The retrieval unit is also configured to, when the receiving unit receives an uplink message or a downlink message, use the destination MAC address carried in the message as an index to retrieve the corresponding FDB entry in the FDB table saved in the storage unit, To obtain the outbound port of the message;
以所述报文携带的源 MAC地址为索引, 在检索到的 FDB表项中检索 对应的子表项, 以获取所述报文的出端口侧 VLAN ID。 Using the source MAC address carried in the message as an index, search the corresponding sub-entry in the retrieved FDB entry to obtain the egress port side VLAN ID of the message.
11、 根据权利要求 10所述的二层转发设备, 其中, 11. The layer 2 forwarding device according to claim 10, wherein,
所述存储单元, 还配置为存储 VLAN ID表; The storage unit is also configured to store the VLAN ID table;
所述学习单元, 还配置为在接收单元接收到上行报文或下行报文时, 将所述报文携带的 VLAN ID学习到存储单元保存的、 为所述报文的入端口 维护的 VLAN ID表中。 The learning unit is also configured to, when the receiving unit receives an uplink message or a downlink message, learn the VLAN ID carried in the message to the VLAN ID stored in the storage unit and maintained for the incoming port of the message. table.
12、 根据权利要求 10所述的二层转发设备, 其中, 12. The layer 2 forwarding device according to claim 10, wherein,
所述学习单元, 还配置为在所述报文为不携带 VLAN ID的 Untag报文 时, 将 Untag信息作为 VLAN ID学习到存储单元保存的、 为所述报文的入 端口维护的 VLAN ID表中。 The learning unit is also configured to detect when the packet is an Untag packet that does not carry a VLAN ID. At that time, the Untag information is learned as the VLAN ID into the VLAN ID table saved in the storage unit and maintained for the incoming port of the message.
13、 根据权利要求 10、 11或 12所述的二层转发设备, 其中, 所述检索单元, 还配置为在以所述报文携带的目的 MAC地址为索引, 在存储单元保存的 FDB表中, 没有检索到与所述报文携带的目的 MAC地 址对应的 FDB表项时, 在存储单元中, 检索为除所述报文入端口外的其他 端口维护的 VLAN ID表, 以获取针对所述其他端口分别学习到的 VLAN ID; 13. The layer 2 forwarding device according to claim 10, 11 or 12, wherein the retrieval unit is further configured to use the destination MAC address carried in the message as an index in the FDB table saved by the storage unit , when the FDB entry corresponding to the destination MAC address carried in the message is not retrieved, in the storage unit, retrieve the VLAN ID table maintained for other ports except the incoming port of the message to obtain the VLAN ID table for the message. VLAN IDs learned by other ports respectively;
所述转发单元, 还配置为在检索单元检索到针对所述其他端口各自学 习到的 VLAN ID时, 分别通过所述其他端口, 对应转发携带针对所述其他 端口分别学习到的 VLAN ID的所述报文。 The forwarding unit is also configured to, when the retrieval unit retrieves the VLAN IDs learned for the other ports, correspondingly forward the VLAN IDs carrying the VLAN IDs learned for the other ports through the other ports. message.
14、 根据权利要求 10、 11或 12所述的二层转发设备, 其中, 所述检索单元,还配置为在以报文携带的源 MAC地址为索引, 在检索 到的 FDB表项中, 没有检索到与所述报文携带的源 MAC地址对应的子表 项时, 在存储单元中, 检索为所述报文出端口维护的 VLAN ID表, 以获取 所述报文出端口学习到的 VLAN ID; 14. The layer 2 forwarding device according to claim 10, 11 or 12, wherein the retrieval unit is further configured to use the source MAC address carried in the message as an index, and among the retrieved FDB entries, there is no When the sub-entry corresponding to the source MAC address carried in the message is retrieved, in the storage unit, the VLAN ID table maintained for the message outgoing port is retrieved to obtain the VLAN learned by the message outgoing port. ID;
所述转发单元, 还配置为在检索单元检索到针对所述报文出端口学习 到的 VLAN ID时, 通过所述报文出端口, 转发分别携带针对所述报文出端 口学习到的 VLAN ID的所述报文。 The forwarding unit is also configured to, when the retrieval unit retrieves the VLAN ID learned for the message outgoing port, forward the VLAN ID learned for the message outgoing port through the message outport. of the message.
PCT/CN2013/082307 2012-10-31 2013-08-26 Layer 2 forwarding method and forwarding device WO2014067328A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210428209.9 2012-10-31
CN201210428209.9A CN103795633B (en) 2012-10-31 2012-10-31 A kind of layer 2 forwarding method and forwarding unit

Publications (1)

Publication Number Publication Date
WO2014067328A1 true WO2014067328A1 (en) 2014-05-08

Family

ID=50626425

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/082307 WO2014067328A1 (en) 2012-10-31 2013-08-26 Layer 2 forwarding method and forwarding device

Country Status (2)

Country Link
CN (1) CN103795633B (en)
WO (1) WO2014067328A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104506437B (en) * 2014-12-29 2018-08-24 新华三技术有限公司 A kind of item establishing method and device
CN105681194A (en) * 2016-03-14 2016-06-15 上海市共进通信技术有限公司 Method for realizing fast forwarding of two-layer data packet of gateway equipment
CN108418741A (en) * 2018-03-07 2018-08-17 山东超越数控电子股份有限公司 A kind of extension vlan policy division methods based on VLAN id fields
CN111556102B (en) * 2020-04-14 2023-02-28 深圳震有科技股份有限公司 Data channel establishing method, ethernet switch and storage medium
CN115118546A (en) * 2022-06-15 2022-09-27 浪潮思科网络科技有限公司 Method, device, system and medium for implementing private virtual local area network

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080198857A1 (en) * 2005-09-05 2008-08-21 Chan Kim EPON bridge apparatus and method for forwarding thereof
CN101651627A (en) * 2009-09-23 2010-02-17 杭州华三通信技术有限公司 Method and device for studying media access control (MAC) table items
CN102209043A (en) * 2011-07-22 2011-10-05 杭州华三通信技术有限公司 Media access control address table entry updating method and network equipment

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100459583C (en) * 2006-04-28 2009-02-04 杭州华三通信技术有限公司 Data forwarding controlling method and apparatus
CN100531085C (en) * 2006-07-18 2009-08-19 中兴通讯股份有限公司 Method for accessing into control address table spacing using Ethernet switch medium
CN100544322C (en) * 2007-02-15 2009-09-23 杭州华三通信技术有限公司 E-Packet and set up the method and the switch of media access control address table
CN100568853C (en) * 2007-05-15 2009-12-09 杭州华三通信技术有限公司 Layer 2 forwarding method and forwarding unit
CN100553233C (en) * 2007-08-09 2009-10-21 福建星网锐捷网络有限公司 In the FDB table, add the method and the FDB equipment of next-hop mac address
CN101286990B (en) * 2008-05-27 2012-09-05 中兴通讯股份有限公司 Forwarding method and apparatus of double-layer multicast
CN101510882A (en) * 2009-04-01 2009-08-19 杭州华三通信技术有限公司 Method and apparatus for learning medium access control address
CN101783769A (en) * 2010-03-16 2010-07-21 杭州华三通信技术有限公司 Method and device for forwarding message during failure of link

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080198857A1 (en) * 2005-09-05 2008-08-21 Chan Kim EPON bridge apparatus and method for forwarding thereof
CN101651627A (en) * 2009-09-23 2010-02-17 杭州华三通信技术有限公司 Method and device for studying media access control (MAC) table items
CN102209043A (en) * 2011-07-22 2011-10-05 杭州华三通信技术有限公司 Media access control address table entry updating method and network equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
INTERWORKING TASK GROUP: "Virtual Bridged Local Area Networks--Amendment: Provider Backbone Bridge Traffic Engineering", IEEE 802.1, IEEE P802.LQAY/D5.0, 21 January 2009 (2009-01-21), pages 19 *

Also Published As

Publication number Publication date
CN103795633A (en) 2014-05-14
CN103795633B (en) 2017-05-31

Similar Documents

Publication Publication Date Title
CN102215170B (en) Method and processor for restraining Internet storm
US8619635B2 (en) E-tree using two pseudowires between edge routers with enhanced forwarding methods and systems
WO2016101646A1 (en) Access method and apparatus for ethernet virtual network
US9705706B2 (en) Multiple prefix connections with translated virtual local area network
US20070121655A1 (en) Method for forwarding packet and apparatus thereof
WO2007045146A1 (en) A method and a device for bridging forwarding
WO2017206787A1 (en) Message forwarding control method for communication network device, and communication network device
WO2017181757A1 (en) Packet forwarding method and device
WO2007019785A1 (en) A multicast supported virtual local area network switching system and a method thereof
EP3937433A1 (en) Point-to-multipoint functionality in a bridged network
WO2014205784A1 (en) Method and device for processing multicast message in nvo3 network, and nvo3 network
WO2014067328A1 (en) Layer 2 forwarding method and forwarding device
WO2009033428A1 (en) Method, system and device for removing media access control address
WO2009086757A1 (en) Method and device for controlling message forwarding
EP3657742A1 (en) Method and apparatus for processing modified packet
WO2010139238A1 (en) Method and device for implementing mac-forced forwarding
WO2018214809A1 (en) Message transmission method and device, and storage medium
WO2011072532A1 (en) Method, access equipment and communication system for message processing
WO2020168905A1 (en) Data transmission method, node and system
WO2009127128A1 (en) Method for avoiding downstream data flooding in ethernet passive optical network
WO2006122502A1 (en) A transmission method for message in layer 2 and an access device
WO2009021371A1 (en) A method and a device for implementing pseudo wire emulation edge to edge
WO2012130142A1 (en) Method, system, and access device for user service access
WO2007059679A1 (en) A method for processing the abnormal multicast service and a network equipment thereof
WO2011069392A1 (en) Method and apparatus to implement virtual local area network

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13850430

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13850430

Country of ref document: EP

Kind code of ref document: A1