CN100337446C - Method for rapid access neighbor device - Google Patents
Method for rapid access neighbor device Download PDFInfo
- Publication number
- CN100337446C CN100337446C CNB2005101177739A CN200510117773A CN100337446C CN 100337446 C CN100337446 C CN 100337446C CN B2005101177739 A CNB2005101177739 A CN B2005101177739A CN 200510117773 A CN200510117773 A CN 200510117773A CN 100337446 C CN100337446 C CN 100337446C
- Authority
- CN
- China
- Prior art keywords
- address
- neighbor
- access control
- media access
- recorded
- Prior art date
- Legal status (The legal status 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 status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
- Small-Scale Networks (AREA)
Abstract
Description
技术领域technical field
本发明涉及一种快速访问邻居设备的方法。The invention relates to a method for quickly accessing neighbor equipment.
背景技术Background technique
在一个以太网广播域内,IP地址在同一网段内的两台设备,互称为邻居设备。当网络中的一台网络设备需要访问它的邻居设备时,这台网络设备首先根据该邻居设备的IP地址去查询自身的地址解析协议(ARP,AddressResolution Protocol)表,判断在ARP表内是否存在与该邻居设备IP地址对应的ARP表项,如果存在,则获得与该邻居设备IP地址对应的ARP表项,实现对邻居设备的访问;如果不存在,则向邻居设备所在的网段广播发送ARP请求报文,待邻居设备收到并返回ARP应答报文时,网络设备根据邻居设备返回的ARP应答报文,获得与邻居设备IP地址对应的ARP表项。在本文的描述中,为了使网络设备与其邻居设备进行区别,将访问其邻居设备的网络设备称为主设备。这里,所述的根据邻居设备返回的ARP应答报文获得与邻居设备IP地址对应的ARP表项为:主设备在收到邻居设备返回的ARP应答报文时,会从ARP应答报文中获得与该邻居设备IP地址对应的介质访问控制(MAC)地址,以及根据ARP应答报文进入主设备的端口学习到与邻居设备MAC地址对应的出端口;将学习到的IP与MAC地址和出端口之间的对应关系作为一个ARP表项记录在ARP表中。In an Ethernet broadcast domain, two devices with IP addresses in the same network segment are called neighbor devices. When a network device in the network needs to access its neighbor device, the network device first checks its own Address Resolution Protocol (ARP, Address Resolution Protocol) table according to the IP address of the neighbor device, and judges whether the address resolution protocol (ARP) exists in the ARP table. If the ARP entry corresponding to the IP address of the neighbor device exists, obtain the ARP entry corresponding to the IP address of the neighbor device to realize access to the neighbor device; if it does not exist, broadcast to the network segment where the neighbor device is located When the neighbor device receives the ARP request message and returns an ARP reply message, the network device obtains the ARP entry corresponding to the IP address of the neighbor device according to the ARP reply message returned by the neighbor device. In the description herein, in order to distinguish a network device from its neighbor devices, a network device accessing its neighbor devices is called a master device. Here, the ARP entry corresponding to the IP address of the neighbor device is obtained according to the ARP response message returned by the neighbor device: when the master device receives the ARP response message returned by the neighbor device, it will obtain the ARP entry from the ARP response message. The media access control (MAC) address corresponding to the IP address of the neighbor device, and the port that enters the master device according to the ARP reply message learns the outgoing port corresponding to the MAC address of the neighboring device; the learned IP and MAC address and the outgoing port The correspondence between them is recorded in the ARP table as an ARP entry.
在现有技术中,有些ARP表中并不记录MAC地址与出端口之间的对应关系,只将IP地址与MAC地址之间的对应关系作为一个表项记录在ARP表中。这种情况下,当主设备需要访问其邻居设备时,则首先根据邻居设备的IP地址在自身的存储ARP表中查找得到与该IP地址对应的MAC地址,然后再根据查找得到的MAC地址在自身存储的二层转发表中查找得到与该MAC地址对应的出端口,通过查找得到的MAC地址和出端口实现对邻居设备的访问。当主设备需要记录邻居设备IP地址和MAC地址与出端口之间的对应关系时,则主设备根据邻居设备返回的ARP应答报文获得该邻居设备的MAC地址和出端口,并分别将IP地址与MAC地址的对应关系记录在ARP表中、将MAC地址与出端口之间的对应关系记录在二层转发表中。其中,所述的二层转发表是存储在网络设备内,用来记录网络设备的MAC地址和出端口之间的对应关系。In the prior art, some ARP tables do not record the correspondence between MAC addresses and outgoing ports, but only record the correspondence between IP addresses and MAC addresses as an entry in the ARP table. In this case, when the master device needs to access its neighbor device, it first searches its own storage ARP table according to the IP address of the neighbor device to obtain the MAC address corresponding to the IP address, and then according to the found MAC The outbound port corresponding to the MAC address is found in the stored Layer 2 forwarding table, and the neighbor device is accessed through the found MAC address and outbound port. When the master device needs to record the correspondence between the IP address and MAC address of the neighbor device and the outbound port, the master device obtains the MAC address and outbound port of the neighbor device according to the ARP reply packet returned by the neighbor The corresponding relationship between MAC addresses is recorded in the ARP table, and the corresponding relationship between MAC addresses and outgoing ports is recorded in the Layer 2 forwarding table. Wherein, the layer-2 forwarding table is stored in the network device, and is used to record the correspondence between the MAC address of the network device and the outgoing port.
同样,对于网络中的骨干设备,如路由器或三层交换机,当要传输业务数据时,如果在自身的ARP表中查找不到当前要访问的邻居设备的ARP表项时,则会广播发送ARP请求报文。但是,从发送ARP请求报文到收到ARP应答报文,主设备可能会因为网络传输速度和邻居设备对ARP请求报文的处理速度,等待几百毫秒甚至数秒钟。这样长时间的等待,在传统单纯数据传输的网络中可能不会产生太大的影响,但对于现有IP网络中的IP电话、数字电视、电子商务等业务来讲,数秒钟的延时会很大程度的影响服务质量,尤其对于网络中的骨干设备,经过数秒钟流量的延时会导致几个GB甚至几十个GB报文的丢弃。Similarly, for backbone devices in the network, such as routers or layer-3 switches, when business data is to be transmitted, if the ARP entry of the neighbor device to be accessed cannot be found in its own ARP table, it will broadcast and send ARP request message. However, from sending the ARP request message to receiving the ARP reply message, the master device may wait hundreds of milliseconds or even several seconds due to the network transmission speed and the processing speed of the neighbor device for the ARP request message. Such a long wait may not have much impact on the traditional pure data transmission network, but for IP telephony, digital TV, e-commerce and other services in the existing IP network, the delay of several seconds will It affects the quality of service to a great extent, especially for the backbone equipment in the network, after a few seconds of traffic delay, several gigabytes or even dozens of gigabytes of packets will be discarded.
发明内容Contents of the invention
有鉴于此,本发明的主要目的在于提供一种快速访问邻居设备的方法,应用该方法可以实现对邻居设备的快速访问。In view of this, the main purpose of the present invention is to provide a method for quickly accessing neighboring devices, and the method can be used to realize fast accessing to neighboring devices.
为达到上述目的,本发明的技术方案是这样实现的:In order to achieve the above object, technical solution of the present invention is achieved in that way:
一种快速访问邻居设备的方法,网络设备记录自身邻居设备的IP地址,该方法包括以下步骤:A method for quickly accessing neighbor equipment, the network equipment records the IP address of its own neighbor equipment, the method comprises the following steps:
A、在网络设备记录自身邻居设备的IP地址之后,根据记录的邻居设备的IP地址,获得并记录所述记录的邻居设备中的每个邻居设备IP地址与该IP地址对应的介质访问控制地址和出端口之间的对应关系;A. After the network device records the IP address of its own neighbor device, according to the recorded IP address of the neighbor device, obtain and record the media access control address corresponding to each neighbor device IP address in the recorded neighbor device and the IP address Correspondence between the port and the output port;
B、当需要访问邻居设备时,根据要访问的邻居设备的IP地址,在步骤A记录的所有对应关系中查找,获得与要访问的IP地址对应的介质访问控制地址和出端口,访问邻居设备。B. When it is necessary to access the neighbor device, according to the IP address of the neighbor device to be accessed, search in all the corresponding relationships recorded in step A, obtain the media access control address and the egress port corresponding to the IP address to be accessed, and access the neighbor device .
其中,设置邻居表,所述记录邻居设备的IP地址为,将邻居设备的IP地址记录在邻居表内。Wherein, a neighbor table is set, and the recording of the IP address of the neighbor device is to record the IP address of the neighbor device in the neighbor table.
其中,所述的邻居设备为所有邻居设备中的部分邻居设备。Wherein, the neighbor devices are part of all neighbor devices.
其中,步骤A中,所述获得每个邻居设备的IP地址与该IP地址相应的介质访问控制地址和出端口之间的对应关系为:Wherein, in step A, the corresponding relationship between the obtained IP address of each neighbor device and the corresponding media access control address and outgoing port of the IP address is:
A1、读取邻居表中邻居设备的IP地址,针对当前读取的IP地址发送地址解析协议请求报文;判断是否邻居表中所有的IP地址已被读取,如果是,则执行步骤B;否则,返回步骤A1。A1. Read the IP address of the neighbor device in the neighbor table, and send an address resolution protocol request message for the currently read IP address; judge whether all the IP addresses in the neighbor table have been read, and if so, perform step B; Otherwise, return to step A1.
其中,步骤A中,所述记录邻居设备的IP地址与该IP地址对应的介质访问控制地址和出端口之间的对应关系为:网络设备将邻居设备的IP地址与获得的介质访问控制地址和出端口之间的对应关系记录在自身的地址解析协议表中;Wherein, in step A, the correspondence between the IP address of the neighbor device and the media access control address corresponding to the IP address and the egress port is recorded as follows: the network device combines the IP address of the neighbor device with the obtained media access control address and The corresponding relationship between outgoing ports is recorded in its own address resolution protocol table;
步骤B中,所述根据要访问的邻居设备的IP地址获得与该IP地址对应的介质访问控制地址和出端口为:根据要访问的邻居设备的IP地址,在地址解析协议表中查找,获得与该IP地址对应的介质访问控制地址和出端口。In step B, said according to the IP address of the neighboring device to be accessed to obtain the media access control address and the outgoing port corresponding to the IP address is: according to the IP address of the neighboring device to be accessed, search in the address resolution protocol table to obtain The media access control address and egress port corresponding to the IP address.
其中,步骤A中,所述记录邻居设备的IP地址与该IP地址对应的介质访问控制地址和出端口之间的对应关系为:网络设备将邻居设备的IP地址与获得的介质访问控制地址之间的对应关系记录在自身的地址解析协议表、将与IP地址对应的获得的邻居设备介质访问控制地址和出端口之间的对应关系记录在自身的二层转发表中;Wherein, in step A, the correspondence between the IP address of the neighbor device and the media access control address corresponding to the IP address and the egress port is recorded as follows: the network device records the IP address of the neighbor device and the obtained media access control address Record the corresponding relationship between them in the address resolution protocol table of itself, and record the corresponding relationship between the media access control address of the neighboring device obtained corresponding to the IP address and the outgoing port in its own Layer 2 forwarding table;
步骤B中,所述根据要访问的邻居设备的IP地址查找获得与该IP地址对应的介质访问控制地址和出端口为:根据要访问的邻居设备的IP地址,在地址解析协议表中查找获得与该介质访问控制地址;再根据查找得到的介质访问控制地址在二层转发表中查找获得对应的出端口。In step B, said according to the IP address search of the neighbor equipment to be accessed to obtain the media access control address and the output port corresponding to the IP address is: according to the IP address of the neighbor equipment to be accessed, search and obtain in the address resolution protocol table and the media access control address; and then search the layer-2 forwarding table according to the obtained media access control address to obtain the corresponding egress port.
其中,步骤A中,所述记录邻居设备的IP地址与该IP地址对应的介质访问控制地址和出端口之间的对应关系为:网络设备将邻居设备的IP地址与获得的介质访问控制地址和出端口之间的对应关系记录在自身的邻居表中;Wherein, in step A, the correspondence between the IP address of the neighbor device and the media access control address corresponding to the IP address and the egress port is recorded as follows: the network device combines the IP address of the neighbor device with the obtained media access control address and The corresponding relationship between outgoing ports is recorded in its own neighbor table;
步骤B中,所述根据要访问的邻居设备的IP地址查找获得与该IP地址对应的介质访问控制地址和出端口为:根据要访问的邻居设备的IP地址,在邻居表中查找获得与该IP地址对应的介质访问控制地址和出端口。In step B, according to the IP address of the neighbor device to be accessed, the media access control address and the output port corresponding to the IP address are obtained by searching the neighbor table according to the IP address of the neighbor device to be accessed. The media access control address and egress port corresponding to the IP address.
其中,设置维护定时器及维护时间,并在网络运行时启动维护定时器,该方法进一步包括以下步骤:Wherein, setting the maintenance timer and the maintenance time, and starting the maintenance timer when the network is running, the method further includes the following steps:
C11、判断维护定时器是否到达维护时间,如果到达,则执行步骤C12;否则,返回步骤C11;C11, judging whether the maintenance timer reaches the maintenance time, if it arrives, then execute step C12; otherwise, return to step C11;
C12、读取邻居表中的IP地址,判断地址解析协议表中是否存在与该IP地址对应的介质访问控制地址和出端口,如果存在,则执行步骤C13;否则,针对当前读取的IP地址发送地址解析协议请求报文后,执行步骤C13;C12, read the IP address in the neighbor table, and judge whether there is a media access control address and an outgoing port corresponding to the IP address in the address resolution protocol table, if there is, then perform step C13; otherwise, for the currently read IP address After sending the address resolution protocol request message, execute step C13;
C13、判断是否邻居表中所有的IP地址已被读取,如果是,则返回步骤C11;否则,返回步骤C12;C13, judge whether all IP addresses in the neighbor table have been read, if yes, then return to step C11; otherwise, return to step C12;
在执行步骤C11、C12和C13的同时,根据邻居设备返回的地址解析协议应答报文,获得返回的地址解析协议应答报文所针对IP地址的介质访问控制地址和出端口,并在地址解析协议表中记录该IP地址与介质访问控制地址和出端口之间的对应关系。While performing steps C11, C12 and C13, according to the ARP reply message returned by the neighbor equipment, obtain the media access control address and the outgoing port of the IP address of the returned ARP reply message, and enter the address resolution protocol The table records the correspondence between the IP address, the media access control address, and the outgoing port.
其中,设置维护定时器及维护时间,并在网络运行时启动维护定时器,该方法进一步包括以下步骤:Wherein, setting the maintenance timer and the maintenance time, and starting the maintenance timer when the network is running, the method further includes the following steps:
C21、判断维护定时器是否到达维护时间,如果到达,则执行步骤C22;否则,返回步骤C21;C21, judging whether the maintenance timer reaches the maintenance time, if it arrives, then execute step C22; otherwise, return to step C21;
C22、读取邻居表中的IP地址,判断地址解析协议表中是否存在与该IP地址对应的介质访问控制地址,如果存在,则执行步骤C23;否则,针对当前读取的IP地址发送地址解析协议请求报文后,执行步骤C23;C22. Read the IP address in the neighbor table, and judge whether there is a media access control address corresponding to the IP address in the address resolution protocol table, and if so, perform step C23; otherwise, send address resolution for the currently read IP address After the protocol request message, execute step C23;
C23、判断是否邻居表中所有的IP地址已被读取,如果是,则返回步骤C21;否则,返回步骤C22;C23, judging whether all IP addresses in the neighbor table have been read, if yes, then return to step C21; otherwise, return to step C22;
在执行步骤C21、C22和C23的同时,根据邻居设备返回的地址解析协议应答报文,获得返回的地址解析协议应答报文所针对IP地址的介质访问控制地址和出端口,并在地址解析协议表中记录该IP地址与介质访问控制地址之间的对应关系、以及在二层转发表中记录获得的介质访问控制地址与出端口之间的对应关系。While performing steps C21, C22 and C23, according to the ARP reply message returned by the neighbor equipment, obtain the media access control address and the outgoing port of the IP address of the returned ARP reply message, and in the address resolution protocol The corresponding relationship between the IP address and the media access control address is recorded in the table, and the corresponding relationship between the obtained media access control address and the egress port is recorded in the Layer 2 forwarding table.
本发明所提供的一种快速访问邻居设备的方法,通过预先记录邻居设备的IP地址以及根据预先记录的IP地址获得MAC地址和出端口,在网络设备需要访问其邻居设备时,不需要广播发送ARP请求报文,并等待邻居设备返回ARP应答报文,就可以直接根据IP地址读取已记录的相应MAC地址和出端口,进而实现了快速访问邻居设备的目的。本发明所提的方法极大的提高了网络设备的访问效率,降低了网络丢包率,保证了网络的服务质量。A method for quickly accessing neighbor equipment provided by the present invention, by pre-recording the IP address of the neighbor equipment and obtaining the MAC address and the outgoing port according to the pre-recorded IP address, when the network equipment needs to access its neighbor equipment, it does not need to broadcast After receiving an ARP request message and waiting for the neighbor device to return an ARP response message, you can directly read the recorded corresponding MAC address and outgoing port according to the IP address, thereby realizing the purpose of quickly accessing the neighbor device. The method proposed by the invention greatly improves the access efficiency of the network equipment, reduces the packet loss rate of the network, and ensures the service quality of the network.
附图说明Description of drawings
图1为本发明中快速访问邻居设备的流程图;Fig. 1 is the flowchart of fast access neighbor equipment among the present invention;
图2为本发明实施例一中维护ARP表的流程图。FIG. 2 is a flow chart of maintaining an ARP table in Embodiment 1 of the present invention.
具体实施方式Detailed ways
本发明的核心思想是:在网络开始运行之前,在网络设备内记录其邻居设备的IP地址;在网络开始运行后,不论网络设备是否需要与其邻居设备进行通信,都根据记录的邻居设备的IP地址,获得并记录与该IP地址对应的MAC地址和出端口;在网络设备需要访问邻居设备时,直接根据已记录的MAC地址和出端口访问其邻居设备,而不是在网络设备需要访问其邻居设备时再根据其邻居设备的IP地址获得相应的MAC地址和出端口。在具体实施方式的描述中,为了使网络设备与其邻居设备进行区别,同样将访问其邻居设备的网络设备称为主设备。The core idea of the present invention is: before the network starts to operate, record the IP addresses of its neighbors in the network equipment; Address, obtain and record the MAC address and outgoing port corresponding to the IP address; when the network device needs to access the neighboring device, directly access its neighboring device according to the recorded MAC address and outgoing port, rather than when the network device needs to visit its neighbor The device obtains the corresponding MAC address and outgoing port according to the IP address of its neighbor device. In the description of specific embodiments, in order to distinguish a network device from its neighbor devices, the network device that accesses its neighbor devices is also referred to as a master device.
以下通过两个实施例对本发明的技术方案进行更为详细的说明。The technical solution of the present invention will be described in more detail through two examples below.
实施例一Embodiment one
在网络开始运行之前,在主设备内设置邻居表,根据网络规划时的网络拓扑结构在邻居表中记录该主设备邻居设备的IP地址。在网络开始运行之后,执行如图1所示的流程,具体步骤如下:Before the network starts running, set up a neighbor table in the master device, and record the IP addresses of the neighbor devices of the master device in the neighbor table according to the network topology during network planning. After the network starts running, execute the process shown in Figure 1, and the specific steps are as follows:
步骤101~102:主设备依次读取邻居表中的IP地址,并针对读取的IP地址发送ARP请求报文。由于主设备收到从邻居设备返回的ARP应答报文需要一段时间,因此在发送完本次读取的ARP请求报文之后,即执行步骤103,不等待邻居设备返回的ARP应答报文。Steps 101-102: The master device sequentially reads the IP addresses in the neighbor table, and sends an ARP request message for the read IP addresses. Since it takes some time for the master device to receive the ARP reply message returned from the neighbor device, after sending the ARP request message read this time, it executes step 103 without waiting for the ARP reply message returned by the neighbor device.
在流程的执行过程中,当主设备收到其邻居设备返回的ARP应答报文时,则根据返回的ARP应答报文获得与邻居设备IP地址对应的MAC地址和出端口,主设备将IP地址与MAC地址和出端口的对应关系作为一个ARP表项记录在ARP表中。During the execution of the process, when the master device receives the ARP reply packet returned by its neighbor device, it obtains the MAC address and outbound port corresponding to the IP address of the neighbor device according to the returned ARP reply packet, and the master device compares the IP address and The correspondence between MAC addresses and outgoing ports is recorded in the ARP table as an ARP entry.
所述依次读取邻居表的方法可以为任意方法,只要保证邻居表中的IP地址都被读到即可。比如:可以按照从邻居表的第一个IP地址到最后一个IP地址顺序读取;或者,按照任意顺序读取并通过对邻居表中已经读取的IP地址设置已读标识等类似的方法,来保证邻居表中的所有IP地址都会被主设备读取。The method of sequentially reading the neighbor table can be any method, as long as all the IP addresses in the neighbor table are read. For example: read from the first IP address to the last IP address in the neighbor table; or read in any order and set the read flag for the read IP address in the neighbor table or similar methods, To ensure that all IP addresses in the neighbor table will be read by the master device.
步骤103:判断邻居表中所有的IP地址是否已经读取完毕,如果是,则执行步骤104;否则,返回步骤101。Step 103: Determine whether all the IP addresses in the neighbor table have been read, and if yes, execute step 104; otherwise, return to step 101.
这里,判断邻居表中所有的IP地址是否已经读取完毕的方法是根据步骤101中读取IP地址的方法来确定的。如果是按照从邻居表的第一个IP地址到最后一个IP地址顺序读取的,则判断邻居表中所有的IP地址是否已经读取完毕的方法为判断当前读取的IP地址是否为邻居表中的最后一个IP地址,如果是,则执行步骤104;否则,返回步骤101。如果是通过对已经读取的IP地址设置已读标识的方法来保证邻居表中的所有IP地址都会被主设备读取,则步骤103的判断方法可以是判断邻居表中是否还存在没有设置已读标识的IP地址,如果不存在,则执行步骤104;否则,返回步骤101。Here, the method for judging whether all the IP addresses in the neighbor table have been read is determined according to the method for reading the IP addresses in step 101 . If it is read in order from the first IP address to the last IP address in the neighbor table, the method for judging whether all the IP addresses in the neighbor table have been read is to judge whether the currently read IP address is in the neighbor table The last IP address in , if yes, execute step 104; otherwise, return to step 101. If it is ensured that all the IP addresses in the neighbor list will be read by the master device by setting the read flag to the read IP addresses, then the judgment method in step 103 can be to judge whether there are any IP addresses that have not been set in the neighbor table. Read the identified IP address, if it does not exist, execute step 104; otherwise, return to step 101.
步骤104:当主设备需要访问邻居设备时,只需直接根据邻居设备的IP地址在ARP表中查找相应的ARP表项即可实现对邻居设备的访问。Step 104: When the master device needs to access the neighbor device, it only needs to directly look up the corresponding ARP entry in the ARP table according to the IP address of the neighbor device to realize the access to the neighbor device.
通常,当网络运行了一段时间后,主设备会对自身存储的ARP表进行老化处理,即删除一些不常用的ARP表项。因此,为了防止主设备因为删除当前需要访问的邻居设备的ARP表项,而不能快速访问该邻居设备,主设备还需根据邻居表记录的IP地址对ARP表进行周期性维护。进行周期性维护的周期大小,可以根据主设备对ARP表进行老化处理的周期大小、主设备的性能、以及主设备所处的网络环境综合进行确定。Usually, after the network has been running for a period of time, the master device will age the ARP table stored by itself, that is, delete some infrequently used ARP entries. Therefore, in order to prevent the master device from being unable to quickly access the neighbor device because it deletes the ARP entry of the neighbor device that needs to be accessed, the master device also needs to periodically maintain the ARP table according to the IP address recorded in the neighbor table. The period for periodic maintenance may be comprehensively determined according to the period for the master device to perform aging processing on the ARP table, the performance of the master device, and the network environment where the master device is located.
本实施例中维护ARP表的大体过程为:首先在主设备内设置维护定时器,并设置相应的维护时间,当网络开始运行时,触发主设备中的维护定时器,定时器开始计时;当定时器到达维护时间时,则触发主设备对ARP表的维护。本实施例维护ARP表的具体过程如图2所示:The general process of maintaining the ARP table in this embodiment is as follows: first, a maintenance timer is set in the master device, and the corresponding maintenance time is set, when the network starts to run, the maintenance timer in the master device is triggered, and the timer starts counting; When the timer reaches the maintenance time, it triggers the main device to maintain the ARP table. The specific process of maintaining the ARP table in this embodiment is shown in Figure 2:
步骤201:判断维护定时器是否到达维护时间,如果到达,则主设备触发对自身的ARP表的维护,执行步骤202;否则,返回步骤201,继续判断维护定时器是否到达维护时间。Step 201: Judging whether the maintenance timer has reached the maintenance time, if so, the master device triggers the maintenance of its own ARP table, and performs
步骤202~203:主设备依次读取邻居表中的IP地址,根据读取的IP地址在ARP表中查找是否存在相应的ARP表项,如果存在,则执行步骤205;否则,执行步骤204。Steps 202-203: The master device sequentially reads the IP addresses in the neighbor table, searches the ARP table for the corresponding ARP entry according to the read IP address, and if so, executes
步骤204:针对当前读取的IP地址发送ARP请求报文。由于主设备接收到从邻居设备返回的ARP应答报文需要一段时间,因此在发送完ARP请求报文之后,即执行步骤205,不等待邻居设备返回ARP应答报文。Step 204: Send an ARP request message for the currently read IP address. Since it takes some time for the master device to receive the ARP reply message returned from the neighbor device, after sending the ARP request message, it executes
在流程的执行过程中,当邻居设备返回ARP应答报文时,则根据返回的ARP应答报文获得与邻居设备IP地址对应的MAC地址和出端口,并将IP地址与MAC地址和出端口作为一个ARP表项记录在ARP表中。During the execution of the process, when the neighbor device returns an ARP reply message, the MAC address and outbound port corresponding to the IP address of the neighbor device are obtained according to the returned ARP reply message, and the IP address, MAC address and outbound port are used as An ARP entry is recorded in the ARP table.
步骤205:判断邻居表中所有的IP地址是否已经读取完毕,如果是,则返回步骤201;否则,返回步骤202。Step 205: Judging whether all the IP addresses in the neighbor table have been read, if yes, return to step 201; otherwise, return to step 202.
其中,步骤202中依次读取邻居表中IP地址,以及步骤205中判断邻居表中所有的IP地址是否已经读取完毕的方法与实施例一中所述的方法相同,在此不再详述。Wherein, the method of reading the IP addresses in the neighbor table sequentially in
对于一些只记录IP地址与MAC地址的对应关系,而不记录IP地址与MAC地址和出端口之间对应关系的ARP表,同样可以根据图1所示的流程完成快速访问邻居设备的过程以及根据图2所示的流程完成维护邻居表的操作。只是在图1的流程中,将通过邻居设备返回的ARP应答报文获得到的出端口与MAC地址的对应关系记录在二层转发表中;在图2流程的步骤203中,除了需要根据邻居设备的IP地址在ARP表查找相应的MAC地址,还需要根据查找得到的MAC地址在主设备的二层转发表查找相应的出端口,如果在二层转发表找不到相应的出端口时,则执行步骤204针对这个IP地址发送ARP请求报文,并将根据邻居设备返回的ARP应答报文获得到的出端口记录在二层转发表中。For some ARP tables that only record the correspondence between IP addresses and MAC addresses, but do not record the correspondence between IP addresses, MAC addresses and outgoing ports, the process of quickly accessing neighboring devices can also be completed according to the process shown in Figure The process shown in Figure 2 completes the operation of maintaining the neighbor table. Only in the process of Figure 1, the corresponding relationship between the outgoing port and the MAC address obtained through the ARP response message returned by the neighbor device is recorded in the two-layer forwarding table; in
在本实施例的邻居表中,也可以不记录主设备所有邻居设备的IP地址,只记录重要邻居设备的IP地址,具体的实施方式与图1和图2所示的流程相同,在此不再详述。这里,重要邻居设备是指,主设备需要经常访问的网络设备以及网络中的骨干设备。In the neighbor table of this embodiment, it is also possible not to record the IP addresses of all neighbor devices of the master device, but only to record the IP addresses of important neighbor devices. More details. Here, important neighbor devices refer to network devices that the master device needs to visit frequently and backbone devices in the network.
实施例二Embodiment two
与实施例一不同的是,实施例二中,在主设备设置的邻居表内记录邻居设备的IP地址与MAC地址和出端口之间的对应关系。实施例二的具体过程与图1所示的过程相同,只是在邻居设备返回ARP应答报文时,将获得的与邻居设备IP地址对应的MAC地址和出端口记录在邻居表和ARP表内,或邻居表、ARP表以及二层转发表内,或只记录在邻居表内。那么,主设备在访问邻居设备时,则可直接到邻居表中根据邻居设备的IP地址去查找得到相应的MAC地址和出端口,进而实现快速访问邻居设备的目的。Different from the first embodiment, in the second embodiment, the correspondence between the IP address, the MAC address and the egress port of the neighbor device is recorded in the neighbor table set by the master device. The specific process of embodiment two is the same as the process shown in Figure 1, just when the neighbor equipment returns the ARP response message, the MAC address and the outgoing port corresponding to the neighbor equipment IP address will be recorded in the neighbor table and the ARP table, or in the neighbor table, ARP table, and Layer 2 forwarding table, or only recorded in the neighbor table. Then, when the master device accesses the neighbor device, it can directly go to the neighbor table to find the corresponding MAC address and outgoing port according to the IP address of the neighbor device, so as to achieve the purpose of quickly accessing the neighbor device.
由于邻居设备是主设备可能需要经常访问的设备,因此主设备不需要执行对邻居表内记录的ARP表项的删除处理。又由于主设备是通过查找邻居表而得到相应的MAC地址和出端口,因此也不需要对ARP表进行维护。Since the neighbor device is a device that the master device may need to access frequently, the master device does not need to delete the ARP entries recorded in the neighbor table. And because the master device obtains the corresponding MAC address and outgoing port by looking up the neighbor table, it does not need to maintain the ARP table.
在本实施例的邻居表中,也可以不记录主设备所有邻居设备的IP地址,只记录重要邻居设备的IP地址,具体的实施方式方法与实施例二中所述的方式相同,在此不再详述。In the neighbor table of this embodiment, it is also possible not to record the IP addresses of all neighbor devices of the main device, but only to record the IP addresses of important neighbor devices. The specific implementation method is the same as that described in Embodiment 2, and will not More details.
以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention.
Claims (9)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2005101177739A CN100337446C (en) | 2005-11-10 | 2005-11-10 | Method for rapid access neighbor device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2005101177739A CN100337446C (en) | 2005-11-10 | 2005-11-10 | Method for rapid access neighbor device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1845518A CN1845518A (en) | 2006-10-11 |
CN100337446C true CN100337446C (en) | 2007-09-12 |
Family
ID=37064432
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2005101177739A Expired - Fee Related CN100337446C (en) | 2005-11-10 | 2005-11-10 | Method for rapid access neighbor device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100337446C (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110740198B (en) * | 2019-10-21 | 2022-12-23 | 杭州迪普科技股份有限公司 | Neighbor table item management method and device, electronic equipment and machine-readable storage medium |
CN115277280B (en) * | 2022-08-17 | 2024-05-07 | 美的集团股份有限公司 | Control method of intelligent household equipment and control method of server |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5999536A (en) * | 1996-11-29 | 1999-12-07 | Anritsu Corporation | Router for high-speed packet communication between terminal apparatuses in different LANs |
JP2001119399A (en) * | 1999-10-15 | 2001-04-27 | Nec Commun Syst Ltd | IPv6 NETWORK SYSTEM |
CN1611054A (en) * | 2001-12-28 | 2005-04-27 | 松下电器产业株式会社 | Router, network system and network setting method |
-
2005
- 2005-11-10 CN CNB2005101177739A patent/CN100337446C/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5999536A (en) * | 1996-11-29 | 1999-12-07 | Anritsu Corporation | Router for high-speed packet communication between terminal apparatuses in different LANs |
JP2001119399A (en) * | 1999-10-15 | 2001-04-27 | Nec Commun Syst Ltd | IPv6 NETWORK SYSTEM |
CN1611054A (en) * | 2001-12-28 | 2005-04-27 | 松下电器产业株式会社 | Router, network system and network setting method |
Also Published As
Publication number | Publication date |
---|---|
CN1845518A (en) | 2006-10-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8509243B2 (en) | Method and device for sending a packet based on tunneling protocol used in layer 2 | |
CN1761238A (en) | Optimization of routing forwarding database in a network processor | |
CN101030980A (en) | Wide-band terminal identifier based on Ethernet and its identifying method | |
CN1564989A (en) | High speed MAC address search engine | |
CN1175621C (en) | A Method for Detecting and Monitoring Malicious User Host Attacks | |
CN101043355A (en) | Method for preventing MAC address cheat | |
CN1856967A (en) | Automatic switching of setting associated with network | |
CN1859304A (en) | Method for realizing neighbour discovery | |
CN1558615A (en) | A physical network topology discovery system and method thereof | |
CN1791065A (en) | Method for accessing virtual LAN | |
CN100337446C (en) | Method for rapid access neighbor device | |
WO2014169812A1 (en) | Forwarding processing method and device for message | |
CN101043356A (en) | Method for preventing MAC address cheat | |
CN1152516C (en) | Method for finding out IP network node | |
CN103856435A (en) | Address resolution protocol cache and caching method | |
CN113630480B (en) | Method for realizing DNS data isolation of multiple internet surfing channels | |
CN101237405B (en) | Data caching method and device | |
CN1767495A (en) | Method for Ensuring Data Security of Layer 2 Ethernet Switches in Metropolitan Area Transmission Equipment | |
CN1477825A (en) | Support both one-to-one and many-to-many address translation methods in PAT mode | |
CN1992672A (en) | Method for preventing network interruption caused by address aging and time inconformity | |
CN1210919C (en) | Data flow control method in data insertion equipment | |
CN101043392A (en) | Apparatus and base station equipment for transmitting IP packet in WiMAX network | |
CN1859420A (en) | Device and method for obtaining IPV6 prefix | |
CN1929435A (en) | Packet transmission device and method | |
CN1885763A (en) | Method for preventing IP address leakage |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20070912 Termination date: 20201110 |
|
CF01 | Termination of patent right due to non-payment of annual fee |