Background technology
Along with the continuous evolution of Internet technology with and the explosivity development of scale, internet, applications has extended to the every aspect of contemporary society's life gradually from scientific research field originally.Increasing based on network key business is surging forward, and network becomes the new motive force that the mankind increase productivity and promote quality of life.
Yet, the technical foundation of the Internet, promptly the IP network technology but exists such as problems such as safety, service quality, operation modes on natural.Wherein, the safe practice of IP network is very important one side, because the opening of IP network makes its safety problem become very complicated again.IP network simple and being opened in when facilitating the Internet fast development also caused IP network to introduce the weakness of security breaches easily.On the other hand, further developing of network security technology also facilitated in the threat of network security, and reversal path of unicast is transmitted (URPF, Unicast Reverse Path Forwarding) and checked to be exactly a kind of network security technology that prevents that IP spoofing from attacking.
The major function that URPF checks is the attack that prevents based on source address spoofing.The source address spoofing attack is that the invador constructs and send a series of messages that have cook source address, for the application of using based on the IP address validation, this attack method can cause the authority of unauthorized user with other people identity acquisition access system, even visits with administrator right.
Fig. 1 is the networking schematic diagram that existing URPF inspection technology is described.Referring to Fig. 1, be that to forge source IP address on the router-A of 1.1.1.8/8 be the message of 2.2.2.1/8 in the IP address, and, during router B response request, response message is sent to the IP address really be the router C of 2.2.2.1/8 to router B initiation request as server.Therefore, the invalid packet of router-A forgery has all caused attack to router B and router C.
URPF checks that technology can be applied in the environment shown in Figure 1, promptly on router B, search the outgoing interface of this IP address according to the source IP address that receives message, whether the outgoing interface of judging this IP address is consistent with the incoming interface that receives message, if checking, unanimity then URPF pass through, if it is inconsistent then think that URPF checks and do not pass through, and the message that is received is taked corresponding processing, as dropping packets etc.
By above-mentioned explanation as seen, existing URPF inspection technology is based on the inspection of IP layer, and current network attack has permeated each side, and only the inspection based on the IP layer seems that some is thin, can not guarantee network security well.
Summary of the invention
The invention provides a kind of packet safety detection method, this method can guarantee network security better.
The present invention also provides a kind of packet safety detection device, and this device can guarantee network security better.
For achieving the above object, technical scheme of the present invention specifically is achieved in that
The invention discloses a kind of packet safety detection method, this method comprises:
The network equipment receives message;
The network equipment is searched routing table according to the source IP address of described reception message, obtains the next-hop ip address in the destination address route table items identical with the source IP address of described reception message;
The network equipment is searched the ARP table according to the next-hop ip address that is obtained, and obtains the media access control MAC address corresponding with described next-hop ip address;
The network equipment judges whether the MAC Address of being obtained is identical with the source MAC of described reception message, is to determine that then described reception message is legal message, otherwise determines that described reception message is an invalid packet.
The invention also discloses a kind of packet safety detection device, this device comprises: message processing module (MPM) and safety check module, wherein,
Message processing module (MPM) is used to receive message, and the source IP address and the source MAC of described reception message sent to safety check module;
Described safety check module is used for behind the source IP address and source MAC that receive from message processing module (MPM), by search routing table obtain destination address with described from the next-hop ip address in the identical route table items of the source IP address of message processing module (MPM); Search the ARP table according to the next-hop ip address that is obtained, obtain the MAC Address corresponding with described next-hop ip address; Judge whether the MAC Address of being obtained is identical with the source MAC that is received, and is then to return legal message acknowledge message to message processing module (MPM), otherwise returns the invalid packet acknowledge message to message processing module (MPM).
As seen from the above technical solution, after this network equipment of the present invention receives message, source IP address according to described reception message is searched routing table, obtain the next-hop ip address in the destination address route table items identical with the source IP address of described reception message, search the ARP table according to the next-hop ip address that is obtained then, obtain the media access control MAC address corresponding with described next-hop ip address, judge whether the MAC Address of being obtained is identical with the source MAC of described reception message, be to determine that then described reception message is legal message, otherwise determine the technical scheme that described reception message is an invalid packet, can be by checking the source MAC of IP message, the message that the filtered source MAC Address is illegal, thereby prevent the attack of invalid packet, guarantee the safety of network better network.
Embodiment
Core concept of the present invention is: utilize in the IP message repeating process revolution to send out the characteristics that a jumping can be changed the message source MAC Address, obtain the next hop address of this address according to the source IP address of message, obtain corresponding ARP list item according to next hop address then, compare the legitimacy of confirmation message at source MAC according to MAC Address in the ARP list item and message.
Fig. 2 is the flow chart of a kind of packet safety detection method of the embodiment of the invention.As shown in Figure 2, may further comprise the steps:
Step 201, the network equipment receives message.
Step 202, the network equipment is searched routing table according to the source IP address of described reception message, obtains the next-hop ip address in the destination address route table items identical with the source IP address of described reception message.
Step 203, the network equipment is searched the ARP table according to the next-hop ip address that is obtained, and obtains the media access control MAC address corresponding with described next-hop ip address.
Step 204, the network equipment judge whether the MAC Address of being obtained is identical with the source MAC of described reception message, are to determine that then described reception message is legal message, otherwise determine that described reception message is an invalid packet.
In this step, the network equipment can take appropriate measures after being invalid packet determine receiving message, as reception message etc. as described in abandoning.
The present invention's packet safety detection method as shown in Figure 2 passes through to check the source MAC of IP message, the message that the filtered source MAC Address is illegal, thus prevent the attack of invalid packet to network, guarantee the safety of network better.In addition, the present invention's method as shown in Figure 2 can combine with existing URPF inspection technology based on IP address check, promptly can check based on the source IP address of message earlier, check based on the message source MAC Address again, guarantee that the link layer data security of IP message is reliable.Therefore can also carry out following steps before above-mentioned step 202: the network equipment is searched routing table according to the source IP address of described reception message, obtain the outgoing interface in the destination address route table items identical with the source IP address of described reception message, the outgoing interface that judgement is obtained goes into the reception message whether reception is same interface, be to determine that then described reception message is legal message, otherwise determine that described reception message is an invalid packet, continue execution in step 202 to step 204.
In the present invention's packet safety detection method as shown in Figure 2, the described network equipment is router or three-tier switch.
For making purpose of the present invention, technical scheme and advantage clearer, below enumerate a specific embodiment, the present invention is described in more detail.
Fig. 3 is the networking schematic diagram that packet safety detection method of the present invention is described.As shown in Figure 3, router R2 is as access layer equipment, following extension Layer 2 switch A; Layer 2 switch A inserts three subscriber's main stations; And R2 links to each other with router R1, and R1 links to each other with server B.Subscriber's main station is successively by Layer 2 switch A, R2 and R1 access server B.The process of present embodiment comprises:
1) the IP address is in the subscriber's main station of 192.168.1.5 after the virus, and sending a large amount of source IP addresss is the scanning message of 192.168.1.5, source MAC change at random, and the purpose IP address of message is the server B that is connected with R1.This can cause server B to receive a large amount of source IP addresss is 192.168.1.5, the rubbish message of source MAC change at random, and can consume the ample resources of server B to the processing of these rubbish messages, thus server B is caused attack.
2) after R2 receives that source IP address is the message of 192.168.1.5, search the routing table of self according to 192.168.1.5, obtaining with 192.168.1.5 is next hop address in the route table items of destination address, search the ARP table of self then according to the next hop address of being obtained, obtain the MAC Address corresponding with described next hop address.
According to networking shown in Figure 3 and existing route technology as can be known, the destination address in the routing table of R2 is that the route table items of 192.168.1.5 is as shown in table 1:
Purpose IP address |
Next-hop ip address |
Outgoing interface |
192.168.1.5/32 |
192.168.1.5 |
VLAN 10 |
Table 1
The ARP list item corresponding with 192.168.1.5 in the APR table of R2 is as shown in table 2:
The IP address |
MAC Address |
VLAN |
192.168.1.5 |
0-0-5 |
VLAN 10 |
Table 2
According to table 1 as can be known, be that next-hop ip address in the route table items of destination address is 192.168.1.5 with 192.168.1.5; According to table 2 as can be known, corresponding with 192.168.1.5 MAC Address is 0-0-5 (the IP address is the real mac address of the subscriber's main station of 192.168.1.5).
3) R2 is that the source MAC of the message of 192.168.1.5 compares with the MAC Address 0-0-5 that obtained and the source IP address that is received, if the two is identical, then message normally is transmitted to R1, otherwise, if inequality, direct dropping packets then.
Therefore, the IP address is the scanning message of a large amount of source MAC change at random of sending of the subscriber's main station of 192.168.1.5, can be abandoned by R2.
In the embodiment shown in fig. 3, access layer equipment R2 has filtered the attack of subscriber's main station to the server B of network side, thereby prevents the influence of the attack of invalid packet to core network, has increased the fail safe of network.
In addition, if the IP address among Fig. 3 is in the subscriber's main station of 192.168.1.5 after the virus, send a large amount of source IP address change at random, but MAC Address is not during the scanning message of change at random, use technical scheme router R2 of the present invention and also can detect these attack messages, and carry out discard processing.Be specially: after R2 receives the above-mentioned scanning message that this subscriber's main station sends, search the routing table of self according to the source IP address of message, obtaining with this source IP address is next hop address in the route table items of destination address, search the ARP table of self then according to the next hop address of being obtained, obtain the MAC Address corresponding with described next hop address; When R2 compared the source MAC of the MAC Address obtained and the scanning message that is received, the two was inequality, and R2 directly abandons the scanning message.In addition, when the source IP address of the above-mentioned scanning message that R2 sends according to subscriber's main station is the routing table of purpose IP address search self, also may can not find out corresponding list item, this time, R2 directly abandoned the scanning message.
Based on the foregoing description, next provide the composition structure of a kind of packet safety detection device of the present invention.
Fig. 4 is the composition structured flowchart of a kind of packet safety detection device of the embodiment of the invention.As shown in Figure 4, this device comprises: message processing module (MPM) 401 and safety check module 402, wherein:
Message processing module (MPM) 401 is used to receive message, and the source IP address and the source MAC of described reception message sent to safety check module 402;
Safety check module 402 is used for behind the source IP address and source MAC that receive from message processing module (MPM) 401, obtains next-hop ip address in the destination address route table items identical with the source IP address of described reception by searching routing table; Search the ARP table according to the next-hop ip address that is obtained, obtain the MAC Address corresponding with described next-hop ip address; Judge whether the MAC Address of being obtained is identical with the source MAC that is received, and is then to return legal message acknowledge message to message processing module (MPM) 401, otherwise returns the invalid packet acknowledge message to message processing module (MPM) 401.
In Fig. 4, message processing module (MPM) 401 when receiving the invalid packet acknowledge message that safety check module 402 returns, abandons described reception message.
In Fig. 4, message processing module (MPM) 401 is further used for the incoming interface sign of described reception message is sent to safety check module 402; Safety check module 402, be further used for obtaining outgoing interface sign in the destination address route table items identical with the source IP address of described reception by searching routing table, judge whether the outgoing interface sign of being obtained is consistent with the incoming interface sign that is received, be then to return legal message acknowledge message, otherwise return the invalid packet acknowledge message to message processing module (MPM) to message processing module (MPM).
In Fig. 4, safety check module 402, be further used for behind the source IP address and source MAC that receive from message processing module (MPM) 401, by searching routing table when not finding the identical route table items of source IP address with described reception, return the invalid packet acknowledge message to message processing module (MPM) 401; Message processing module (MPM) 401 when receiving this invalid packet acknowledge message that safety check module 402 returns, abandons described reception message.
Device as shown in Figure 4 can be router, perhaps can be three-tier switch.
In sum, after this network equipment of the present invention receives message, source IP address according to described reception message is searched routing table, obtain the next-hop ip address in the destination address route table items identical with the source IP address of described reception message, search the ARP table according to the next-hop ip address that is obtained then, obtain the media access control MAC address corresponding with described next-hop ip address, judge whether the MAC Address of being obtained is identical with the source MAC of described reception message, be to determine that then described reception message is legal message, otherwise determine the technical scheme that described reception message is an invalid packet, existing URPF technology is replenished, strengthened the function that URPF checks, and in access layer network, can be by checking the source MAC of IP message, the message that the filtered source MAC Address is illegal, thus the attack of invalid packet prevented to core network, strengthen the fail safe of network.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention, all any modifications of being made within the spirit and principles in the present invention, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.