Summary of the invention
The embodiment of the present invention provides a kind of route renewing method and device, computer installation and readable storage medium storing program for executing, is used for
Solve the low technical problem of existing network maintenance efficiency.
In a first aspect, being applied to the first equipment the embodiment of the invention provides a kind of route renewing method, comprising:
Receive the Internet protocol address IP packet from second equipment different from first equipment;
Determine the corresponding IP address of source medium access control MAC Address of the IP packet;
If the IP address is different from the source IP address of the IP packet, the IP packet is configured by the IP address
The gateway address of backhaul routing.
In the technical solution of the embodiment of the present invention, the first equipment is received from second equipment different from the first equipment
IP packet, it is first determined IP address corresponding with the MAC Address of the IP packet, then, if the source of the IP address and the IP packet
IP address is different, then configures the IP address to the gateway address of the backhaul routing of the IP packet.That is, if the first equipment
The source IP address for receiving the IP packet of the second device forwards is not the IP address of the second equipment, by by the IP of the second equipment
Location is configured to the gateway address of the backhaul routing of the IP packet, so that it is determined that going out the backhaul routing of the IP packet.Due to entire real
Existing process is based on directly on the configuration that message routes backhaul, therefore, effectively increases network operation efficiency.
Optionally, the corresponding IP address of source MAC of the determination IP packet, comprising:
Determine the source MAC of the IP packet;
Determine the Address Resolution Protocol ARP table locally saved;Wherein, source MAC and IP address are saved in the ARP table
Corresponding relationship;
IP address corresponding with the source MAC is determined according to the ARP table.
In the technical solution of the embodiment of the present invention, firstly, parsing to IP packet, the source MAC of the IP packet is determined
Address, then, the ARP (Address Resolution Protocol, address resolution protocol) locally saved according to the first equipment
Table determines and IP address corresponding to the source MAC.That is, being directly based upon the ARP table saved in the first equipment, come
IP address corresponding to the source MAC of the IP packet is determined, due to entirely realizing process more quickly and efficiently, to improve
Network operation efficiency.
Optionally, the gateway address of the backhaul routing for configuring the IP address to the IP packet, comprising:
With configuring the IP address to by socket or ioctl function the gateway of the backhaul routing of the IP packet
Location.
In the technical solution of the embodiment of the present invention, institute is configured for the IP address by socket or ioctl function
State the gateway address of the backhaul routing of IP packet.That is, directly being realized by socket function or ioctl function to this
The configuration of the backhaul routing of IP packet.To realize automatically configuring for the backhaul routing to IP packet, manual maintenance is reduced
Cost, improve network operation efficiency.
Second aspect, the embodiment of the invention provides a kind of routing update devices, are applied to the first equipment, comprising:
Receiving unit, for receiving the Internet protocol address IP report from second equipment different from first equipment
Text;
Determination unit, for determining the corresponding IP address of source medium access control MAC Address of the IP packet;
Configuration unit configures institute for the IP address if the IP address is different from the source IP address of the IP packet
State the gateway address of the backhaul routing of IP packet.
Optionally, the determination unit is specifically used for:
Determine the source MAC of the IP packet;
Determine the Address Resolution Protocol ARP table locally saved;Wherein, source MAC and IP address are saved in the ARP table
Corresponding relationship;
IP address corresponding with the source MAC is determined according to the ARP table.
Optionally, the configuration unit is specifically used for:
With configuring the IP address to by socket or ioctl function the gateway of the backhaul routing of the IP packet
Location.
The third aspect, the embodiment of the invention also provides a kind of computer installations, comprising: processor, memory and transmitting-receiving
Machine;Wherein, the memory is stored with computer program, and the processor is executed for reading the program in the memory
Step described in above-mentioned route renewing method.
Fourth aspect, the embodiment of the invention also provides a kind of computer readable storage mediums, are stored thereon with computer
Program, the computer program realize step described in above-mentioned route renewing method when being executed by processor.
" first ", " second " in description and claims of this specification and above-mentioned attached drawing etc. are for distinguishing difference
Object is not use to describe a particular order.In addition, term " includes " and their any deformation, it is intended that covering is not
Exclusive includes.Such as it contains the process, method, system, product or equipment of a series of steps or units and is not limited to
The step of listing or unit, but optionally further comprising the step of not listing or unit, or optionally further comprising for these
The intrinsic other step or units of process, method, product or equipment.
Referenced herein " embodiment " is it is meant that a particular feature, structure, or characteristic described can wrap in conjunction with the embodiments
Containing at least one embodiment of the present invention.Each position in the description occur the phrase might not each mean it is identical
Embodiment, nor the independent or alternative embodiment with other embodiments mutual exclusion.Those skilled in the art explicitly and
Implicitly understand, embodiment described herein can be combined with other embodiments.
In order to better understand the above technical scheme, below by attached drawing and specific embodiment to technical solution of the present invention
It is described in detail, it should be understood that the specific features in the embodiment of the present invention and embodiment are to the detailed of technical solution of the present invention
Thin explanation, rather than the restriction to technical solution of the present invention, in the absence of conflict, the embodiment of the present invention and embodiment
In technical characteristic can be combined with each other.
A kind of exemplary block diagram for the communication system that Fig. 1 is applicable in for institute's providing method of the embodiment of the present invention.Specifically,
IP packet is forwarded and is received by network interface between one equipment and the second equipment.Wherein, network interface can be
RJ-45 interface, console interface, etc..By taking the second equipment sends IP packet A to the first equipment as an example, wherein IP packet A's
In source address, (Media Acess Control, the medium access control) address MAC is E8-39-35-39-5E-AA, IP address
For 40.0.2.1;In the destination address of IP packet A, MAC Address E8-39-35-39-5E-BB, IP address 40.0.2.0;The
The MAC Address of two equipment is E8-39-35-39-5E-AA, IP address 192.168.26.115.The MAC Address of first equipment is
E8-39-35-39-5E-BB, IP address 192.168.26.100.Wherein, the source IP address 40.0.2.1 and second of IP packet A
The IP address 192.168.26.115 of equipment is different.That is, the source IP address of the IP packet of the second device forwards is not
The IP address of two equipment.In this way, which the first equipment can not determine IP packet A after the first equipment receives IP packet A
Backhaul routing.In this case, it just cannot achieve the closed-loop communication of IP packet A.
In order to realize the closed-loop communication of IP packet, the embodiment of the invention provides a kind of route renewing methods.Still it is with Fig. 1
Example realizes the configuration of backhaul routing of first equipment to IP packet A using the route renewing method.Receiving in the first equipment should
After IP packet A, IP packet A can be forwarded to the second equipment by the first equipment, to realize IP packet A in the first equipment
With the closed-loop communication of the second equipment room.
Referring to FIG. 2, being a kind of flow chart of route renewing method provided in an embodiment of the present invention, which is described such as
Under:
S101: the Internet protocol address IP packet from second equipment different from first equipment is received.
In a particular embodiment, the first equipment receives the IP packet from the second equipment.In this step, the first equipment
It can also be and receive the IP packet from the third equipment different from the first equipment and the second equipment, details are not described herein again
?.
S102: the corresponding IP address of source medium access control MAC Address of the IP packet is determined;
In this step, which is specially resulting address after parsing to the IP packet.
In the specific implementation process, the MAC Address institute can be determined according to the corresponding relationship between MAC Address and IP address
Corresponding IP address.The one of of IP address corresponding to the MAC Address for determining the IP packet is illustrated in figure 3 to realize
Mode.The implementation may comprise steps of:
S201: the source MAC of the IP packet is determined;
S202: the Address Resolution Protocol ARP table locally saved is determined;Wherein, in the ARP table save source MAC with
IP address corresponding relationship;
S203: IP address corresponding with the source MAC is determined according to the ARP table.
In this step, firstly, obtaining the source MAC of the IP packet by parsing to the received IP packet of institute.
Then, it is determined that the ARP table locally saved.Due to preserving source MAC and IP address corresponding relationship in the ARP table.Therefore, just
IP address corresponding with the source MAC is determined according to the ARP table.Still by taking Fig. 1 as an example, by determined by the ARP table with
The corresponding IP address of the source MAC is 192.168.26.115.In embodiments of the present invention, due to having in each equipment
ARP table is directly based upon ARP table to determine whether IP address corresponding with the source MAC, and entire realization process is more quick
Efficiently, network operation efficiency is improved.
S103: if the IP address is different from the source IP address of the IP packet, the IP is configured by the IP address
The gateway address of the backhaul routing of message.
In this step, by parsing to the IP packet, the source IP address of the IP packet is obtained.If the second equipment turns
The source IP address of the IP packet of hair is not the IP address of the second equipment, then configures this for IP address corresponding to the MAC Address
The gateway address of the backhaul routing of IP packet.It in this case, can be by IP packet after the first equipment receives IP packet
Corresponding business routes to the second equipment, to realize the closed-loop communication of IP packet.Since whole process is directly based upon message
It can realize automatically configuring for backhaul routing, improve network operation efficiency.
Still by taking Fig. 1 as an example, the second equipment sends IP packet A to the first equipment.Wherein, the MAC Address of IP packet A is corresponding
IP address be 192.168.26.115, the source IP address of IP packet A is 40.0.2.1, and the two is different.By IP address
192.168.26.115 it is set as after the gateway address of backhaul routing of IP packet A, the first equipment can report the IP
The corresponding business of literary A routes to the second equipment, to realize the closed-loop communication of IP packet A.
In embodiments of the present invention, the IP packet is configured for the IP address by socket or ioctl function
The gateway address of backhaul routing.
Specifically, can be using Linux programming function socket () function or ioctl () function, it will be according to ARP
Table determine with IP address corresponding to source MAC, be configured to IP packet backhaul routing gateway address.Still with Fig. 1
For, it, specifically can be by socket () function or ioctl () function by IP after the first equipment receives IP packet A
Location 192.168.26.115 is set as the gateway address of the backhaul routing of IP packet A, routes to realize to IP packet A backhaul
Automatically configure.As it can be seen that be arranged by function IP packet backhaul routing gateway address, effectively reduce manual maintenance at
This, improves network operation efficiency.
It in embodiments of the present invention, will be true according to ARP table except through socket () function or ioctl () function
It is fixed with IP address corresponding to source MAC, be configured to outside the gateway address of backhaul routing of IP packet, those skilled in the art
The configuration for the gateway address that member can also use other functions to realize that the backhaul to IP packet routes according to actual needs, herein
Just repeat no more.
In embodiments of the present invention, if the IP address is identical as the source IP address, it is not reconfigured the backhaul routing
Gateway address, to improve network operation efficiency.
In embodiments of the present invention, in order to further increase network operation efficiency, if in the ARP table not with the source
The corresponding IP address of MAC Address is not reconfigured the gateway address of the backhaul routing.
Device provided in an embodiment of the present invention is introduced with reference to the accompanying drawing.
It is illustrated in figure 4 a kind of routing update device provided in an embodiment of the present invention, which includes receiving
Unit 10, determination unit 20, configuration unit 30.Wherein:
Receiving unit 10, for receiving the Internet protocol address IP from second equipment different from first equipment
Message;
Determination unit 20, for determining the corresponding IP address of source medium access control MAC Address of the IP packet;
Configuration unit 30 configures the IP address to if the IP address is different from the source IP address of the IP packet
The gateway address of the backhaul routing of the IP packet.
In embodiments of the present invention, determination unit 20 is specifically used for:
Determine the source MAC of the IP packet;
Determine the Address Resolution Protocol ARP table locally saved;Wherein, source MAC and IP address are saved in the ARP table
Corresponding relationship;
IP address corresponding with the source MAC is determined according to the ARP table.
In embodiments of the present invention, configuration unit 30 is specifically used for:
With configuring the IP address to by socket or ioctl function the gateway of the backhaul routing of the IP packet
Location.
For convenience of description, above each section is divided by function describes respectively for each module (or unit).Certainly, exist
Implement to realize the function of each module (or unit) in same or multiple softwares or hardware when the present invention.
Based on the same technical idea, the embodiment of the present application also provides a kind of computer installations, which can
Realize the method in previous embodiment.
Referring to FIG. 5, being the structural schematic diagram of computer installation provided in an embodiment of the present invention, the computer installation packet
It includes: processor 40, memory 50, transceiver 60 and bus interface.
Processor 40, which is responsible for management bus architecture and common processing, memory 50, can store processor 40 and is executing behaviour
Used data when making.Transceiver 60 for sending and receiving data under the control of processor 40.
Bus architecture may include the bus and bridge of any number of interconnection, one or more specifically represented by processor 40
The various circuits for the memory that a processor and memory 50 represent link together.Bus architecture can also such as will be set periphery
Various other circuits of standby, voltage-stablizer and management circuit or the like link together, and these are all it is known in the art,
Therefore, it will not be further described herein.Bus interface provides interface.Processor 40 is responsible for management bus architecture and is led to
Normal processing, memory 50 can store the used data when executing operation of processor 40.
The process that the embodiment of the present invention discloses, can be applied in processor 40, or realized by processor 40.It is realizing
In the process, each step of signal processing flow can pass through the integrated logic circuit or software form of the hardware in processor 40
Instruction complete.Processor 40 can be general processor, digital signal processor, specific integrated circuit, field programmable gate
Array or other programmable logic device, discrete gate perhaps transistor logic, discrete hardware components may be implemented or
Execute disclosed each method, step and the logic diagram in the embodiment of the present invention.General processor can be microprocessor or
Any conventional processor etc..The step of route renewing method in conjunction with disclosed in the embodiment of the present invention, can be embodied directly in firmly
Part processor executes completion, or in processor hardware and software module combination execute completion.Software module can be located at
Random access memory, flash memory, read-only memory, programmable read only memory or electrically erasable programmable memory, register etc.
In the storage medium of this field maturation.The storage medium is located at memory 50, and processor 40 reads the information in memory 50, knot
Close the step of its hardware completes signal processing flow.
Specifically, the processor 40 executes described in above-mentioned route renewing method for reading the program in memory 50
Either step.
Based on the same technical idea, it the embodiment of the present application also provides a kind of computer readable storage medium, deposits thereon
Contain computer program.The computer program realizes either step described in aforementioned route renewing method when being executed by processor.
It should be understood by those skilled in the art that, embodiments herein can provide as method, system or computer program
Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the application
Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the application, which can be used in one or more,
The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces
The form of product.
The application be referring to according to the present processes, equipment (system) and computer program product flow chart and/or
Block diagram describes.It should be understood that each process that can be realized by computer program instructions in flowchart and/or the block diagram and/or
The combination of process and/or box in box and flowchart and/or the block diagram.It can provide these computer program instructions to arrive
General purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices processor to generate one
Machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for realizing flowing
The device for the function of being specified in journey figure one process or multiple processes and/or block diagrams one box or multiple boxes.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
Obviously, those skilled in the art can carry out various modification and variations without departing from the essence of the application to the application
Mind and range.In this way, if these modifications and variations of the application belong to the range of the claim of this application and its equivalent technologies
Within, then the application is also intended to include these modifications and variations.