Communication method and device

文档序号:1925214 发布日期:2021-12-03 浏览:21次 中文

阅读说明:本技术 通信方法及装置 (Communication method and device ) 是由 徐晓娟 于 2021-07-16 设计创作,主要内容包括:本申请提供一种通信方法及装置,所述方法应用于第一网络设备,所述方法包括:通过所述EoGRE隧道,向所述第二网络设备发送第一ICMP请求报文;当在预设时间内未接收到所述第二网络设备发送的第一ICMP响应报文时,确定所述EoGRE隧道不可达,并将所述EoGRE隧道的状态设置为down状态;获取所述EoGRE隧道在所述第一网络设备中映射的二层虚拟以太口所属的VLAN标识;根据所述VLAN标识,向处于所述VLAN标识指示的VLAN内的用户终端发送第一通知消息,以使得所述用户终端根据所述第一通知消息不再选择所述第一网络设备作为入网的接入设备。(The application provides a communication method and a communication device, wherein the method is applied to first network equipment and comprises the following steps: sending a first ICMP request message to the second network equipment through the EoGRE tunnel; when the first ICMP response message sent by the second network equipment is not received within the preset time, determining that the EoGRE tunnel is unreachable, and setting the state of the EoGRE tunnel to be a down state; obtaining a VLAN identifier to which a two-layer virtual Ethernet port mapped in the first network equipment by the EoGRE tunnel belongs; and sending a first notification message to the user terminal in the VLAN indicated by the VLAN identifier according to the VLAN identifier, so that the user terminal does not select the first network device as an access device for accessing the network according to the first notification message.)

1. A communication method is applied to a first network device, wherein the first network device interacts data packets with a second network device through an established EoGRE tunnel, and the method comprises the following steps:

sending a first ICMP request message to the second network equipment through the EoGRE tunnel;

when the first ICMP response message sent by the second network equipment is not received within the preset time, determining that the EoGRE tunnel is unreachable, and setting the state of the EoGRE tunnel to be a down state;

obtaining a VLAN identifier to which a two-layer virtual Ethernet port mapped in the first network equipment by the EoGRE tunnel belongs;

and sending a first notification message to the user terminal in the VLAN indicated by the VLAN identifier according to the VLAN identifier, so that the user terminal does not select the first network device as an access device for accessing the network according to the first notification message.

2. The method of claim 1, further comprising:

and when receiving a first ICMP response message sent by the second network equipment within a preset time, determining that the EoGRE tunnel is reachable, and setting the state of the EoGRE tunnel to be an up state.

3. The method of claim 1, further comprising:

sending a second ICMP request message to the second network equipment through the EoGRE tunnel;

when a second ICMP response message sent by the second network equipment is received within preset time, determining that the EoGRE tunnel is reachable, and setting the state of the EoGRE tunnel to be an up state;

and sending a second notification message to the user terminal in the VLAN indicated by the VLAN identifier according to the VLAN identifier, so that the user terminal selects the first network device as an access device for accessing the network according to the second notification message.

4. The method of claim 1, further comprising:

receiving an original data message sent by a user terminal, wherein the original data message comprises a destination MAC address;

according to the destination MAC address, acquiring a two-layer virtual Ethernet identifier matched with the destination MAC address from a local MAC address table;

according to the identifier of the two-layer virtual Ethernet, acquiring a tunnel port identifier matched with the identifier of the two-layer virtual Ethernet from a local interface mapping table, wherein the tunnel port indicated by the tunnel port identifier supports an EoGRE mode;

performing tunnel encapsulation processing on the original data message to obtain a first data message, wherein the first data message comprises an outer IP head, and the outer IP head comprises a destination IP address;

according to the destination IP address, a first interface matched with the destination IP address is obtained in a local routing table, and the first interface is a physical port corresponding to the tunnel port;

and sending the first data message to the second network equipment by using the EoGRE tunnel through the first interface.

5. The method of claim 1, further comprising:

receiving a second data message sent by the second network device, wherein the second data message comprises an outer layer IP header, and the outer layer IP header comprises a destination IP address;

when the destination IP address is the local IP address of the first network equipment, decapsulating the second data message to obtain an original data message, wherein the original data message comprises a destination MAC address;

according to the target MAC address, an output interface matched with the target MAC address is obtained from a local MAC address table;

