WO2009003394A1 - Method for studying mac address and network element apparatus - Google Patents

Method for studying mac address and network element apparatus Download PDF

Info

Publication number
WO2009003394A1
WO2009003394A1 PCT/CN2008/071439 CN2008071439W WO2009003394A1 WO 2009003394 A1 WO2009003394 A1 WO 2009003394A1 CN 2008071439 W CN2008071439 W CN 2008071439W WO 2009003394 A1 WO2009003394 A1 WO 2009003394A1
Authority
WO
WIPO (PCT)
Prior art keywords
arp reply
type
reply message
mac address
packet
Prior art date
Application number
PCT/CN2008/071439
Other languages
French (fr)
Chinese (zh)
Inventor
Fuhong Xu
Original Assignee
Huawei Technologies Co., Ltd.
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 Huawei Technologies Co., Ltd. filed Critical Huawei Technologies Co., Ltd.
Publication of WO2009003394A1 publication Critical patent/WO2009003394A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/10Mapping addresses of different types
    • H04L61/103Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a method for learning a MAC address and a network element device.
  • the access gateway is connected to the two access switches SA and SB through two links, and the two access switches SA and SB are respectively connected to the two access routers RA and RB.
  • the Virtual Router Redundancy Protocol (VRRP) is introduced.
  • the VRRP protocol forms a group of routers on the LAN to form a backup group, which is equivalent to a virtual router.
  • the device AG in the LAN communicates with other networks through this virtual router.
  • VRRP dynamically associates the virtual router with the physical router that carries the transmission service.
  • the physical router acts as the primary router.
  • VRRP triggers the switching, and the standby router is promoted to the primary router.
  • the RA acts as the primary router and the RB acts as the standby router.
  • the RB When the aging time is reached, the RB initiates an ARP request to the RA and the AG.
  • the default aging time is 20 minutes.
  • the AG After receiving the ARP request packet, the AG sends an ARP reply packet to the RB.
  • the source IP address of the ARP reply packet is the IP address of the AG.
  • the source MAC address is the MAC address of the AG. In this case, the RB can learn the correct one.
  • the MAC address of the AG is used to flush the MAC address of the AG in the ARP reply packet to the pre-stored ARP entry.
  • the ARP entry is a hardware address resolution protocol table, and is used to store the MAC address of the AG connected to the RB.
  • the RA Because the RA is the primary router of the VRRP, and the ARP proxy is enabled on the E1 port, the RA sends an ARP reply message to the RB after receiving the ARP request packet sent by the RB.
  • the ARP reply is the source IP address of the ARP reply. It is the IP address of the AG, and the source MAC address is the VRRP virtual MAC address. If multiple RA devices are attached to the RA and RB The RA sends multiple such ARP reply messages to the RB.
  • the virtual MAC address can be 00-00-5E-00-01- ⁇ VRID ⁇ , and the RB refreshes the virtual MAC address to the ARP entry.
  • the ARP entry stores the MAC address of the original AG. The address is refreshed to a virtual MAC address.
  • the path in which the RB sends an ARP request to the RA and the RA sends the ARP reply to the RB is as shown by the thick solid line in FIG. 2, and the path in which the RB sends an ARP request to the AG and the ARP sends an ARP reply to the RB.
  • the dotted line in 2 is shown.
  • the prior art first refreshes the source MAC address in the ARP reply packet from the AG into the ARP entry, and then restores the ARP reply from the RA.
  • the virtual MAC address in the packet is updated to the ARP entry.
  • the content of the ARP entry is changed from the MAC address of the original AG to the virtual MAC address.
  • the MAC address of the AG is learned incorrectly.
  • the primary router RA fails or the primary link fails, the E1 port of the RA goes down, and the standby router RB rises to the primary router.
  • the transmission path of the packet is as shown in Figure 1, and the downlink packet is the router RC. To the AG.
  • the MAC address of the AG is incorrectly learned. Therefore, the downlink packet received by the RB cannot be found in the ARP entry until the next aging time arrives to obtain the correct MAC address of the AG.
  • the MAC address of the AG directly discards the downlink packet and interrupts the transmission of the downlink packet.
  • the embodiment of the invention provides a method for learning a MAC address and a network element device, so as to achieve the purpose of the standby router correctly learning the MAC address.
  • a method of learning a MAC address including:
  • ARP reply packet group includes: a first type ARP reply message and a second type ARP reply message; wherein the first type ARP reply message is a source MAC address An ARP reply packet that is not a virtual MAC address, and the second type of ARP reply packet is an ARP reply packet whose source MAC address is a virtual MAC address.
  • a network element device the device comprising:
  • the ARP reply packet receiving unit is configured to receive an address resolution protocol ARP reply packet group, where the ARP reply packet group includes: a first type ARP reply packet and a second type ARP reply packet; wherein, the A type of ARP reply message is an ARP reply message whose source MAC address is not a virtual MAC address, and the second type of ARP reply message is an ARP reply message whose source MAC address is a virtual MAC address.
  • the first type of ARP reply message obtaining unit is configured to obtain the first type of ARP reply message when the ARP reply message is the first type of ARP reply message;
  • the first type of ARP reply message refreshing unit is configured to refresh the obtained source MAC address in the first type of ARP reply message into the hardware address resolution protocol table.
  • the packet in the ARP reply packet group is the first type of ARP reply packet
  • the first type of ARP reply packet is obtained, and the source MAC address in the packet is refreshed to the hardware address resolution.
  • the protocol table the MAC address of the gateway that is learned by the standby router is correct, that is, the MAC address of the correct gateway is stored in the hardware address resolution protocol table.
  • FIG. 2 is a transmission path diagram of an ARP packet provided by the prior art
  • FIG. 3 is a flowchart of a method for learning a MAC address according to an embodiment of the present invention
  • FIG. 4 is a flowchart of a method for learning a MAC address according to another embodiment of the present invention.
  • FIG. 5 is a structural diagram of a network element device according to another embodiment of the present invention.
  • FIG. 6 is a structural diagram of a network element device according to another embodiment of the present invention.
  • an embodiment of the present invention provides a method for learning a MAC address, and a topology structure of the dual-homing network to which the method is applied is shown in FIG. 1 .
  • the gateway AG is connected to the two access switches SA and SB through two links respectively, and the two access switches SA and SB are respectively connected to the two access routers RA and RB, assuming that the RA acts as the primary router, the RB As a backup router.
  • Methods for learning MAC addresses include:
  • the standby router RB actively sends an ARP request to the AGs connected to the RA and the RB, and receives ARP reply packets from the AG and the RA to form an ARP reply packet.
  • the ARP reply packet group find the ARP reply packet with the same source IP address, and return the ARP reply packet with the same source IP address to the corresponding group.
  • the ARP reply message group consists of multiple groups, and the ARP reply in each group has the same source IP address.
  • the RA can know the new IP address of the AG in time. Therefore, the source IP address in the ARP reply from the RA is the current IP address of the AG. Therefore, in the received ARP reply packet group, the ARP reply packets with the same source IP address are found in the corresponding group.
  • the ARP reply message group consists of multiple groups. Two ARP reply messages in each group are from the RA and the other one is from the AG.
  • the first type of ARP reply packet is an ARP reply packet whose source MAC address is not the virtual MAC address, that is, the source IP address is the IP address of the AG, and the source MAC address is the ARP reply packet of the MAC address of the AG.
  • the second type of ARP reply message is that the source MAC address is the ARP reply packet of the virtual MAC address, that is, the source IP address is the IP address of the AG, and the source MAC address is the ARP reply packet of the virtual MAC address.
  • the source MAC address in each packet is used to determine whether each packet in each group is a first type ARP reply message or a second type ARP reply message. If the source MAC address of the ARP reply packet is not the virtual MAC address but the MAC address of the AG, the ARP reply packet is the first type of ARP reply packet. If the source MAC address in the ARP reply packet is a virtual MAC address, the ARP reply packet is a second type of ARP reply packet.
  • the hardware address resolution protocol table and the software address resolution protocol table are preset on the RB, and the correct hardware address resolution protocol table should store the MAC address of the AG, and the software address resolution protocol table is used to store the IP address of the AG in the hardware address resolution protocol table.
  • the MAC address is mapped to the IP address in the software address resolution protocol table. If the IP address of the AG changes, the RB can know the new IP address of the AG in time, and automatically refresh the new IP address of the AG to the software address resolution protocol table to ensure the AG in the software address resolution protocol table.
  • the IP address is the correct IP address of the AG.
  • the specific implementation process of the source MAC address in the second type of ARP reply message being refreshed to the hardware address resolution protocol table is as follows:
  • the source IP address in the second type of ARP reply message is found in the software address resolution protocol table, according to the pre- The mapping between the MAC address in the hardware address resolution protocol table and the IP address in the software address resolution protocol table, and the source MAC address in the second type ARP reply packet, that is, the virtual MAC address, is flushed to the hardware address resolution protocol. In the table. At this time, the contents stored in the hardware address resolution protocol table are incorrect.
  • the refresh time of the second type of ARP reply message is set in advance on the RB before the refresh time of the first type of ARP reply message, and the refresh time may be in the ms level or the s level.
  • the starting point of the refresh time may be: After obtaining the second type of ARP reply message.
  • the specific implementation process of flushing the source MAC address in the first type of ARP reply packet to the hardware address resolution protocol table is as follows:: Find the source IP address in the first type of ARP reply packet in the software address resolution protocol table, according to The mapping between the MAC address in the preset hardware address resolution protocol table and the IP address in the software address resolution protocol table is used to refresh the source MAC address in the first type of ARP reply packet to the hardware address resolution protocol table.
  • the packet in the ARP reply packet is a first type ARP reply message or a second type ARP reply message, which does not affect the implementation of the present invention.
  • Refresh to the hardware address resolution protocol table and then refresh the first type of ARP reply packet whose source MAC address is not the virtual MAC address to the hardware address resolution protocol table, so that the standby router RB can learn correctly.
  • the MAC address of the AG that is, the MAC address stored in the hardware address resolution protocol table is the correct AG.
  • the standby router RB rises to receive the downlink packet from the primary router, and then finds the correct MAC address of the AG from the hardware address resolution protocol table, and transmits the downlink packet to the AG. , will not interrupt the transmission of downlink messages.
  • another embodiment of the present invention provides a method for learning a MAC address, where the method includes:
  • the standby router RB actively sends an ARP request to the AG connected to the RA and the RB, and receives the ARP reply packet from the AG and the RA to form an ARP reply packet.
  • 402-405 is the same as 302-305, and will not be described here.
  • 406 may be executed after 407 or concurrently with 407, without affecting the implementation of the present invention.
  • the foregoing 402 may be omitted, and in the 403, the message in the ARP reply packet group is directly determined to be the first type of ARP reply message or the second type of ARP reply message, which does not affect the implementation of the present invention.
  • the standby router RB actively initiates an ARP request to the AG that is connected to the RA and the RB, and first receives the ARP reply message from the AG, and determines the ARP reply from the AG.
  • the source MAC address in the text determines that the ARP reply packet is the first type of ARP reply packet, and the source MAC address in the first type of ARP reply packet is flushed to the hardware address resolution protocol table; and the ARP reply message from the RA is received.
  • the source MAC address in the ARP reply packet from the RA is determined to determine that the ARP reply packet is the second type of ARP reply packet, and the second type of ARP reply packet is deleted.
  • the first type of ARP reply packet whose source MAC address is not the virtual MAC address is flushed to the hardware address resolution protocol table, so that the standby router RB can learn the correct MAC address of the AG, that is, the hardware address resolution protocol table stores The correct MAC address of the AG.
  • the standby router RB rises to receive the downlink packet from the primary router, and can find the correct MAC address of the AG from the hardware address resolution protocol table, and transmits the downlink to the AG. Interrupt the transmission of downlink messages.
  • another embodiment of the present invention provides a network element device, where the device includes: an ARP reply packet receiving unit 501, a determining unit 502, a first type ARP reply packet obtaining unit 503, and a first type ARP reply.
  • the ARP reply packet receiving unit 501 receives the ARP reply packet group, and the ARP reply packet group includes: a first type ARP reply message and a second type ARP reply message; wherein, the first type ARP reply message The ARP reply packet whose source MAC address is not the virtual MAC address, and the second type of ARP reply packet is the ARP reply packet whose source MAC address is the virtual MAC address.
  • the determining unit 502 determines each of the received ARP reply packet groups.
  • the first type of ARP reply message obtaining unit 503 when the judgment result of the determining unit 502 is the first type of ARP reply message, obtain the first
  • the first type of ARP reply message refreshing unit 504 is configured to refresh the source MAC address in the obtained first type ARP reply message into the hardware address resolution protocol table.
  • the device further includes: a scribing unit 505, configured to search for the same source IP address in the received ARP reply group
  • the ARP replies to the packet, and the ARP reply packet with the same source IP address is found to be the corresponding group.
  • the determining unit 502 determines whether the packet in the ARP reply packet group is the first type of ARP reply packet or the second type.
  • the ARP reply message is specifically: It is judged whether the message classified in each group is the first type ARP reply message or the second type ARP reply message.
  • the device also includes:
  • the second type ARP reply message obtaining unit 506 obtains the second type ARP reply message when the judgment result of the determining unit 502 is the second type ARP reply message.
  • a refresh time setting unit 507 configured to set a refresh time of the second type of ARP reply message before the refresh time of the first type of ARP reply message
  • the second type of ARP reply message refreshing unit 508 is configured to refresh the virtual MAC address in the obtained second type ARP reply message to the hardware address resolution protocol table in the refresh time of the second type of ARP reply message.
  • the first type ARP reply packet refreshing unit 504 refreshes the source MAC address in the obtained first type ARP reply packet to the hardware address resolution protocol table, specifically: the refresh time of the first type ARP reply packet that is set, The source MAC address in the obtained first type ARP reply packet is flushed to the hardware address resolution protocol table.
  • the second type ARP reply packet refreshing unit 508 in the embodiment of the present invention first refreshes the second type ARP reply packet whose source MAC address is the virtual MAC address according to the refresh time of the second type ARP reply packet set in advance.
  • the hardware address resolution protocol table, the first type ARP reply message refreshing unit 504 refreshes the first type ARP reply message whose source MAC address is not the virtual MAC address, according to the preset refresh time of the first type ARP reply message.
  • the hardware address resolution protocol table enables the standby router RB to learn the correct MAC address of the AG, that is, the MAC address of the correct AG is stored in the hardware address resolution protocol table.
  • the standby router RB rises to receive the downlink packet from the primary router, and then finds the correct MAC address of the AG from the hardware address resolution protocol table, and transmits the downlink packet to the AG. , will not interrupt the transmission of downlink messages.
  • another embodiment of the present invention provides a network element device, where the device includes: an ARP reply packet receiving unit 601, a determining unit 602, a first type ARP reply packet obtaining unit 603, and a first type ARP reply.
  • the message refreshing unit 604, the grouping unit 605, the second type of ARP reply message obtaining unit 606, the above-mentioned unit function and the connection relationship are the same as those in the third embodiment, and the details are not described herein again;
  • the second type ARP reply message deleting unit 607 deletes the obtained second type ARP reply message.
  • the second type ARP reply message deleting unit 607 in the embodiment of the present invention deletes the second type ARP reply message whose source MAC address is the virtual MAC address, and the first type ARP reply message refreshing unit 604 sets the source MAC address to be virtual.
  • the first type of ARP reply packet of the MAC address is flushed to the hardware address resolution protocol table, so that the standby router RB can learn the correct MAC address of the AG, that is, the MAC address of the correct AG is stored in the hardware address resolution protocol table.
  • the standby router RB rises to receive the downlink packet for the primary router, it can The MAC address of the correct AG is found in the hardware address resolution protocol table, and the downlink packet is transmitted to the AG without interrupting the transmission of the downlink packet.
  • the description of the present invention is not limited to the scope of the present invention.

