Background technology
Based on transmission control protocol/internet interconnection protocol (TCP/IP, Transmission ControlProtocol/Internet Protocol) during the media server of network was used, medium were transmitted veneer and need be realized the transmission of signaling and media message and transmit processing by switch and external bearer network communication.Before transmission is transmitted, except to detect medium transmit physics network interface state that veneer is connected with bearer network whether normal, also to detect the bearer network link that medium forwarding veneer network interface connected and whether can reach.For the inaccessible network interface of network, do not carry out message transmissions and transmit processing.
Existing link detecting technology mainly is divided into following two kinds:
One, carries out link detecting based on Internet Control Message Protocol (ICMP, Internet Control Message Protocol).Transmitting between the veneers (perhaps medium are transmitted between veneer and the switch) at two medium that carry out link communication sends ping message, promptly sends icmp packet, if network can reach, then opposite end medium forwarding veneer will respond the ping message, so also just can transmit veneer network interface deploy media business at the local terminal medium.
Two,, realize the communication pattern of client/server by general socket programming.Client regularly sends heartbeat message to server, and server is to client echo reply message, realizes detection to link between the client and server with this.This also is to detect both sides' Link State whether to use way normally always.
In media server, need transmit veneer by medium and realize communication between interior signaling media data and the extraneous bearer network.The correct forwarding of medium and signaling must be a prerequisite with normally can reaching of link.Link detecting between medium forwarding veneer and the external bearer network becomes very necessary like this.
For first kind of link detecting technology, media server can be handled the lot of data message, especially send receiving element for medium, instantaneous message throughput is very big, handle so need that in media server corresponding speed limit is done in packet sending and receiving, can't normally in time handle to prevent too fast causing of message rate.Such as for icmp packet, if message surpasses 2000 then can abandon message above threshold values in 5 seconds.When media server carrying IPTV (IPTV) is used, if on a network interface, set up 20 channels, and by PC this channel is carried out program request and operate, experiment finds to have a large amount of real time transport protocol (RTP, Real-time Transport Protocol) media message mails to media server, and flow can reach dozens or even hundreds of million.At this moment medium are transmitted veneer and have been entered the speed limit processing, can abandon the icmp packet that sends over, comprise the icmp packet that is used to set up link, the external network interface of this medium forwarding veneer will think that link is unreachable like this, at this moment, the channel that is carried on this network interface will all be reconstructed on the normal network interface of link.And in fact this network interface link is normal, does not but play the effect that the medium signaling is transmitted.
For second kind of link detecting technology, this is a kind of present use method of network internal link maintenance very widely.Client and server timed sending heartbeat signal when not receiving heartbeat signal in a period of time, thinks that then link is obstructed.But for media server, there is certain restrictive condition in this technology on using, must use identical agreement between the client and server of transmission heartbeat signal, and medium are transmitted veneer and are normally needed to link switching equipment and realize that external Communications service, switch and medium transmit the equipment difference that exists between the veneer and cause the heartbeat message can't intercommunication.So in media server, it is unworkable to carry out link detecting by heartbeat mechanism.
Summary of the invention
In view of this, main purpose of the present invention is to provide a kind of chain circuit detecting method and system based on the ARP agreement, makes it be applicable to that medium in the media server transmit the link detecting between the veneer and the external bearer network switch.
For achieving the above object, technical scheme of the present invention is achieved in that
The invention provides a kind of chain circuit detecting method based on the ARP agreement, this method comprises:
Transmit configuration information calculated address analysis protocol (ARP) request message of the outer network interface of veneer according to medium in the media server, and send to the switch that is connected with described outer network interface;
After described switch received described ARP request message, network interface returned the arp reply message outside described;
According to described arp reply message the link between described outer network interface and the described switch is detected.
The configuration information of described outer network interface comprises at least: medium access control (MAC) address of internet interconnection protocol (IP) address of described outer network interface, described outer network interface and the IP address of described switch.
Before the described generation ARP request message, this method further comprises: according to the configuration information of the described outer network interface of link detecting acquisition request.
This method further comprises: described ARP request message is periodically sent to described switch.
Described link is detected, is specially:
After described outer network interface is received described arp reply message within the predetermined time, judge that the link between described outer network interface and the described switch is normal; Otherwise, judge that described link is unusual.
After the detection of described link finished, this method further comprised: in global variable, be provided with described outside the state information of network interface, and according to the state information of described outer network interface in described media server deploy business.
The present invention also provides a kind of link detecting system based on the ARP agreement, and this system comprises: media server and switch, wherein:
Described media server is used for transmitting according to medium the configuration information generation ARP request message of the outer network interface of veneer, and sends to the switch that is connected with described outer network interface; Also be used to receive the arp reply message that described switch returns, and the link between described outer network interface and the described switch detected according to described arp reply message;
Described switch is used to receive the ARP request message that described media server sends, and network interface returns described arp reply message outside described media server described.
Described media server comprises: link detecting module and database configuration module, wherein,
Described ARP link detecting module is used for sending the link detecting request to described database configuration module, to obtain the configuration information of described outer network interface; Also be used to generate the ARP request message, and periodically send to described switch; Also be used to receive the arp reply message that described switch returns, and the link between described outer network interface and the described switch detected, obtain testing result according to described arp reply message;
The database configuration module is used to store the configuration information of described outer network interface, and offers described ARP link detecting module.
Described ARP link detecting module is further used for judging that the link between described outer network interface and the described switch is normal after network interface is received described arp reply message within the predetermined time outside described; Otherwise, judge that described link is unusual.
Described media server further comprises: system control module, be used for detecting the result of link according to described ARP link detecting module, in global variable, be provided with described outside the state information of network interface; And the state information of the described outer network interface of foundation is in described media server deploy business.
The present invention is based on the link detecting scheme of ARP agreement, the special ARP study message of transmission between outer network interface by transmitting veneer at the medium of media server and the coupled switch, comprise ARP request message and arp reply message, whether the link that detects between described outer network interface and the switch is normal.Because ARP study message is only as link detecting, therefore, transmit veneer because to handle flow big and icmp packet is carried out speed limit when handling when medium, can not influence reception to ARP study message yet; In addition, since among the present invention to ARP study message adopt periodically send mode, as every ARP request message of 2s timed sending, if do not receive the arp reply message in the 10s, think that then link is obstructed, so can reach the effect of the real-time detection network the same with heartbeat mechanism.
Because the ARP study message of the present invention's transmission is followed the TCP/IP standard protocol stack, its essence is to obtain the purpose ethernet address by known purpose IP address; The purpose ethernet address that gets access to is used for encapsulating the Ethernet data bag, therefore can correctly transmits, be applicable to the link detecting between the medium forwarding veneer and the external bearer network switch at link layer.
Embodiment
The technical solution of the present invention is further elaborated below in conjunction with the drawings and specific embodiments.
The present invention is based on the link detecting scheme of ARP agreement, transmission ARP study message between outer network interface by transmitting veneer at the medium of media server and the coupled switch, comprise ARP request message and arp reply message, whether the link that detects between described outer network interface and the switch is normal.
The chain circuit detecting method that the present invention is based on the ARP agreement comprises as shown in Figure 1:
Step 101, the configuration information of transmitting the outer network interface of veneer according to medium in the media server generates the ARP request message, and sends to the switch that is connected with outer network interface.
After step 102, switch received the ARP request message, outwards network interface returned the arp reply message.
Step 103 detects according to the link between external network interface of arp reply message and the switch.
In order to realize chain circuit detecting method based on the ARP agreement, the invention provides following functional module: ARP link detecting module, database configuration module and system control module, these three module application in media server, by with media server external switch between cooperate and realize link detecting based on the ARP agreement.Below by specific embodiment detection method of the present invention is described, as shown in Figure 2, this embodiment may further comprise the steps:
Step 201, ARP link detecting module sends the link detecting request to the database configuration module, to obtain the configuration information of outer network interface.
Comprised at least one medium on the media server and transmitted veneer, medium are transmitted on the veneer and are contained a plurality of outer network interfaces, and these outer network interfaces link to each other with external equipment such as switch, other media servers etc., finish communicating by letter between media server and the external equipment.The present invention mainly is the Link State that detects between above-mentioned outer network interface and external switch.
When needs detect some outside during Link State between the coupled switch of network interface, at first, need the ARP link detecting module on the media server to send a link detecting request, to obtain the configuration information of storing in the database configuration module that is somebody's turn to do outer network interface to the database configuration module.
The configuration information of above-mentioned outer network interface comprises at least: IP address, medium access control (MAC, MediaAccess Control) address and purpose IP address, wherein, IP address, MAC Address are respectively the IP address and the MAC Address of this outer network interface, and purpose IP address promptly is meant the IP address of the switch that links to each other with this outer network interface.
Step 202, the configuration information of database configuration module network interface outside ARP link detecting module is returned.
The database configuration module is according to the configuration information of link detecting request network interface outside ARP link detecting module is returned of receiving.
Step 203, ARP link detecting module generates the ARP request message according to the configuration information of outer network interface.
Be illustrated in figure 3 as the data structure of ARP request/response message, for the ARP request message, the value of its each field is as follows:
The purpose ethernet address: comprising 6 bytes, all is 1;
The transmitting terminal ethernet address: being the MAC Address of this outer network interface, also is 6 bytes, is provided with according to the MAC Address in the configuration information of outer network interface;
Frame type: comprise two bytes, be worth and be 0x0806, represent that this message is the ARP request message.
Because what this ARP request message adopted is ethernet frame type, therefore, above-mentioned three fields have been formed the Ethernet frame head of this message.
Type of hardware: the type of expression hardware address, comprise two bytes, value is that what represented the current use of this ARP request message at 1 o'clock is the address of ethernet type;
Protocol type: the protocol address type of indicating to shine upon, comprise two bytes, be worth and be 0x0800, represent that the current protocol address that uses of this ARP request message is the IP type address;
Hardware address length: represent above-mentioned too net type the address, be the length of hardware address, size is 6 bytes;
Length of protocol address: the length of expression above-mentioned IP type address, size is 4 bytes;
Action type (OP): value is 1, and expression ARP request is corresponding with the ARP request message;
Transmitting terminal ethernet address: with the transmitting terminal ethernet address in the Ethernet frame head;
Transmitting terminal IP address: be the IP address of this outer network interface, be provided with according to the IP address in the configuration information of outer network interface;
Purpose ethernet address: with the purpose ethernet address in the Ethernet frame head;
Purpose IP address: the IP address for the switch that links to each other with this outer network interface is provided with according to the purpose IP address in the configuration information of outer network interface.
Step 204, ARP link detecting module sends to switch with the ARP request message.
Start ARP link detecting process, preferably, periodically, as sending an ARP request message to switch, stop up to ARP link detecting process every 2s; Can certainly only send the ARP request message one time.Send after the ARP request message can being packaged into the ARP request package.The duration that concrete ARP link detecting process continues can be provided with as required.
After step 205, switch receive the ARP request message, return the arp reply message to ARP link detecting module.
After switch is received the ARP request message, return the arp reply message at once.For the arp reply message, the value of each field is as follows in this message shown in Figure 3:
The purpose ethernet address: the medium at current outer network interface place transmit veneer hardware address, be ethernet address;
Transmitting terminal ethernet address: exchanger side ethernet address;
Frame type: comprise two bytes,, be worth and be 0x0806 when this message of expression when being the arp reply message.
Because what this arp reply message adopted is ethernet frame type, therefore, above-mentioned three fields have been formed the Ethernet frame head of this message.
Type of hardware: the type of expression hardware address, comprise two bytes, value is that what represented the current use of arp reply message at 1 o'clock is the address of ethernet type;
Protocol type: the protocol address type of indicating to shine upon, comprise two bytes, be worth and be 0x0800, represent that the current protocol address that uses of this arp reply message is the IP type address;
Hardware address length: represent above-mentioned too net type the address, be the length of hardware address, size is 6 bytes;
Length of protocol address: the length of expression above-mentioned IP type address, size is 4 bytes;
Action type (OP): value is 2, and the expression arp reply is corresponding with the arp reply message;
Transmitting terminal ethernet address: exchanger side ethernet address;
Transmitting terminal IP address: exchanger side IP address;
The purpose ethernet address: the medium at current outer network interface place transmit veneer hardware address, be ethernet address;
Purpose IP address: the medium at current outer network interface place are transmitted the IP address of veneer.
Step 206, ARP link detecting module detect the state of link according to the arp reply message.
Concrete, at the ARP request message that sends to switch at every turn,, judge that then the link between this outer network interface and this switch is normal if the arp reply message that ARP link detecting module receives that within the predetermined time switch returns can be set; Otherwise be unusual.
Link detecting is monitoring in real time among the present invention, and therefore, the ARP request message at ARP link detecting module sends to switch at every turn all needs whether to receive in the given time the detection of arp reply message.
Step 207, system control module are provided with the state information of outer network interface according to the link detecting result.
Among the present invention, the state information of outer network interface mainly is: IP address, MAC Address, port status and Link State.Wherein, IP address and MAC Address are the IP address and the MAC Address of this outer network interface, and port status is meant state such as the up or the down of this outer network interface self; Link State promptly is meant Link State between this outer network interface and the switch, comprises normal and unusual two kinds that concrete, can being provided with just often as required, the Link State value is 1; When unusual, the Link State value is 0.
Preferably, the state information of above-mentioned outer network interface can be maintained in the global variable.
Step 208, system control module regularly read the state information of outer network interface, and are implemented in the service deployment on the media server in view of the above.
The state information of network interface outside system control module regularly reads from global variable, and realize the deployment of media server institute loaded service in view of the above is as being that up, Link State are on the network interface outside normal with service deployment to port status.
It is pointed out that the ARP study message that the present invention transmits follows the TCP/IP standard protocol stack, its essence is to obtain the purpose ethernet address by known purpose IP address; The purpose ethernet address that gets access to is used for encapsulating the Ethernet data bag, therefore can correctly transmits, be applicable to the link detecting between the medium forwarding veneer and the external bearer network switch at link layer.
In order to realize above-mentioned detection method, the invention provides a kind of detection system, as shown in Figure 4, comprising: media server 10 and switch 20, wherein:
Media server 10 is used for transmitting according to medium the configuration information generation ARP request message of the outer network interface of veneer, and sends to the switch 20 that is connected with outer network interface; Also be used for the arp reply message that desampler 20 returns, and detect according to the link between external network interface of arp reply message and the switch 20;
Switch 20 is used for the ARP request message that receiving media server 10 sends, and returns the arp reply message to the outer network interface of media server 10.
Media server 10 comprises: ARP link detecting module 11 and database configuration module 12, wherein,
ARP link detecting module 11 is used for sending the link detecting request to database configuration module 12, to obtain the configuration information of outer network interface; Also be used to generate the ARP request message, and periodically send to switch 20; Also be used for the arp reply message that desampler 20 returns, and detect, obtain testing result according to the link between external network interface of arp reply message and the switch 20;
Database configuration module 12 is used to store the configuration information of outer network interface, and offers ARP link detecting module 11.
ARP link detecting module 11 is further used for judging that the link between outer network interface and the switch 20 is normal after network interface is received the arp reply message within the predetermined time outside; Otherwise, judge that link is unusual.
Media server 10 further comprises: system control module 13 is used for the result according to ARP link detecting module 11 detection links, the state information of network interface outside being provided with in global variable; And the state information of the outer network interface of foundation is in media server 10 deploy business.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.