and forwarding the original data message to the user terminal through the output interface.

6. A communication apparatus, applied to a first network device, where the first network device interacts a data packet with a second network device through an established EoGRE tunnel, the apparatus comprising:

a sending unit, configured to send a first ICMP request packet to the second network device through the EoGRE tunnel;

a setting unit, configured to determine that the EoGRE tunnel is unreachable and set a state of the EoGRE tunnel to a down state when the first ICMP response packet sent by the second network device is not received within a preset time;

an obtaining unit, configured to obtain a VLAN identifier to which a layer two virtual ethernet port mapped in the first network device by the EoGRE tunnel belongs;

the sending unit is further configured to send a first notification message to the user terminal in the VLAN indicated by the VLAN identifier according to the VLAN identifier, so that the user terminal does not select the first network device as an access device accessing the network according to the first notification message.

7. The apparatus according to claim 6, wherein the setting unit is further configured to determine that the EoGRE tunnel is reachable when the first ICMP response packet sent by the second network device is received within a preset time, and set the state of the EoGRE tunnel to the up state.

8. The apparatus of claim 6, wherein the sending unit is further configured to send a second ICMP request message to the second network device through the EoGRE tunnel;

the setting unit is further configured to determine that the EoGRE tunnel is reachable when receiving a second ICMP response packet sent by the second network device within a preset time, and set the state of the EoGRE tunnel to an up state;

the sending unit is further configured to send a second notification message to the user terminal in the VLAN indicated by the VLAN identifier according to the VLAN identifier, so that the user terminal selects the first network device as an access device accessing the network according to the second notification message.

9. The apparatus of claim 6, further comprising:

a receiving unit, configured to receive an original data packet sent by a user terminal, where the original data packet includes a destination MAC address;

the obtaining unit is further configured to obtain, according to the destination MAC address, a two-layer virtual ethernet port identifier that matches the destination MAC address from a local MAC address table;

according to the identifier of the two-layer virtual Ethernet, acquiring a tunnel port identifier matched with the identifier of the two-layer virtual Ethernet from a local interface mapping table, wherein the tunnel port indicated by the tunnel port identifier supports an EoGRE mode;

the device further comprises: an encapsulating unit, configured to perform tunnel encapsulation processing on the original data packet to obtain a first data packet, where the first data packet includes an outer IP header, and the outer IP header includes a destination IP address;

the obtaining unit is further configured to obtain, according to the destination IP address, a first interface matched with the destination IP address in a local routing table, where the first interface is a physical port corresponding to the tunnel port;

the sending unit is further configured to send the first data packet to the second network device through the first interface by using the EoGRE tunnel.

10. The apparatus according to claim 9, wherein the receiving unit is further configured to receive a second data message sent by the second network device, and the second data message includes an outer IP header, and the outer IP header includes a destination IP address;

the device further comprises: a decapsulating unit, configured to decapsulate the second data packet to obtain an original data packet when the destination IP address is a local IP address of the first network device, where the original data packet includes a destination MAC address;

the obtaining unit is further configured to obtain, according to the destination MAC address, an outgoing interface matched with the destination MAC address from a local MAC address table;

the sending unit is further configured to forward the original data packet to the user terminal through the outgoing interface.

Technical Field

The present application relates to the field of communications technologies, and in particular, to a communication method and apparatus.

Background

At present, Virtual eXtensible Local Area Network (VXLAN) technology can provide Network interworking between tenants of different sites. VXLAN technology uses the existing three-layer physical network as the underlying (Underlay) network. A virtual two-layer network, namely an upper layer (Overlay) network, is constructed on the Underlay network. The Overlay network encapsulates the two-layer message by an encapsulation technology, and forwards the encapsulated two-layer message by using a three-layer forwarding path provided by the Underlay network. Therefore, network intercommunication among tenants of different sites is realized.

In the process of realizing network intercommunication among tenants of different sites by using the VXLAN technology, certain requirements are also put forward on network equipment, namely the interconnected network equipment is required to support the VXLAN technology, otherwise, the network equipment cannot realize the transmission of two-layer messages of the tenants across a three-layer network; in addition, although the network device supports the VXLAN technology, it cannot know the state of the established VXLAN tunnel, and if the VXLAN tunnel is in a down (down) state at this time, the network device discards the two-layer message of the tenant in an undefined VXLAN tunnel state.