Abstract

A method for studying a MAC address comprises: in the received ARP reply message with multi identical source IP addresses and different source MAC address, the VRRP standby router can detect the ARP reply message whose source IP address is not the IP address of the current router, but whose source MAC address is the virtual MAC address of the current router; wherein, the format of the virtual MAC address is 00-00-5E-00-01-{VRID}; according to the mapping relation between the MAC address in the hardware address resolution protocol list and the IP address in the software address resolution protocol list, the source MAC address in the ARP reply message whose source MAC address is not the virtual MAC address is refreshed into the hardware address resolution protocol list, and the ARP reply message whose source MAC address is the virtual MAC address is neglected. Using the technical scheme can make the standby router study the correct MAC address.

Description

学习 MAC地址的方法及网元设备  Method for learning MAC address and network element device
本申请要求于 2007 年 6 月 29 日提交中国专利局、 申请号为 200710129551.8、 发明名称为"学习 MAC地址的方法及网元设备"的中国专利 申请的优先权, 其全部内容通过引用结合在本申请中。  This application claims priority to Chinese Patent Application No. 200710129551.8, entitled "Method of Learning MAC Address and Network Element Device", filed on June 29, 2007, the entire contents of which are incorporated herein by reference. In the application.
技术领域 Technical field
本发明涉及通信技术领域, 特别涉及一种学习 MAC地址的方法及网元设 备。  The present invention relates to the field of communications technologies, and in particular, to a method for learning a MAC address and a network element device.
背景技术 Background technique
在现实的应用中, 经常釆用如图 1所示的双归组网的拓朴结构。 其中, 接 入网管 ( Access Gateway, AG )通过两条链路分别连接到两台接入交换机 SA 和 SB, 两台接入交换机 SA和 SB再分别连接到两台接入路由器 RA和 RB。 为了解决 AG设备如何在 RA和 RB之间选路, 引入了虚拟路由器冗余协议 ( Virtual Router Redundancy Protocol , VRRP )。 VRRP协议将局域网的一组路 由器构成一个备份组,相当于一台虚拟路由器,局域网内的设备 AG通过这个 虚拟路由器与其他网络进行通信。 VRRP将该虚拟路由器动态关联到承载传输 业务的物理路由器上, 该物理路由器作为主用路由器, 当该主用路由器或者主 用链路出现故障时, VRRP触发倒换, 让备用路由器升为主用路由器来接替业 务传输工作。 参阅图 1 , 可以假设 RA作为主用路由器, RB作为备用路由器。  In practical applications, the topology of the dual-homing network shown in Figure 1 is often used. The access gateway (AG) is connected to the two access switches SA and SB through two links, and the two access switches SA and SB are respectively connected to the two access routers RA and RB. In order to solve the problem of how the AG device selects between RA and RB, the Virtual Router Redundancy Protocol (VRRP) is introduced. The VRRP protocol forms a group of routers on the LAN to form a backup group, which is equivalent to a virtual router. The device AG in the LAN communicates with other networks through this virtual router. VRRP dynamically associates the virtual router with the physical router that carries the transmission service. The physical router acts as the primary router. When the primary router or the primary link fails, VRRP triggers the switching, and the standby router is promoted to the primary router. To take over the business transfer work. Referring to Figure 1, it can be assumed that the RA acts as the primary router and the RB acts as the standby router.
假定 RA的 E1端口使能了 ARP代理( Address Resolution Protocol Proxy, ARP Proxy ), 现有技术提供的在倒换前 MAC地址学习方法是:  Assume that the ARP proxy (ARP Proxy) is enabled on the E1 port of the RA. The method for learning the MAC address before the switchover provided by the prior art is:
当老化时间到达时, RB主动向 RA和 AG发起 ARP请求, 一般预设的老 化时间是 20分钟。 AG收到 ARP请求报文后, 向 RB发送 ARP回复报文, 该 ARP回复报文中的源 IP地址是 AG的 IP地址, 源 MAC地址是 AG的 MAC 地址, 此时 RB能够学到正确的 AG的 MAC地址, 即将 ARP回复报文中的 AG的 MAC地址刷新到预存的 ARP表项。其中, ARP表项是硬件地址解析协 议表, 用于存储 RB下挂的 AG的 MAC地址。 由于 RA是 VRRP的主用路由 器, 且 E1端口使能了 ARP代理, RA收到 RB发出的 ARP请求报文后, 也会 向 RB发送 ARP回复 4艮文, 其 ARP回复 4艮文中源 IP地址是 AG的 IP地址, 而源 MAC地址是 VRRP虚拟 MAC地址。 如果 RA和 RB下挂多个 AG设备 时, RA会向 RB发送多份此类 ARP回复报文。 其中, 虚拟 MAC地址可以是 00-00-5E-00-01-{VRID} , RB将该虚拟 MAC地址刷新到 ARP表项中上, 此时 ARP表项存储的内容由原来正确的 AG的 MAC地址刷新成虚拟 MAC地址。 其中, RB向 RA发送 ARP请求和 RA向 RB发送 ARP回复 4艮文的路径如图 2 中粗实线所示, RB向 AG发送 ARP请求和 AG向 RB发送 ARP回复 4艮文的 路径如图 2中虚线所示。 When the aging time is reached, the RB initiates an ARP request to the RA and the AG. The default aging time is 20 minutes. After receiving the ARP request packet, the AG sends an ARP reply packet to the RB. The source IP address of the ARP reply packet is the IP address of the AG. The source MAC address is the MAC address of the AG. In this case, the RB can learn the correct one. The MAC address of the AG is used to flush the MAC address of the AG in the ARP reply packet to the pre-stored ARP entry. The ARP entry is a hardware address resolution protocol table, and is used to store the MAC address of the AG connected to the RB. Because the RA is the primary router of the VRRP, and the ARP proxy is enabled on the E1 port, the RA sends an ARP reply message to the RB after receiving the ARP request packet sent by the RB. The ARP reply is the source IP address of the ARP reply. It is the IP address of the AG, and the source MAC address is the VRRP virtual MAC address. If multiple RA devices are attached to the RA and RB The RA sends multiple such ARP reply messages to the RB. The virtual MAC address can be 00-00-5E-00-01-{VRID}, and the RB refreshes the virtual MAC address to the ARP entry. The ARP entry stores the MAC address of the original AG. The address is refreshed to a virtual MAC address. The path in which the RB sends an ARP request to the RA and the RA sends the ARP reply to the RB is as shown by the thick solid line in FIG. 2, and the path in which the RB sends an ARP request to the AG and the ARP sends an ARP reply to the RB. The dotted line in 2 is shown.
在实现本发明过程中, 发明人发现现有技术中至少存在如下问题: 现有技术先将来自 AG的 ARP回复报文中的源 MAC地址刷新到 ARP表 项中, 再将来自 RA的 ARP回复报文中的虚拟 MAC地址刷新到 ARP表项, 使 ARP表项存储的内容由原来正确的 AG的 MAC地址变成虚拟 MAC地址, 导致将 AG的 MAC地址学习错了。 当主用路由器 RA故障或者主用链路故障 时, RA的 E1端口 down掉, 备用路由器 RB升为主用路由器, 此时报文的传 输路径如图 1中标注所示, 下行报文是路由器 RC传给 AG的。 由于 RB在为 备用路由器时, 将 AG的 MAC地址学习错了, 所以在下一次老化时间到达以 获取正确的 AG的 MAC地址之前, RB接收的下行报文由于在 ARP表项中找 不到正确的 AG的 MAC地址, 就直接将该下行报文丟弃, 使下行报文的传输 中断。  In the process of implementing the present invention, the inventor has found that at least the following problems exist in the prior art: The prior art first refreshes the source MAC address in the ARP reply packet from the AG into the ARP entry, and then restores the ARP reply from the RA. The virtual MAC address in the packet is updated to the ARP entry. The content of the ARP entry is changed from the MAC address of the original AG to the virtual MAC address. As a result, the MAC address of the AG is learned incorrectly. When the primary router RA fails or the primary link fails, the E1 port of the RA goes down, and the standby router RB rises to the primary router. The transmission path of the packet is as shown in Figure 1, and the downlink packet is the router RC. To the AG. If the RB is in the ARP entry, the MAC address of the AG is incorrectly learned. Therefore, the downlink packet received by the RB cannot be found in the ARP entry until the next aging time arrives to obtain the correct MAC address of the AG. The MAC address of the AG directly discards the downlink packet and interrupts the transmission of the downlink packet.
发明内容 Summary of the invention
本发明实施例提供一种学习 MAC地址的方法及网元设备, 达到备用路由 器正确学习 MAC地址的目的。  The embodiment of the invention provides a method for learning a MAC address and a network element device, so as to achieve the purpose of the standby router correctly learning the MAC address.
有鉴于此, 本发明实施例提供:  In view of this, the embodiments of the present invention provide:
一种学习 MAC地址的方法, 包括:  A method of learning a MAC address, including:
接收地址解析协议 ARP回复报文组, 所述 ARP回复报文组包括: 第一类 ARP回复报文和第二类 ARP回复报文; 其中,所述第一类 ARP回复报文是源 MAC地址不是虚拟 MAC地址的 ARP回复报文, 所述第二类 ARP回复报文 是源 MAC地址是虚拟 MAC地址的 ARP回复报文;  Receiving an address resolution protocol ARP reply packet group, where the ARP reply packet group includes: a first type ARP reply message and a second type ARP reply message; wherein the first type ARP reply message is a source MAC address An ARP reply packet that is not a virtual MAC address, and the second type of ARP reply packet is an ARP reply packet whose source MAC address is a virtual MAC address.
确定所述 ARP回复报文组中的各报文是所述第一类 ARP回复报文时,获 得所述第一类 ARP回复报文 ,将获得的所述第一类 ARP回复报文中的源 MAC 地址刷新到硬件地址解析协议表中。 一种网元设备, 该设备包括: Determining, in the first type of ARP reply message, the first type of ARP reply message, the first type of ARP reply message is obtained in the ARP reply message group. The source MAC address is flushed to the hardware address resolution protocol table. A network element device, the device comprising:
ARP回复报文组接收单元, 用于接收地址解析协议 ARP回复报文组, 所 述 ARP回复报文组包括: 第一类 ARP回复报文和第二类 ARP回复报文; 其 中, 所述第一类 ARP回复报文是源 MAC地址不是虚拟 MAC地址的 ARP回 复报文, 所述第二类 ARP回复报文是源 MAC地址是虚拟 MAC地址的 ARP 回复报文;  The ARP reply packet receiving unit is configured to receive an address resolution protocol ARP reply packet group, where the ARP reply packet group includes: a first type ARP reply packet and a second type ARP reply packet; wherein, the A type of ARP reply message is an ARP reply message whose source MAC address is not a virtual MAC address, and the second type of ARP reply message is an ARP reply message whose source MAC address is a virtual MAC address.
第一类 ARP回复报文获得单元,用于当所述 ARP回复报文为第一类 ARP 回复报文时, 获得所述第一类 ARP回复报文;  The first type of ARP reply message obtaining unit is configured to obtain the first type of ARP reply message when the ARP reply message is the first type of ARP reply message;
第一类 ARP回复报文刷新单元,用于将所获得的所述第一类 ARP回复报 文中的源 MAC地址刷新到硬件地址解析协议表中。  The first type of ARP reply message refreshing unit is configured to refresh the obtained source MAC address in the first type of ARP reply message into the hardware address resolution protocol table.
本发明实施例通过确定 ARP回复报文组中的报文是第一类 ARP回复报文 时, 获得第一类 ARP回复报文, 并将该类报文中的源 MAC地址刷新到硬件 地址解析协议表中 ,使备用路由器学习到的自身下挂的网关的 MAC地址正确 , 即硬件地址解析协议表中存储的是正确的网关的 MAC地址。 当主用路由器故 障或者主用链路故障,备用路由器升为主用路由器并接收到下行报文时, 就可 以从硬件地址解析协议表中找到正确的备用路由器下挂的网关的 MAC地址, 向该网关传输下行 4艮文, 不会中断下行 4艮文的传输。  When the packet in the ARP reply packet group is the first type of ARP reply packet, the first type of ARP reply packet is obtained, and the source MAC address in the packet is refreshed to the hardware address resolution. In the protocol table, the MAC address of the gateway that is learned by the standby router is correct, that is, the MAC address of the correct gateway is stored in the hardware address resolution protocol table. When the primary router fails or the primary link fails, and the standby router rises to the primary router and receives the downlink packet, it can find the MAC address of the gateway connected to the correct standby router from the hardware address resolution protocol table. The gateway transmits the downlink message, and does not interrupt the transmission of the downlink message.
附图说明 DRAWINGS
图 1是现有技术提供的双归组网图;  1 is a dual-homed network diagram provided by the prior art;
图 2是现有技术提供的 ARP报文传输路径图;  2 is a transmission path diagram of an ARP packet provided by the prior art;
图 3是本发明一实施例提供的学习 MAC地址的方法流程图;  3 is a flowchart of a method for learning a MAC address according to an embodiment of the present invention;
图 4是本发明另一实施例提供的学习 MAC地址的方法流程图;  4 is a flowchart of a method for learning a MAC address according to another embodiment of the present invention;
图 5是本发明又一实施例提供的网元设备结构图;  FIG. 5 is a structural diagram of a network element device according to another embodiment of the present invention; FIG.
图 6是本发明又一实施例提供的网元设备结构图。  FIG. 6 is a structural diagram of a network element device according to another embodiment of the present invention.
具体实施方式 detailed description
参阅图 1和图 3 , 本发明一实施例提供一种学习 MAC地址的方法, 该方 法所适用的双归组网的拓朴结构如图 1所示。 其中, 网关 AG通过两条链路分 别连接到两台接入交换机 SA和 SB , 两台接入交换机 SA和 SB再分别连接到 两台接入路由器 RA和 RB, 假设 RA作为主用路由器, RB作为备用路由器。 学习 MAC地址的方法包括: Referring to FIG. 1 and FIG. 3, an embodiment of the present invention provides a method for learning a MAC address, and a topology structure of the dual-homing network to which the method is applied is shown in FIG. 1 . The gateway AG is connected to the two access switches SA and SB through two links respectively, and the two access switches SA and SB are respectively connected to the two access routers RA and RB, assuming that the RA acts as the primary router, the RB As a backup router. Methods for learning MAC addresses include:
301、在老化时间到达时,备用路由器 RB主动向 RA和 RB下挂的 AG发 起 ARP请求, 并接收来自 AG和 RA的 ARP回复报文, 构成 ARP回复报文 组。  301. When the aging time arrives, the standby router RB actively sends an ARP request to the AGs connected to the RA and the RB, and receives ARP reply packets from the AG and the RA to form an ARP reply packet.
302、 在 ARP回复报文组中, 查找源 IP地址相同的 ARP回复报文, 并将 找到的源 IP地址相同的 ARP回复报文归到相应的小组中。此时, ARP回复报 文组由多个小组组成, 每个小组中的 ARP回复 4艮文具有相同的源 IP地址。  302. In the ARP reply packet group, find the ARP reply packet with the same source IP address, and return the ARP reply packet with the same source IP address to the corresponding group. At this point, the ARP reply message group consists of multiple groups, and the ARP reply in each group has the same source IP address.
对于 AG的 IP地址发生变化的情况,根据路由协议, RA是可以及时获知 AG的新的 IP地址的, 因此, 来自 RA的 ARP回复 4艮文中的源 IP地址是 AG 的当前的 IP地址。 所以在接收的 ARP回复报文组中, 将找到的源 IP地址相 同的 ARP回复报文归到相应的小组中。 此时, ARP回复报文组由多个小组组 成, 每个小组中的两个 ARP回复报文一个来自 RA, 另外一个来自 AG。  For the case where the IP address of the AG changes, according to the routing protocol, the RA can know the new IP address of the AG in time. Therefore, the source IP address in the ARP reply from the RA is the current IP address of the AG. Therefore, in the received ARP reply packet group, the ARP reply packets with the same source IP address are found in the corresponding group. At this time, the ARP reply message group consists of multiple groups. Two ARP reply messages in each group are from the RA and the other one is from the AG.
303、 判断各小组中的各报文是第一类 ARP回复报文还是第二类 ARP回 复报文, 如果是第一类 ARP回复报文, 则执行 304; 如果是第二类 ARP回复 报文, 则执行 305。  303. Determine whether each packet in each group is a first type ARP reply message or a second type ARP reply message, and if it is a first type ARP reply message, execute 304; if it is a second type ARP reply message , then execute 305.
其中, 第一类 ARP回复报文是指, 源 MAC地址不是虚拟 MAC地址的 ARP回复报文, 即源 IP地址是 AG的 IP地址, 源 MAC地址是 AG的 MAC 地址的 ARP回复报文;第二类 ARP回复报文是指,源 MAC地址是虚拟 MAC 地址的 ARP回复报文, 即源 IP地址是 AG的 IP地址, 而源 MAC地址是虚拟 MAC地址的 ARP回复报文。  The first type of ARP reply packet is an ARP reply packet whose source MAC address is not the virtual MAC address, that is, the source IP address is the IP address of the AG, and the source MAC address is the ARP reply packet of the MAC address of the AG. The second type of ARP reply message is that the source MAC address is the ARP reply packet of the virtual MAC address, that is, the source IP address is the IP address of the AG, and the source MAC address is the ARP reply packet of the virtual MAC address.
本 303中是通过各报文中的源 MAC地址判断各小组中的各报文是第一类 ARP回复报文还是第二类 ARP回复报文的。 如果 ARP回复报文中的源 MAC 地址不是虚拟 MAC地址, 而是 AG的 MAC地址, 则该 ARP回复报文是第一 类 ARP回复报文。 如果 ARP回复报文中的源 MAC地址是虚拟 MAC地址, 则该 ARP回复报文是第二类 ARP回复报文。  In the 303, the source MAC address in each packet is used to determine whether each packet in each group is a first type ARP reply message or a second type ARP reply message. If the source MAC address of the ARP reply packet is not the virtual MAC address but the MAC address of the AG, the ARP reply packet is the first type of ARP reply packet. If the source MAC address in the ARP reply packet is a virtual MAC address, the ARP reply packet is a second type of ARP reply packet.
304、 获得第一类 ARP回复报文, 然后执行 306。  304. Obtain a first type of ARP reply message, and then execute 306.
305、 获得第二类 ARP回复报文, 然后执行 306。  305. Obtain a second type of ARP reply message, and then execute 306.
306、 根据预先设置的第二类 ARP回复报文的刷新时间, 将第二类 ARP 回复" ^艮文中的源 MAC地址刷新到硬件地址解析协议表。 RB上预置硬件地址解析协议表和软件地址解析协议表, 正确的硬件地址 解析协议表应该存储 AG的 MAC地址, 软件地址解析协议表用于存储 AG的 IP地址,该硬件地址解析协议表中的 MAC地址与软件地址解析协议表中的 IP 地址存在映射关系。 对于 AG的 IP地址发生变化的情况, 根据路由协议 RB 可以及时获知 AG的新的 IP地址, 将 AG的新的 IP地址自动刷新到软件地址 解析协议表, 保证软件地址解析协议表中的 AG的 IP地址是正确的 AG的 IP 地址。 306. Refresh the source MAC address in the second type of ARP reply to the hardware address resolution protocol table according to the preset refresh time of the second type ARP reply message. The hardware address resolution protocol table and the software address resolution protocol table are preset on the RB, and the correct hardware address resolution protocol table should store the MAC address of the AG, and the software address resolution protocol table is used to store the IP address of the AG in the hardware address resolution protocol table. The MAC address is mapped to the IP address in the software address resolution protocol table. If the IP address of the AG changes, the RB can know the new IP address of the AG in time, and automatically refresh the new IP address of the AG to the software address resolution protocol table to ensure the AG in the software address resolution protocol table. The IP address is the correct IP address of the AG.
其中, 第二类 ARP回复报文中的源 MAC地址刷新到硬件地址解析协议 表的具体实现过程是: 在软件地址解析协议表中找到第二类 ARP回复报文中 的源 IP地址, 根据预置的硬件地址解析协议表中的 MAC地址与软件地址解 析协议表中的 IP地址的映射关系, 将该第二类 ARP回复报文中的源 MAC地 址, 即虚拟 MAC地址刷新到硬件地址解析协议表中。 此时, 硬件地址解析协 议表中存储的内容错误。  The specific implementation process of the source MAC address in the second type of ARP reply message being refreshed to the hardware address resolution protocol table is as follows: The source IP address in the second type of ARP reply message is found in the software address resolution protocol table, according to the pre- The mapping between the MAC address in the hardware address resolution protocol table and the IP address in the software address resolution protocol table, and the source MAC address in the second type ARP reply packet, that is, the virtual MAC address, is flushed to the hardware address resolution protocol. In the table. At this time, the contents stored in the hardware address resolution protocol table are incorrect.
307、 根据预先设置的第一类 ARP回复报文的刷新时间, 将第一类 ARP 回复报文中的源 MAC地址刷新到硬件地址解析协议表中。  307. Refresh the source MAC address in the first type of ARP reply packet to the hardware address resolution protocol table according to the preset refresh time of the first type of ARP reply packet.
其中, 在 RB上预先设置第二类 ARP回复报文的刷新时间在第一类 ARP 回复报文的刷新时间之前, 刷新时间可以在 ms级或者 s级, 上述刷新时间的 起算点可以是: 在获得第二类 ARP回复报文之后。  The refresh time of the second type of ARP reply message is set in advance on the RB before the refresh time of the first type of ARP reply message, and the refresh time may be in the ms level or the s level. The starting point of the refresh time may be: After obtaining the second type of ARP reply message.
其中, 将第一类 ARP回复报文中的源 MAC地址刷新到硬件地址解析协 议表的具体实现过程是: 在软件地址解析协议表中找到第一类 ARP回复报文 中的源 IP地址, 根据预置的硬件地址解析协议表中的 MAC地址与软件地址 解析协议表中的 IP地址的映射关系, 将该第一类 ARP回复报文中的源 MAC 地址刷新到硬件地址解析协议表中。  The specific implementation process of flushing the source MAC address in the first type of ARP reply packet to the hardware address resolution protocol table is as follows:: Find the source IP address in the first type of ARP reply packet in the software address resolution protocol table, according to The mapping between the MAC address in the preset hardware address resolution protocol table and the IP address in the software address resolution protocol table is used to refresh the source MAC address in the first type of ARP reply packet to the hardware address resolution protocol table.
在上述实施例中可以没有 302, 而在 303中直接判断 ARP回复 4艮文组中 的报文是第一类 ARP回复报文还是第二类 ARP回复报文,不影响本发明的实 现。 先刷新到硬件地址解析协议表, 将源 MAC地址不是虚拟 MAC地址的第一类 ARP回复报文后刷新到硬件地址解析协议表,使备用路由器 RB能学习到正确 的 AG的 MAC地址, 即硬件地址解析协议表中存储的是正确的 AG的 MAC 地址。 当主用路由器故障或者主用链路故障, 备用路由器 RB升为主用路由器 接收到下行报文时, 就可以从硬件地址解析协议表中找到正确的 AG的 MAC 地址, 向该 AG传输下行报文, 不会中断下行报文的传输。 In the above embodiment, there may be no 302, and in 303, it is directly determined whether the packet in the ARP reply packet is a first type ARP reply message or a second type ARP reply message, which does not affect the implementation of the present invention. Refresh to the hardware address resolution protocol table, and then refresh the first type of ARP reply packet whose source MAC address is not the virtual MAC address to the hardware address resolution protocol table, so that the standby router RB can learn correctly. The MAC address of the AG, that is, the MAC address stored in the hardware address resolution protocol table is the correct AG. When the primary router fails or the primary link fails, the standby router RB rises to receive the downlink packet from the primary router, and then finds the correct MAC address of the AG from the hardware address resolution protocol table, and transmits the downlink packet to the AG. , will not interrupt the transmission of downlink messages.
参阅图 4, 本发明另一实施例提供一种学习 MAC地址的方法, 该方法包 括:  Referring to FIG. 4, another embodiment of the present invention provides a method for learning a MAC address, where the method includes:
401、在老化时间到达时,备用路由器 RB主动向 RA和 RB下挂的 AG发 起 ARP请求, 并接收来自 AG和 RA的 ARP回复报文, 构成 ARP回复报文 组。  401. When the aging time arrives, the standby router RB actively sends an ARP request to the AG connected to the RA and the RB, and receives the ARP reply packet from the AG and the RA to form an ARP reply packet.
402- 405与 302- 305相同, 此处不再赘述。  402-405 is the same as 302-305, and will not be described here.
406、 删除 405中获得的第二类 ARP回复报文。  406. Delete the second type of ARP reply packet obtained in 405.
407、 将第一类 ARP回复报文中的源 MAC地址刷新到硬件地址解析协议 表中。  407. Refresh the source MAC address in the first type of ARP reply packet to the hardware address resolution protocol table.
其中, 406既可以在 407之后执行, 也可以同 407同时执行, 不影响本 发明的实现。  Wherein, 406 may be executed after 407 or concurrently with 407, without affecting the implementation of the present invention.
在本发明实施例中可以没有上述 402, 而在 403中直接判断 ARP回复报 文组中的报文是第一类 ARP回复报文还是第二类 ARP回复报文,不影响本发 明的实现。  In the embodiment of the present invention, the foregoing 402 may be omitted, and in the 403, the message in the ARP reply packet group is directly determined to be the first type of ARP reply message or the second type of ARP reply message, which does not affect the implementation of the present invention.
上述实施例也可以釆用如下方式实现: 在老化时间到达时, 备用路由器 RB主动向 RA和 RB下挂的 AG发起 ARP请求, 先接收到来自 AG的 ARP 回复 文, 通过判断来自 AG的 ARP回复 文中的源 MAC地址确定该 ARP 回复报文是第一类 ARP回复报文, 将第一类 ARP回复报文中的源 MAC地址 刷新到硬件地址解析协议表; 再接收来自 RA的 ARP回复 文, 通过判断来 自 RA的 ARP回复报文中的源 MAC地址确定该 ARP回复报文是第二类 ARP 回复报文, 将第二类 ARP回复报文删除。 删除,将源 MAC地址不是虚拟 MAC地址的第一类 ARP回复报文刷新到硬件 地址解析协议表, 使备用路由器 RB能学习到正确的 AG的 MAC地址, 即硬 件地址解析协议表中存储的是正确的 AG的 MAC地址。 当主用路由器故障或 者主用链路故障, 备用路由器 RB升为主用路由器接收到下行报文时, 就可以 从硬件地址解析协议表中找到正确的 AG的 MAC地址, 向该 AG传输下行才艮 文, 不会中断下行报文的传输。 The foregoing embodiment may also be implemented in the following manner: When the aging time arrives, the standby router RB actively initiates an ARP request to the AG that is connected to the RA and the RB, and first receives the ARP reply message from the AG, and determines the ARP reply from the AG. The source MAC address in the text determines that the ARP reply packet is the first type of ARP reply packet, and the source MAC address in the first type of ARP reply packet is flushed to the hardware address resolution protocol table; and the ARP reply message from the RA is received. The source MAC address in the ARP reply packet from the RA is determined to determine that the ARP reply packet is the second type of ARP reply packet, and the second type of ARP reply packet is deleted. Delete, the first type of ARP reply packet whose source MAC address is not the virtual MAC address is flushed to the hardware address resolution protocol table, so that the standby router RB can learn the correct MAC address of the AG, that is, the hardware address resolution protocol table stores The correct MAC address of the AG. When the primary router fails or When the primary link fails, the standby router RB rises to receive the downlink packet from the primary router, and can find the correct MAC address of the AG from the hardware address resolution protocol table, and transmits the downlink to the AG. Interrupt the transmission of downlink messages.
本领域普通技术人员可以理解实现上述实施例方法中的全部或者部分是 可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读取存 储介质中, 如: ROM/RAM, 磁盘、 光盘等。  A person skilled in the art can understand that all or part of the method for implementing the above embodiments can be completed by a program to instruct related hardware, and the program can be stored in a computer readable storage medium, such as: ROM/RAM, disk. , CD, etc.
参阅图 5, 本发明又一实施例提供一种网元设备, 该设备包括: ARP回复 报文组接收单元 501、 判断单元 502、 第一类 ARP回复报文获得单元 503、 第 一类 ARP回复报文刷新单元 504;  Referring to FIG. 5, another embodiment of the present invention provides a network element device, where the device includes: an ARP reply packet receiving unit 501, a determining unit 502, a first type ARP reply packet obtaining unit 503, and a first type ARP reply. Message refreshing unit 504;
ARP回复报文组接收单元 501 , 接收解析协议 ARP回复报文组, ARP回 复报文组包括: 第一类 ARP回复报文和第二类 ARP回复报文; 其中, 第一类 ARP回复报文是源 MAC地址不是虚拟 MAC地址的 ARP回复报文, 第二类 ARP回复报文是源 MAC地址是虚拟 MAC地址的 ARP回复报文; 判断单元 502, 判断接收的 ARP回复报文组中的各报文是第一类 ARP回复报文还是第 二类 ARP回复报文; 第一类 ARP回复报文获得单元 503 , 当判断单元 502的 判断结果为是第一类 ARP回复报文时, 获得第一类 ARP回复报文; 第一类 ARP回复报文刷新单元 504 , 将获得的第一类 ARP回复报文中的源 MAC地 址刷新到硬件地址解析协议表中。  The ARP reply packet receiving unit 501 receives the ARP reply packet group, and the ARP reply packet group includes: a first type ARP reply message and a second type ARP reply message; wherein, the first type ARP reply message The ARP reply packet whose source MAC address is not the virtual MAC address, and the second type of ARP reply packet is the ARP reply packet whose source MAC address is the virtual MAC address. The determining unit 502 determines each of the received ARP reply packet groups. Whether the message is the first type of ARP reply message or the second type of ARP reply message; the first type of ARP reply message obtaining unit 503, when the judgment result of the determining unit 502 is the first type of ARP reply message, obtain the first The first type of ARP reply message refreshing unit 504 is configured to refresh the source MAC address in the obtained first type ARP reply message into the hardware address resolution protocol table.
在 ARP回复报文组接收单元 501和判断单元 502之间, 该设备还包括: 划组单元 505, 用于在接收的 ARP回复 ^艮文组中, 查找源 IP地址相同的 Between the ARP reply packet receiving unit 501 and the determining unit 502, the device further includes: a scribing unit 505, configured to search for the same source IP address in the received ARP reply group
ARP回复报文, 并将找到的源 IP地址相同的 ARP回复报文归到相应的小组; 判断单元 502判断 ARP回复报文组中的各报文是第一类 ARP回复报文还 是第二类 ARP回复报文具体是: 判断被划归到各小组中的报文是第一类 ARP 回复报文还是第二类 ARP回复报文。 The ARP replies to the packet, and the ARP reply packet with the same source IP address is found to be the corresponding group. The determining unit 502 determines whether the packet in the ARP reply packet group is the first type of ARP reply packet or the second type. The ARP reply message is specifically: It is judged whether the message classified in each group is the first type ARP reply message or the second type ARP reply message.
该设备还包括:  The device also includes:
第二类 ARP回复 文获得单元 506, 当判断单元 502的判断结果为第二 类 ARP回复报文时, 获得第二类 ARP回复报文。  The second type ARP reply message obtaining unit 506 obtains the second type ARP reply message when the judgment result of the determining unit 502 is the second type ARP reply message.
刷新时间设置单元 507, 设置第二类 ARP回复报文的刷新时间在第一类 ARP回复报文的刷新时间之前; 第二类 ARP回复报文刷新单元 508 , 在设置的第二类 ARP回复报文的刷 新时间, 将获得的第二类 ARP回复报文中的虚拟 MAC地址刷新到硬件地址 解析协议表; a refresh time setting unit 507, configured to set a refresh time of the second type of ARP reply message before the refresh time of the first type of ARP reply message; The second type of ARP reply message refreshing unit 508 is configured to refresh the virtual MAC address in the obtained second type ARP reply message to the hardware address resolution protocol table in the refresh time of the second type of ARP reply message.
第一类 ARP回复报文刷新单元 504将获得的第一类 ARP回复报文中的源 MAC地址刷新到硬件地址解析协议表中具体是:在设置的第一类 ARP回复报 文的刷新时间, 将获得的第一类 ARP回复报文中的源 MAC地址刷新到硬件 地址解析协议表中。  The first type ARP reply packet refreshing unit 504 refreshes the source MAC address in the obtained first type ARP reply packet to the hardware address resolution protocol table, specifically: the refresh time of the first type ARP reply packet that is set, The source MAC address in the obtained first type ARP reply packet is flushed to the hardware address resolution protocol table.
本发明实施例中的第二类 ARP回复报文刷新单元 508根据预先设置的第 二类 ARP回复报文的刷新时间, 将源 MAC地址是虚拟 MAC地址的第二类 ARP回复报文先刷新到硬件地址解析协议表, 第一类 ARP回复报文刷新单元 504根据预先设置的第一类 ARP回复报文的刷新时间,将源 MAC地址不是虚 拟 MAC地址的第一类 ARP回复报文后刷新到硬件地址解析协议表, 使备用 路由器 RB能学习到正确的 AG的 MAC地址, 即硬件地址解析协议表中存储 的是正确的 AG的 MAC地址。 当主用路由器故障或者主用链路故障, 备用路 由器 RB升为主用路由器接收到下行报文时,就可以从硬件地址解析协议表中 找到正确的 AG的 MAC地址, 向该 AG传输下行报文, 不会中断下行报文的 传输。  The second type ARP reply packet refreshing unit 508 in the embodiment of the present invention first refreshes the second type ARP reply packet whose source MAC address is the virtual MAC address according to the refresh time of the second type ARP reply packet set in advance. The hardware address resolution protocol table, the first type ARP reply message refreshing unit 504 refreshes the first type ARP reply message whose source MAC address is not the virtual MAC address, according to the preset refresh time of the first type ARP reply message. The hardware address resolution protocol table enables the standby router RB to learn the correct MAC address of the AG, that is, the MAC address of the correct AG is stored in the hardware address resolution protocol table. When the primary router fails or the primary link fails, the standby router RB rises to receive the downlink packet from the primary router, and then finds the correct MAC address of the AG from the hardware address resolution protocol table, and transmits the downlink packet to the AG. , will not interrupt the transmission of downlink messages.
参阅图 6, 本发明又一实施例提供一种网元设备, 该设备包括: ARP回复 报文组接收单元 601、 判断单元 602、 第一类 ARP回复报文获得单元 603、 第 一类 ARP回复报文刷新单元 604、 划组单元 605, 第二类 ARP回复报文获得 单元 606、 上述单元功能与连接关系与实施例三中的相同, 此处不再赘述; 该设备还包括:  Referring to FIG. 6, another embodiment of the present invention provides a network element device, where the device includes: an ARP reply packet receiving unit 601, a determining unit 602, a first type ARP reply packet obtaining unit 603, and a first type ARP reply. The message refreshing unit 604, the grouping unit 605, the second type of ARP reply message obtaining unit 606, the above-mentioned unit function and the connection relationship are the same as those in the third embodiment, and the details are not described herein again;
第二类 ARP回复报文删除单元 607 , 删除获得的第二类 ARP回复报文。 本发明实施例中的第二类 ARP回复报文删除单元 607将源 MAC地址是 虚拟 MAC地址的第二类 ARP回复报文删除, 第一类 ARP回复报文刷新单元 604将源 MAC地址不是虚拟 MAC地址的第一类 ARP回复报文刷新到硬件地 址解析协议表, 使备用路由器 RB能学习到正确的 AG的 MAC地址, 即硬件 地址解析协议表中存储的是正确的 AG的 MAC地址。 当主用路由器故障或者 主用链路故障, 备用路由器 RB升为主用路由器接收到下行报文时, 就可以从 硬件地址解析协议表中找到正确的 AG的 MAC地址,向该 AG传输下行报文, 不会中断下行报文的传输。 介绍, 对于本领域的一般技术人员, 依据本发明实施例的思想, 在具体实施方 式及应用范围上均会有改变之处, 综上所述, 本说明书内容不应理解为对本发 明的限制。 The second type ARP reply message deleting unit 607 deletes the obtained second type ARP reply message. The second type ARP reply message deleting unit 607 in the embodiment of the present invention deletes the second type ARP reply message whose source MAC address is the virtual MAC address, and the first type ARP reply message refreshing unit 604 sets the source MAC address to be virtual. The first type of ARP reply packet of the MAC address is flushed to the hardware address resolution protocol table, so that the standby router RB can learn the correct MAC address of the AG, that is, the MAC address of the correct AG is stored in the hardware address resolution protocol table. When the primary router fails or the primary link fails, and the standby router RB rises to receive the downlink packet for the primary router, it can The MAC address of the correct AG is found in the hardware address resolution protocol table, and the downlink packet is transmitted to the AG without interrupting the transmission of the downlink packet. The description of the present invention is not limited to the scope of the present invention.