Disclosure of Invention

In view of this, the present application provides a communication method and apparatus, so as to solve the problem that in the process of implementing network interworking between tenants of different sites by using a VXLAN technology, network devices all need to support the VXLAN technology and cannot know the state of a VXLAN tunnel, thereby discarding a two-layer packet of a tenant.

In a first aspect, the present application provides a communication method, where the method is applied to a first network device, where the first network device interacts a data packet with a second network device through an established EoGRE tunnel, and the method includes:

sending a first ICMP request message to the second network equipment through the EoGRE tunnel;

when the first ICMP response message sent by the second network equipment is not received within the preset time, determining that the EoGRE tunnel is unreachable, and setting the state of the EoGRE tunnel to be a down state;

obtaining a VLAN identifier to which a two-layer virtual Ethernet port mapped in the first network equipment by the EoGRE tunnel belongs;

and sending a first notification message to the user terminal in the VLAN indicated by the VLAN identifier according to the VLAN identifier, so that the user terminal does not select the first network device as an access device for accessing the network according to the first notification message.

In a second aspect, the present application provides a communication apparatus, where the apparatus is applied to a first network device, and the first network device interacts a data packet with a second network device through an established EoGRE tunnel, where the apparatus includes:

a sending unit, configured to send a first ICMP request packet to the second network device through the EoGRE tunnel;

a setting unit, configured to determine that the EoGRE tunnel is unreachable and set a state of the EoGRE tunnel to a down state when the first ICMP response packet sent by the second network device is not received within a preset time;

an obtaining unit, configured to obtain a VLAN identifier to which a layer two virtual ethernet port mapped in the first network device by the EoGRE tunnel belongs;

the sending unit is further configured to send a first notification message to the user terminal in the VLAN indicated by the VLAN identifier according to the VLAN identifier, so that the user terminal does not select the first network device as an access device accessing the network according to the first notification message.

In a third aspect, the present application provides a network device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to perform the method provided by the first aspect of the present application.

Therefore, by applying the communication method and apparatus provided by the present application, the first network device sends the first ICMP request message to the second network device through the EoGRE tunnel; when the first ICMP response message sent by the second network equipment is not received within the preset time, the first network equipment determines that the EoGRE tunnel is unreachable and sets the state of the EoGRE tunnel to be a down state; acquiring a VLAN (virtual local area network) identifier to which a two-layer virtual Ethernet port mapped in first network equipment by an EoGRE (Ethernet over GRE) tunnel belongs; according to the VLAN identification, the first network equipment sends a first notification message to the user terminal in the VLAN indicated by the VLAN identification, so that the user terminal does not select the first network equipment as the access equipment for accessing the network according to the first notification message.

Therefore, the first network device and the second network device can detect the state of the EoGRE tunnel by mutually sending ICMP messages, and the first network device and the second network device do not need to support the VXLAN technology, so that the problem that in the process of realizing network intercommunication among tenants of different sites by using the VXLAN technology, the network devices all need to support the VXLAN technology and cannot know the state of the VXLAN tunnel, and the two-layer message of the tenant is discarded is solved. And realizing the transmission of the two-layer Ethernet message across the three-layer IP network through the EoGRE tunnel.

Drawings

Fig. 1 is a flowchart of a communication method provided in an embodiment of the present application;

fig. 2 is a structural diagram of a communication device according to an embodiment of the present application;

fig. 3 is a hardware structure of a network device according to an embodiment of the present disclosure.

Detailed Description

Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.

The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the corresponding listed items.

It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.

The following describes the communication method provided in the embodiments of the present application in detail. Referring to fig. 1, fig. 1 is a flowchart of a communication method according to an embodiment of the present disclosure. The method is applied to a first network device, which may be specifically a device for supporting Media Access Control Address (MAC) forwarding, such as an AP, a switch, a router, and the like, and the communication method provided in this embodiment of the present application may include the following steps.

Step 110, sending a first ICMP request message to the second network device through the EoGRE tunnel.

Specifically, the first network device interacts the data packet with the second network device through an established generic routing encapsulation transmission Ethernet over GRE (EoGRE for short) tunnel. That is, one end of the EoGRE tunnel is a first network device, and the other end is a second network device.

The first Network equipment enables a keep-alive (keep-alive) function to the EoGRE tunnel port, and creates a Network Quality Analysis (NQA) detection instance at the EoGRE tunnel port.