Claims

权 利 要 求 Rights request
1、 一种学习 MAC地址的方法, 其特征在于, 包括:  A method for learning a MAC address, comprising:
接收地址解析协议 ARP回复报文组, 所述 ARP回复报文组包括: 第一类 ARP回复报文和第二类 ARP回复报文; 其中,所述第一类 ARP回复报文为源 MAC地址不是虚拟 MAC地址的 ARP回复报文, 所述第二类 ARP回复报文 为源 MAC地址是虚拟 MAC地址的 ARP回复 4艮文;  Receiving an address resolution protocol ARP reply packet group, where the ARP reply packet group includes: a first type ARP reply message and a second type ARP reply message; wherein the first type ARP reply message is a source MAC address The ARP reply packet is not a virtual MAC address, and the second type of ARP reply packet is an ARP reply with a source MAC address being a virtual MAC address.
确定所述 ARP回复报文组中的各报文是所述第一类 ARP回复报文时,获 得所述第一类 ARP回复报文 ,将获得的所述第一类 ARP回复报文中的源 MAC 地址刷新到硬件地址解析协议表中。  Determining, in the first type of ARP reply message, the first type of ARP reply message, the first type of ARP reply message is obtained in the ARP reply message group. The source MAC address is flushed to the hardware address resolution protocol table.
2、 根据权利要求 1所述的方法, 其特征在于:  2. The method of claim 1 wherein:
在将所述第一类 ARP回复报文中的源 MAC地址刷新到所述硬件地址解 析协议表中之前, 该方法还包括:  Before the source MAC address in the first type of ARP reply packet is flushed to the hardware address resolution protocol table, the method further includes:
确定所述 ARP回复报文组中的各报文是所述第二类 ARP回复报文时,获 得所述第二类 ARP回复报文;  Determining, when the packet in the ARP reply packet group is the second type of ARP reply packet, obtaining the second type of ARP reply packet;
设置所述第二类 ARP回复报文的刷新时间在所述第一类 ARP回复报文的 刷新时间之前;  Setting a refresh time of the second type of ARP reply message before the refresh time of the first type of ARP reply message;
在设置的所述第二类 ARP 回复报文的刷新时间, 将所述获得的第二类 ARP回复 ^艮文中的虚拟 MAC地址刷新到所述硬件地址解析协议表;  And refreshing, in the refresh time of the second type of ARP reply message, the obtained virtual MAC address in the second type of ARP reply message to the hardware address resolution protocol table;
将所述第一类 ARP回复报文中的源 MAC地址刷新到所述硬件地址解析 协议表具体为:  Refreshing the source MAC address in the first type of ARP reply packet to the hardware address resolution protocol table is specifically:
在设置的所述第一类 ARP 回复报文的刷新时间, 将所述获得的第一类 ARP回复 ^艮文中的源 MAC地址刷新到硬件地址解析协议表。  The source MAC address in the obtained first type ARP reply message is flushed to the hardware address resolution protocol table in the refresh time of the first type ARP reply message.
3、 根据权利要求 1所述的方法, 其特征在于:  3. The method of claim 1 wherein:
该方法还包括:  The method also includes:
确定所述 ARP回复报文组中的各报文是所述第二类 ARP回复报文时,获 得所述第二类 ARP回复报文;  Determining, when the packet in the ARP reply packet group is the second type of ARP reply packet, obtaining the second type of ARP reply packet;
删除所述获得的第二类 ARP回复报文。  The obtained second type ARP reply message is deleted.
4、 根据权利要求 1、 2或 3所述的方法, 其特征在于, 还包括: 判断所述 ARP回复报文组中的各报文是所述第一类 ARP回复报文还是所 属第二类 ARP回复报文。 The method according to claim 1, 2 or 3, further comprising: determining whether each packet in the ARP reply packet group is the first type ARP reply packet or It belongs to the second type of ARP reply message.
5、 根据权利要求 4所述的方法, 其特征在于:  5. The method of claim 4, wherein:
在判断所述 ARP回复报文组中的各报文是所述第一类 ARP回复报文还是 所述第二类 ARP回复报文之前, 该方法还包括:  Before determining whether the packet in the ARP reply packet group is the first type of ARP reply message or the second type of ARP reply message, the method further includes:
在所述 ARP回复报文组中, 查找源 IP地址相同的 ARP回复报文, 并将 找到的源 IP地址相同的 ARP回复报文划归到相应的小组;  In the ARP reply packet group, the ARP reply packet with the same source IP address is searched, and the ARP reply packet with the same source IP address is classified into the corresponding group;
判断所述 ARP回复报文组中的各报文是第一类 ARP回复报文还是第二类 ARP回复 文具体为:  Determining whether each packet in the ARP reply packet group is a first type ARP reply message or a second type ARP reply message is specifically:
判断所述各小组中的报文是第一类 ARP回复报文还是第二类 ARP回复报 文。  It is determined whether the packet in the group is a first type ARP reply message or a second type ARP reply message.
6、 一种网元设备, 其特征在于, 包括:  6. A network element device, comprising:
ARP回复报文组接收单元, 用于接收地址解析协议 ARP回复报文组, 所 述 ARP回复报文组包括: 第一类 ARP回复报文和第二类 ARP回复报文; 其 中, 所述第一类 ARP回复报文是源 MAC地址不是虚拟 MAC地址的 ARP回 复报文, 所述第二类 ARP回复报文是源 MAC地址是虚拟 MAC地址的 ARP 回复报文;  The ARP reply packet receiving unit is configured to receive an address resolution protocol ARP reply packet group, where the ARP reply packet group includes: a first type ARP reply packet and a second type ARP reply packet; wherein, the A type of ARP reply message is an ARP reply message whose source MAC address is not a virtual MAC address, and the second type of ARP reply message is an ARP reply message whose source MAC address is a virtual MAC address.
第一类 ARP回复报文获得单元,用于当所述 ARP回复报文为第一类 ARP 回复报文时, 获得所述第一类 ARP回复报文;  The first type of ARP reply message obtaining unit is configured to obtain the first type of ARP reply message when the ARP reply message is the first type of ARP reply message;
第一类 ARP回复报文刷新单元,用于将所获得的所述第一类 ARP回复报 文中的源 MAC地址刷新到硬件地址解析协议表中。  The first type of ARP reply message refreshing unit is configured to refresh the obtained source MAC address in the first type of ARP reply message into the hardware address resolution protocol table.
7、 根据权利要求 6所述的设备, 其特征在于:  7. Apparatus according to claim 6 wherein:
该设备还包括:  The device also includes:
第二类 ARP回复报文获得单元,用于当所述 ARP回复报文为第二类 ARP 回复报文时, 获得所述第二类 ARP回复报文;  The second type of ARP reply message obtaining unit is configured to obtain the second type of ARP reply message when the ARP reply message is the second type of ARP reply message;
刷新时间设置单元, 用于设置所述第二类 ARP回复报文的刷新时间在所 述第一类 ARP回复报文的刷新时间之前;  a refresh time setting unit, configured to set a refresh time of the second type of ARP reply message before the refresh time of the first type of ARP reply message;
第二类 ARP回复报文刷新单元,用于在设置的所述第二类 ARP回复报文 的刷新时间, 将获得的所述第二类 ARP回复报文中的虚拟 MAC地址刷新到 所述硬件地址解析协议表; 所述第一类 ARP回复报文刷新单元将获得的所述第一类 ARP回复报文中 的源 MAC 地址刷新到所述硬件地址解析协议表中是: 在设置的所述第一类 ARP回复报文的刷新时间, 将获得的所述第一类 ARP回复报文中的源 MAC 地址刷新到所述硬件地址解析协议表中。 And a second type of ARP reply message refreshing unit, configured to refresh the obtained virtual MAC address in the second type of ARP reply message to the hardware in the refresh time of the set second type ARP reply message Address resolution protocol table; The first type of ARP reply message refreshing unit refreshes the source MAC address in the first type of ARP reply message to the hardware address resolution protocol table: The source MAC address in the obtained first type ARP reply packet is flushed to the hardware address resolution protocol table.
8、 根据权利要求 6所述的设备, 其特征在于:  8. Apparatus according to claim 6 wherein:
该设备还包括:  The device also includes:
第二类 ARP回复报文获得单元,用于当所述 ARP回复报文为第二类 ARP 回复报文时, 获得所述第二类 ARP回复报文;  The second type of ARP reply message obtaining unit is configured to obtain the second type of ARP reply message when the ARP reply message is the second type of ARP reply message;
第二类 ARP回复报文删除单元,用于删除所述获得的第二类 ARP回复报 文。  The second type of ARP reply message deleting unit is configured to delete the obtained second type ARP reply message.
9、 根据权利要求 6、 7或 8所述的设备, 其特征在于, 还包括:  9. The device according to claim 6, 7 or 8, further comprising:
判断单元,用于判断所述 ARP回复报文组中的各报文是第一类 ARP回复 报文还是第二类 ARP回复报文。  The determining unit is configured to determine whether each packet in the ARP reply packet group is a first type ARP reply message or a second type ARP reply message.
10、 根据权利要求 9所述的设备, 其特征在于:  10. Apparatus according to claim 9 wherein:
在 ARP回复报文组接收单元和判断单元之间, 该设备还包括:  The device further includes: between the ARP reply packet receiving unit and the determining unit, the device further includes:
划组单元, 用于在接收的所述 ARP回复 4艮文组中, 查找源 IP地址相同的 ARP回复报文,并将找到的源 IP地址相同的 ARP回复报文划归到相应的小组; 所述判断单元判断所述 ARP回复报文组中的各报文是第一类 ARP回复报 文还是第二类 ARP回复报文是:判断所述各小组中的报文是第一类 ARP回复 报文还是第二类 ARP回复报文。  The mapping unit is configured to: in the received ARP reply group, search for ARP reply packets with the same source IP address, and assign the ARP reply packets with the same source IP address to the corresponding group; The determining unit determines whether each packet in the ARP reply packet group is a first type ARP reply message or a second type ARP reply message is: determining that the packet in the group is a first type ARP reply The message is still the second type of ARP reply message.
PCT/CN2008/071439 2007-06-29 2008-06-26 Method for studying mac address and network element apparatus WO2009003394A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN200710129551.8 2007-06-29
CNB2007101295518A CN100490411C (en) 2007-06-29 2007-06-29 Method for studying MAC address and network element apparatus