In the NQA detection example, according to the source address and the destination address of the EoGRE tunnel, the first network device generates a first network Control Message Protocol (ICMP) request Message.

After generating the first ICMP request message, the first network device sends the first ICMP request message to the second network device through the EoGRE tunnel.

And step 120, when the first ICMP response message sent by the second network device is not received within the preset time, determining that the EoGRE tunnel is unreachable, and setting the state of the EoGRE tunnel to a down state.

Specifically, after the first network device sends the first ICMP request message, a timer is started. And the first network equipment judges whether a first ICMP response message sent by the second network equipment is received within the time set by the timer.

And after receiving the first ICMP request message, the second network equipment determines that the first ICMP request message is sent by the first network equipment. The second network equipment generates a first ICMP response message and sends the first ICMP response message to the first network equipment through the EoGRE tunnel.

If the first ICMP response message sent by the second network device is not received within the preset time, the first network device determines that the EoGRE tunnel is not reachable, and sets the state of the EoGRE tunnel to a down state.

It should be noted that the timer configured in the first network device may be specifically set to 3 s. The first network device may send a first ICMP request message to the second network device every other timing period, and when the first ICMP response message is not received in both consecutive timing periods, the first network device determines that the EoGRE tunnel is unreachable, and sets the state of the EoGRE tunnel to a down state.

For example, after sending the first ICMP request message, the first network device waits for 3s, and determines whether the first ICMP response message is received in the process of waiting for 3 s. If the first network device does not receive the first ICMP response message in the process of waiting for 3s, the first network device sends the first ICMP to the second network device again after 3s, waits for 3s, and determines whether the first ICMP response message is received in the process of waiting for 3 s. If the first network device does not receive the first ICMP response message in the process of waiting for 3s, the first network device determines that the EoGRE tunnel is unreachable, and sets the state of the EoGRE tunnel to a down state.

Step 130, obtaining the VLAN id to which the layer two virtual ethernet port mapped in the first network device by the EoGRE tunnel belongs.

Specifically, according to the description in step 120, after the first network device determines that the EoGRE tunnel is not reachable and sets the state of the EoGRE tunnel to a down state, the first network device determines the tunnel portal identifier of the EoGRE tunnel according to the source address and the destination address of the EoGRE tunnel.

According to the tunnel port identifier, the first Network device obtains, from the Local interface mapping table, a two-layer Virtual ethernet port identifier mapped to the tunnel port indicated by the EoGRE tunnel port identifier, and a Virtual Local Area Network (VLAN) identifier to which the two-layer Virtual ethernet port indicated by the two-layer Virtual ethernet port identifier belongs.

Step 140, according to the VLAN identifier, sending a first notification message to the user terminal in the VLAN indicated by the VLAN identifier, so that the user terminal no longer selects the first network device as an access device for accessing the network according to the first notification message.

Specifically, according to the description in step 130, after the first network device obtains the VLAN identifier to which the layer two virtual ethernet port belongs, the first network device generates a first notification message, where the first notification message hides the identifier of the first network device.

And according to the VLAN identification, the first network equipment sends a first notification message to the user terminal in the VLAN indicated by the VLAN identification. After receiving the first notification message, the user terminal does not select the first network device as the access device for accessing the network because the identifier of the first network device cannot be obtained.

Therefore, by applying the communication method and apparatus provided by the present application, the first network device sends the first ICMP request message to the second network device through the EoGRE tunnel; when the first ICMP response message sent by the second network equipment is not received within the preset time, the first network equipment determines that the EoGRE tunnel is unreachable and sets the state of the EoGRE tunnel to be a down state; acquiring a VLAN (virtual local area network) identifier to which a two-layer virtual Ethernet port mapped in first network equipment by an EoGRE (Ethernet over GRE) tunnel belongs; according to the VLAN identification, the first network equipment sends a first notification message to the user terminal in the VLAN indicated by the VLAN identification, so that the user terminal does not select the first network equipment as the access equipment for accessing the network according to the first notification message.

Therefore, the first network device and the second network device can detect the state of the EoGRE tunnel by mutually sending ICMP messages, and the first network device and the second network device do not need to support the VXLAN technology, so that the problem that in the process of realizing network intercommunication among tenants of different sites by using the VXLAN technology, the network devices all need to support the VXLAN technology and cannot know the state of the VXLAN tunnel, and the two-layer message of the tenant is discarded is solved. And realizing the transmission of the two-layer Ethernet message across the three-layer IP network through the EoGRE tunnel.

Optionally, in this embodiment of the present application, the method further includes a process that the first network device receives the first ICMP response message within a preset time.

Specifically, when receiving a first ICMP response packet sent by the second network device within a preset time, the first network device determines that the EoGRE tunnel is reachable, and sets the state of the EoGRE tunnel to an uplink (up) state.

Optionally, in this embodiment of the present application, the method further includes a process that after the EoGRE tunnel is changed from the down state to the up state, the first network device sends a second notification message to the user terminal.

Specifically, according to the foregoing steps, it can be seen that the EoGRE tunnel is currently in a down state, and the first network device may generate the second ICPM request packet again, and send the second ICMP request packet to the second network device through the EoGRE tunnel.

It is understood that a timer may also be started after the first network device sends the second ICMP request message. And the first network equipment judges whether a second ICMP response message sent by the second network equipment is received or not within the time set by the timer.

And after receiving the second ICMP request message, the second network equipment determines that the second ICMP request message is sent by the first network equipment. And the second network equipment generates a second ICMP response message and sends the second ICMP response message to the first network equipment through the EoGRE tunnel.

If the second ICMP response message sent by the second network equipment is received within the preset time, the first network equipment determines that the EoGRE tunnel is accessible and is changed from the down state to the up state. The first network device sets the state of the EoGRE tunnel to the up state.

It should be noted that the timer configured in the first network device may be specifically set to 3 s. The first network device may send a second ICMP request message to the second network device every other timing period.

And in a timing period, the first network equipment receives the second ICMP response message, determines that the EoGRE tunnel is accessible and is converted from the down state to the up state. The first network device sets the state of the EoGRE tunnel to the up state.

Or, when receiving the second ICMP response message in two consecutive timing periods, the first network device determines that the EoGRE tunnel is reachable and has been changed from the down state to the up state. The first network device sets the state of the EoGRE tunnel to the up state.

And after the first network equipment determines that the EoGRE tunnel is reachable and sets the state of the EoGRE tunnel to be up, the first network equipment determines the tunnel port identification of the EoGRE tunnel according to the source address and the destination address of the EoGRE tunnel.

According to the tunnel port identifier, from the local interface mapping table, the first network device obtains the identifier of the two-layer virtual ethernet port mapped by the tunnel port indicated by the EoGRE tunnel port identifier, and the VLAN identifier to which the two-layer virtual ethernet port indicated by the identifier of the two-layer virtual ethernet port belongs.

After the first network device obtains the identifier of the VLAN to which the second layer virtual ethernet port belongs, the first network device generates a second notification message, where the second notification message includes the identifier of the first network device.

And according to the VLAN identification, the first network equipment sends a second notification message to the user terminal in the VLAN indicated by the VLAN identification. After receiving the second notification message, the user terminal acquires the identifier of the first network device from the second notification message, so that the user terminal can select the first network device as an access device for accessing the network.

Optionally, in this embodiment of the present application, the method further includes a process that the first network device and the second network device interact with each other through an EoGRE tunnel.

Specifically, the first network device receives an original data packet sent by a first user terminal, where the original data packet includes a destination MAC address. And according to the destination MAC address, the first network equipment acquires the identifier of the two-layer virtual Ethernet matched with the destination MAC address from the local MAC address table.

According to the identifier of the two-layer virtual Ethernet, the first network device obtains a tunnel port identifier matched with the identifier of the two-layer virtual Ethernet from a local interface mapping table, and the tunnel port indicated by the tunnel port identifier supports an EoGRE mode.

The first network device performs tunnel encapsulation processing on an original data message to obtain a first data message, wherein the first data message comprises an outer IP header, and the outer IP header comprises a destination IP address.

It should be noted that, according to the actual networking situation, two encapsulation methods exist in the process of the first network device performing tunnel encapsulation processing on the original data packet:

the first packaging mode is as follows: when no Network Address Translation (NAT) device exists in the Network, i.e. the EoGRE tunnel does not need to pass through the NAT device, a Generic Routing Encapsulation (GRE) header is encapsulated at the outer layer of the original data packet, and then an outer IP header is encapsulated to obtain the first data packet.