Publications (1)

Publication Number Publication Date
WO2009003394A1 true WO2009003394A1 (en) 2009-01-08

Family

ID=38976760

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2008/071439 WO2009003394A1 (en) 2007-06-29 2008-06-26 Method for studying mac address and network element apparatus

Country Status (2)

Country Link
CN (1) CN100490411C (en)
WO (1) WO2009003394A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102420768A (en) * 2011-12-15 2012-04-18 北京星网锐捷网络技术有限公司 Link switching method and device, data transmission method and device, and network equipment
US9197721B2 (en) 2011-09-29 2015-11-24 Hangzhou H3C Technologies Co., Ltd. Learning a MAC address

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100490411C (en) * 2007-06-29 2009-05-20 华为技术有限公司 Method for studying MAC address and network element apparatus
CN103259727B (en) 2012-08-31 2016-12-28 杭州华三通信技术有限公司 A kind of message forwarding method and equipment
CN102868616B (en) * 2012-09-21 2015-07-08 华为技术有限公司 Method for establishing virtual MAC (Media Access Control) address table item in network as well as router and system
CN103491000B (en) * 2013-09-17 2016-09-28 烽火通信科技股份有限公司 The management system and method for Virtual Router Redundancy Protocol virtual IP address and MAC
CN104468855B (en) * 2013-09-25 2018-04-03 阿里巴巴集团控股有限公司 The treating method and apparatus of ARP message
CN104869063B (en) * 2014-02-21 2019-02-12 华为技术有限公司 Host routes processing method and relevant device and communication system in virtual subnet
CN105530187B (en) * 2015-12-14 2019-06-14 小米科技有限责任公司 Physical address acquisition methods and device
CN105827532B (en) * 2016-05-12 2019-08-30 深圳市蜂联科技有限公司 A kind of router is to the discovery method and conversion method for hanging STA real MAC under repeater
CN112153169B (en) * 2020-08-24 2022-03-25 烽火通信科技股份有限公司 VMAC high-speed address learning method and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1505334A (en) * 2002-12-04 2004-06-16 联想(北京)有限公司 Dynamic resolution method of a single IP address multiple hardware address
CN1607772A (en) * 2003-10-14 2005-04-20 华为技术有限公司 Method for realizing data transfer backup through address interpretation protocol messages
CN101075933A (en) * 2007-06-29 2007-11-21 华为技术有限公司 Method for studying MAC address and network element apparatus

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1505334A (en) * 2002-12-04 2004-06-16 联想(北京)有限公司 Dynamic resolution method of a single IP address multiple hardware address
CN1607772A (en) * 2003-10-14 2005-04-20 华为技术有限公司 Method for realizing data transfer backup through address interpretation protocol messages
CN101075933A (en) * 2007-06-29 2007-11-21 华为技术有限公司 Method for studying MAC address and network element apparatus

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9197721B2 (en) 2011-09-29 2015-11-24 Hangzhou H3C Technologies Co., Ltd. Learning a MAC address
CN102420768A (en) * 2011-12-15 2012-04-18 北京星网锐捷网络技术有限公司 Link switching method and device, data transmission method and device, and network equipment

Also Published As

Publication number Publication date
CN101075933A (en) 2007-11-21
CN100490411C (en) 2009-05-20

Similar Documents

Publication Publication Date Title
WO2009003394A1 (en) Method for studying mac address and network element apparatus
KR100703488B1 (en) Method and apparatus for state transition backup router in a router redundancy system
WO2012075731A1 (en) Method and device for link fault detecting and recovering based on arp interaction
CN108270602B (en) Method, device and system for detecting data link
WO2013053266A1 (en) Message learning method, device and system
WO2010020103A1 (en) Method and device for providing service for the duplicate mac address users
US20150334019A1 (en) Routing control method and non-transitory computer-readable recording medium storing routing control program
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands
Cisco AppleTalk Commands

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: 08757848

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: 08757848

Country of ref document: EP

Kind code of ref document: A1