The second packaging method is as follows: when the NAT device exists in the networking, that is, the EoGRE tunnel needs to pass through the NAT device, the GRE header is encapsulated on the outer layer of the original data packet, then the User Datagram Protocol (UDP) header is encapsulated, and finally the outer IP header is encapsulated to obtain the first data packet.

According to the destination IP address, the first network equipment acquires a first interface matched with the destination IP address from a local routing table, wherein the first interface is a physical port corresponding to the tunnel port.

Through the first interface, the first network device sends a first data message to the second network device by using the EoGRE tunnel.

Further, after receiving the first data packet, the second network device obtains a destination IP address included in the outer IP header, and determines that the destination IP address is a local IP address. And according to the destination IP address, the second network equipment acquires the tunnel port matched with the destination IP address from the state table of the local tunnel up. As such, the second network device may determine that the first data packet was sent by the first network device over an EoGRE tunnel. And when the subsequent second network equipment sends the data message to the first network equipment, selecting the tunnel port and sending the data message through the EoGRE tunnel.

Meanwhile, according to the value of the protocol number field included in the outer IP header being 6558, the second network device determines that the first data packet is a two-layer data packet. And the second network equipment de-encapsulates the first data message to obtain an original data message, wherein the original data message comprises a destination MAC address.

It should be noted that, according to the actual networking situation, in the process of performing tunnel decapsulation processing on the first data packet, the second network device has two decapsulation modes:

the first decapsulation method comprises: when the NAT equipment does not exist in the network group, namely the EoGRE tunnel does not need to penetrate through the NAT equipment, the outer layer IP head of the first data message is stripped, and then the GRE head is stripped to obtain the original data message.

The second decapsulation mode: when the NAT device exists in the networking, that is, the EoGRE tunnel needs to pass through the NAT device, the outer IP header of the first data packet is stripped, then the UDP header is stripped, and finally the GRE header is stripped to obtain the original data packet.

And according to the destination MAC address included in the original data, the second network equipment acquires the outgoing interface matched with the destination MAC address from the local MAC address table. And through the output interface, the second network equipment forwards the original data message to the accessed second user terminal.

Furthermore, the second user terminal may also send a data message to the first user terminal. And the second network equipment generates and sends a second data message to the first network equipment through the EoGRE tunnel. It is understood that the second network device may also generate the second data packet according to the aforementioned manner in which the first network device generates the first data packet, and the description thereof is not repeated here

Similarly, after receiving the second data packet, the first network device may also process the second data packet according to the manner in which the second network device processes the first data packet, which is not repeated here.

Based on the same inventive concept, the embodiment of the application also provides a communication device corresponding to the communication method. Referring to fig. 2, fig. 2 is a structural diagram of a communication device according to an embodiment of the present application. The device is applied to a first network device, the first network device interacts data messages with a second network device through an established EoGRE tunnel, and the device comprises:

a sending unit 210, configured to send a first ICMP request message to the second network device through the EoGRE tunnel;

a setting unit 220, configured to determine that the EoGRE tunnel is unreachable when the first ICMP response packet sent by the second network device is not received within a preset time, and set a state of the EoGRE tunnel to a down state;

an obtaining unit 230, configured to obtain a VLAN identifier to which a layer two virtual ethernet port mapped in the first network device by the EoGRE tunnel belongs;

the sending unit 210 is further configured to send a first notification message to the user terminal in the VLAN indicated by the VLAN identifier according to the VLAN identifier, so that the user terminal does not select the first network device as an access device accessing the network according to the first notification message.

Optionally, the setting unit 220 is further configured to determine that the EoGRE tunnel is reachable when the first ICMP response packet sent by the second network device is received within a preset time, and set the state of the EoGRE tunnel to an up state.

Optionally, the sending unit 210 is further configured to send a second ICMP request packet to the second network device through the EoGRE tunnel;

the setting unit 220 is further configured to determine that the EoGRE tunnel is reachable when receiving a second ICMP response packet sent by the second network device within a preset time, and set the state of the EoGRE tunnel to an up state;

the sending unit 210 is further configured to send a second notification message to the user terminal in the VLAN indicated by the VLAN identifier according to the VLAN identifier, so that the user terminal selects the first network device as an access device accessing the network according to the second notification message.

Optionally, the apparatus further comprises: a receiving unit (not shown in the figure) for receiving an original data packet sent by a user terminal, wherein the original data packet includes a destination MAC address;

the obtaining unit 230 is further configured to obtain, according to the destination MAC address, a layer two virtual ethernet identifier matching the destination MAC address from a local MAC address table;

according to the identifier of the two-layer virtual Ethernet, acquiring a tunnel port identifier matched with the identifier of the two-layer virtual Ethernet from a local interface mapping table, wherein the tunnel port indicated by the tunnel port identifier supports an EoGRE mode;

the device further comprises: an encapsulating unit (not shown in the figure), configured to perform tunnel encapsulation processing on the original data packet to obtain a first data packet, where the first data packet includes an outer IP header, and the outer IP header includes a destination IP address;

the obtaining unit 230 is further configured to obtain, according to the destination IP address, a first interface matched with the destination IP address in a local routing table, where the first interface is a physical port corresponding to the tunnel port;

the sending unit 210 is further configured to send the first data packet to the second network device through the first interface by using the EoGRE tunnel.

Optionally, the receiving unit (not shown in the figure) is further configured to receive a second data message sent by the second network device, where the second data message includes an outer IP header, and the outer IP header includes a destination IP address;

the device further comprises: a decapsulating unit (not shown in the figure), configured to decapsulate the second data packet to obtain an original data packet when the destination IP address is a local IP address of the first network device, where the original data packet includes a destination MAC address;

the obtaining unit 230 is further configured to obtain, according to the destination MAC address, an outgoing interface matched with the destination MAC address from a local MAC address table;

the sending unit 210 is further configured to forward the original data packet to the user terminal through the outgoing interface.

Therefore, by applying the communication method and apparatus provided by the present application, the first network device sends the first ICMP request message to the second network device through the EoGRE tunnel; when the first ICMP response message sent by the second network equipment is not received within the preset time, the first network equipment determines that the EoGRE tunnel is unreachable and sets the state of the EoGRE tunnel to be a down state; acquiring a VLAN (virtual local area network) identifier to which a two-layer virtual Ethernet port mapped in first network equipment by an EoGRE (Ethernet over GRE) tunnel belongs; according to the VLAN identification, the first network equipment sends a first notification message to the user terminal in the VLAN indicated by the VLAN identification, so that the user terminal does not select the first network equipment as the access equipment for accessing the network according to the first notification message.

Therefore, the first network device and the second network device can detect the state of the EoGRE tunnel by mutually sending ICMP messages, and the first network device and the second network device do not need to support the VXLAN technology, so that the problem that in the process of realizing network intercommunication among tenants of different sites by using the VXLAN technology, the network devices all need to support the VXLAN technology and cannot know the state of the VXLAN tunnel, and the two-layer message of the tenant is discarded is solved. And realizing the transmission of the two-layer Ethernet message across the three-layer IP network through the EoGRE tunnel.

Based on the same inventive concept, the embodiment of the present application further provides a network device, as shown in fig. 3, including a processor 310, a transceiver 320, and a machine-readable storage medium 330, where the machine-readable storage medium 330 stores machine-executable instructions capable of being executed by the processor 310, and the processor 310 is caused by the machine-executable instructions to perform the communication method provided by the embodiment of the present application. The communication apparatus shown in fig. 2 can be implemented by using the hardware structure of the network device shown in fig. 3.

The computer-readable storage medium 330 may include a Random Access Memory (RAM) or a Non-volatile Memory (NVM), such as at least one disk Memory. Optionally, the computer-readable storage medium 330 may also be at least one memory device located remotely from the processor 310.

The Processor 310 may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; the Integrated Circuit can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.

In the embodiment of the present application, the processor 310 is caused by machine executable instructions, which are read from the machine readable storage medium 330, to implement the processor 310 itself and invoke the transceiver 320 to perform the communication method described in the embodiment of the present application.

Additionally, the present application provides a machine-readable storage medium 330, the machine-readable storage medium 330 stores machine-executable instructions, which when invoked and executed by the processor 310, cause the processor 310 itself and the invoking transceiver 320 to perform the communication methods described in the present application embodiments.

The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.

For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.

As for the embodiments of the communication apparatus and the machine-readable storage medium, since the contents of the related methods are substantially similar to those of the foregoing embodiments of the methods, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the embodiments of the methods.

The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:多连接接入点

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!