Summary of the invention
To above-mentioned technical problem, the method and system that the object of the present invention is to provide a kind of neighbours of preventing to learn to attack, it has effectively solved the problem that the neighbours that exist in the IPv6 network learn to attack.
For achieving the above object, the present invention realizes through following technical scheme:
The method that a kind of neighbours of preventing learn to attack, said method comprises the steps:
A, the threshold value of the imperfect state neighbor entry that convergence switch allows is set;
B, access switch are intercepted the DHCPv6 request process of monitoring client through DHCPv6, create and the preservation binding information, and this binding information is sent to said convergence switch;
C, convergence switch receive binding information, and it is saved in the binding information table;
D, convergence switch are when transmitting the IPv6 message; If the destination address link corresponding layer address of this message does not exist; Whether the quantity that then detects imperfect state neighbor entry in the neighbor table reaches said threshold value, if do not reach, then sends the neighbor request message to neighbor node; If reach, the neighbor request message in said binding information table, if exist, is then sent in the address of then inquiring about this neighbor node whether, if do not exist, does not then send the neighbor request message;
After E, convergence switch are received the neighbor advertisement message corresponding with said neighbor request message, the quantity of imperfect state neighbor entry in its neighbor table is subtracted 1.
Special, said step B also comprises:
Access switch issues the rule of DHCPv6 message redirecting to this exchange processor to exchange chip; After exchange chip is received the DHCPv6 message; Do not carry out hardware and transmit behavior, but, carry out software by processor and resolve and transmit said message redirecting to access switch processor.
Special, said step B further comprises:
Access switch joins DHCPv6 with said binding information and intercepts in the binding message; And said binding message encrypted with hash handle; Then, the address according to the convergence switch of the reception binding information of access switch configuration is sent to convergence switch with said binding information.
Special, the step C of institute specifically comprises:
Convergence switch parses DHCPv6 and intercepts the binding information of binding in the message, and this binding information is saved in the local binding information table, and wherein, said binding message is meant the binding message that all access switch of being connected with said convergence switch import into.
Special; Among the said step D; If the quantity of imperfect state neighbor entry does not reach threshold value in the neighbor table, then send the neighbor request message, and in said neighbor table, insert a neighbor entry to neighbor node; State is set to imperfect state, and the quantity of imperfect state neighbor entry in the neighbor table is added 1.
Special, said step e specifically also comprises:
Convergence switch is according to the inquiry neighbor table of the destination address of the IPv6 stem of neighbor advertisement message; If find the neighbor entry corresponding with this destination address; Then the link layer address with said neighbor entry is updated to the link layer address that carries in the neighbor advertisement message; And the state of this neighbor entry is set to reachable state, and the quantity of imperfect state neighbor entry in the neighbor table is subtracted 1.
The invention also discloses the system that a kind of neighbours of preventing learn to attack, said system comprises:
Access switch is connected with client, intercepts the DHCPv6 request process of monitoring client through DHCPv6, creates and the preservation binding information, and this binding information is sent to convergence switch;
Convergence switch is connected with access switch, and the threshold value of the imperfect state neighbor entry of permission is set above that, and the binding information of receiving is saved in the binding information table; And when transmitting the IPv6 message; If the destination address link corresponding layer address of this message does not exist, whether the quantity that then detects imperfect state neighbor entry in the neighbor table reaches said threshold value, if do not reach; Then send the neighbor request message to neighbor node; And in said neighbor table, inserting a neighbor entry, state is set to imperfect state, and the quantity of imperfect state neighbor entry in the neighbor table is added 1; If reach, the neighbor request message in said binding information table, if do not exist, is not then sent in the address of then inquiring about this neighbor node whether, if exist, then sends the neighbor request message.
Special, said access switch specifically also is used for
Issue the rule of DHCPv6 message redirecting to this exchange processor to exchange chip; After exchange chip is received the DHCPv6 message; Do not carry out hardware and transmit behavior, but, carry out software by processor and resolve and transmit said message redirecting to access switch processor; Said binding information is joined DHCPv6 intercepts in the binding message; And said binding message encrypted with hash handle; Then, the address according to the convergence switch of the reception binding information of access switch configuration is sent to convergence switch with said binding information.
Special, said convergence switch also is used for
Parse DHCPv6 and intercept the binding information of binding in the message, and this binding information is saved in the local binding information table, wherein, said binding message is meant the binding message that all access switch of being connected with said convergence switch import into.
Special, said convergence switch specifically also is used for
Destination address inquiry neighbor table according to the IPv6 stem of the neighbor advertisement message of receiving corresponding with the neighbor request message; If find the neighbor entry corresponding with this destination address; Then the link layer address with said neighbor entry is updated to the link layer address that carries in the neighbor advertisement message; And the state of this neighbor entry is set to reachable state, and the quantity of imperfect state neighbor entry in the neighbor table is subtracted 1.
Beneficial effect of the present invention does, the method and system that said a kind of neighbours of preventing learn to attack is through being provided with the threshold value of the imperfect state neighbor entry that convergence switch allows; The quantity of imperfect state neighbor entry is when surpassing threshold value in neighbor table; According to the binding information table of intercepting acquisition through DHCPv6; Judge the accessibility of neighbor node; Thereby avoided malicious data is unwrapped a large amount of neighbours of exhibition study, effectively solved the problem that the neighbours that exist in the IPv6 network learn to attack.
Embodiment
For making the object of the invention, technical scheme and advantage clearer, the present invention is described further below in conjunction with accompanying drawing and embodiment.
Please with reference to shown in Figure 1, Fig. 1 prevents the method flow diagram that neighbours learn to attack for what the embodiment of the invention provided.
Prevent in the present embodiment that the method that neighbours learn to attack from comprising the steps:
Step 101, the threshold value of imperfect (Incomplete) state neighbor entry that convergence switch allows is set.On convergence switch, enable IPv6 version (Dynamic Host Configuration Protocol for IPv6 based on DHCP; DHCPv6) intercept the function that neighbours learn to attack that prevents of (SNOOPING), and the threshold value of the imperfect state neighbor entry of this convergence switch permission is set.
Step 102, on access switch, enable DHCPv6 and intercept, trusted port is set, and configuration receives the address of the said convergence switch of binding information.
Access switch enables after DHCPv6 intercepts; Issue the rule of DHCPv6 message redirecting to exchange chip to this exchange processor (CPU); After exchange chip is received the DHCPv6 message; Do not carry out hardware and transmit behavior, but, carry out software by processor and resolve and transmit said message redirecting to access switch processor.
Step 103, access switch are intercepted the DHCPv6 request process of monitoring client through DHCPv6.
Concrete snoop procedure is following:
(1) after access switch is intercepted the DHCPv6 request message of intercepting and capturing client through DHCPv6; Binding table according to source medium access control (MAC) address lookup access switch; If this Media Access Control address is in binding table; Then said DHCPv6 request message is forwarded from trusted port; Otherwise access switch can be created an interim request (REQUEST) binding table earlier, is used to write down the Media Access Control address of client, Transaction Identifier number (Transaction-ID), port and VLAN (the Virtual Local Area Network of DHCPv6 request message; VLAN) information, and then the DHCPv6 request message forwarded from trusted port.
(2) after access switch is intercepted the DHCPv6 response message of intercepting and capturing client through DHCPv6; Resolve Transaction Identifier number, the Internet digital distribution mechanism (Internet Assigned Numbers Authority, the IPv6 address of IANA) distributing and effective life cycle of DHCPv6 response message.Number search the query requests binding table according to Transaction Identifier; If there is the correspondent transaction identification number; Then create a binding information, be used to write down Media Access Control address, IPv6 address, rental period, virtual local area network No. and the port numbers of client (being the DHCPv6 client).
The binding information that step 104, access switch will be created and preserve joins DHCPv6 and intercepts in (SNOOPING) binding message; And said binding message encrypted with hash handle; Then; Address according to the convergence switch of the reception binding information of access switch configuration is sent to convergence switch with said binding information.
DHCPv6 between access switch and the convergence switch intercept bind message use User Datagram Protocol (User Datagram Protocol, UDP) be connected on the network after, propagate.In order to guarantee fail safe and anti-tamper, can intercept DHCPv6 and bind message and encrypt with hash and handle.The data encryption standard of sharing key is adopted in encryption of the present invention, and (Data Encryption Standard, DES) mode, hash adopt Message Digest Algorithm 5 (Message Digest Algorithm MD5 is called for short MD5) mode.
As shown in Figure 2, the DHCPv6 that Fig. 2 provides for the embodiment of the invention intercepts and binds the message format sketch map.
DHCPv6 intercepts the binding message and is carried in the User Datagram Protocol, and the implication of this each field of message is following:
Version: version number is 1 at present;
Type: type is 1 at present, and expression comprises binding information;
SeqNo: sequence number, message of every transmission adds 1;
SecretLen: the length of encrypted message;
Signature:DHCPv6 intercepts the MD5 hash result of binding all fields in the message, and wherein 16octets represents 16 hytes;
SwitchIPAddr: the IPv4 address of switch;
SwitchID: switch identification number (ID), generally get the Media Access Control address of exchange processor, wherein 6octets represents 6 hytes;
Count: bind quantity;
ClientMAC: rent the Media Access Control address of the client of address, wherein 6octets represents 6 hytes;
Reserved: keep, insert 0;
ClientVlanId: the VLAN ID of the switch that client inserts number;
PortNum: the switch ports themselves at client place number;
ClientIP: the IPv6 address of client, wherein 16octets represents 16 hytes;
Effective life cycle of ClientValidLifetime:DHCPv6 addresses distributed;
BindingTimeStamp: the timestamp that distributes the address.
The DES key is by client configuration, and access switch must be guaranteed consistent with the key of convergence switch.Send DHCPv6 intercept bind message before, encrypt earlier, after carry out hash and handle, process is following:
Begin from the SwitchIPAddr field; Until the said binding message content of ending carries out des encryption; Ciphertext is isometric with expressly; Ciphertext is put into DHCPv6 and is intercepted the message zone that the SwitchIPAddr field of binding message begins, and ciphertext length places DHCPv6 to intercept the SecretLen field of binding message, gives the hash processing unit then.Intercept the binding message for the DHCPv6 behind the access switch des encryption; When calculating the MD5 hash; The at first zero clearing of Signature field is made hash operations to whole binding message then, after hash operation is accomplished; Hashed value is inserted the Signature field, and at this moment DHCPv6 intercepts the binding message and just can send access switch.
Step 105, convergence switch parse DHCPv6 and intercept the binding information of binding in the message, and this binding information is saved in the local binding information table.
Convergence switch carries out hash computations earlier after receiving DHCPv6 binding message, deciphering finally parses binding information wherein again, and detailed process is following:
When carrying out hash computations, the first value of backup Signature field, the MD5 hashed value of whole message is calculated in Signature field zero clearing more then; If hashed value is the same with the value of the Signature field of backup, then hash verification success continues that DHCPv6 is intercepted the binding message and makes the DES decryption processing.If the hash verification failure then abandons this DHCPv6 and intercepts the binding message.The successful DHCPv6 of MD5 hash verification for receiving intercepts the binding message; Convergence switch begins position after the Signature field; And length is carried out the DES decryption processing by the binding message content of SecretLen field appointment, restores the DHCPv6 that begins from the SwitchIPAddr field and intercepts the binding message content.
When step 106, convergence switch are the IPv6 message of this network segment at the forwarding destination address,,, handle as follows with reference to shown in Figure 3 if the destination address link corresponding layer address (Link-Layer Address) of this message does not exist:
Whether the quantity of imperfect state neighbor entry reaches said threshold value in step 1061, the detection neighbor table.
Step 1062, according to the testing result of step 1061; If the quantity of imperfect state neighbor entry does not reach said threshold value; Then send the neighbor request message to neighbor node; And in said neighbor table, inserting a neighbor entry, state is set to imperfect state, and the quantity of imperfect state neighbor entry in the neighbor table is added 1.
Step 1063, according to the testing result of step 1061, if the quantity of imperfect state neighbor entry reaches said threshold value, whether the address of then inquiring about this neighbor node in said binding information table.
Step 1064, according to the Query Result of step 1063, if the neighbor request message in said binding information table, is then sent to said neighbor node in the address of this neighbor node.
Step 1065, according to the Query Result of step 1063, if the address of this neighbor node not in said binding information table, is not then sent the neighbor request message to said neighbor node, and abandoned the IPv6 message that will transmit.
After step 107, convergence switch are received the neighbor advertisement message corresponding with said neighbor request message, the quantity of imperfect state neighbor entry in its neighbor table is subtracted 1.
After convergence switch is received the neighbor advertisement message; Inquiry neighbor table according to the destination address of the IPv6 stem of neighbor advertisement message; If look into the neighbor entry corresponding with this destination address; Then the link layer address with said neighbor entry is updated to the link layer address that carries in the neighbor advertisement message, and the state of this neighbor entry is set to reach (Reachable) state, and the quantity of imperfect state neighbor entry subtracts 1 in the neighbor table.
With reference to shown in Figure 4, Fig. 4 prevents the system block diagram that neighbours learn to attack for what the embodiment of the invention provided.
Prevent in the present embodiment that the system that neighbours learn to attack from comprising: access switch 402 and convergence switch 403.Wherein, said convergence switch 403 is the three-layer network switching equipment, connects a plurality of IPv6 network segments.
Said access switch 402 is connected with client 401, and trusted port is set, and intercepts the DHCPv6 request process of monitoring client 401 through DHCPv6, creates and the preservation binding information, and this binding information is sent to convergence switch 403.
Access switch 402 configurations receive the address of the said convergence switch 403 of binding information; And issue the rule of DHCPv6 message redirecting to this exchange processor (CPU) to exchange chip; After exchange chip is received the DHCPv6 message; Do not carry out hardware and transmit behavior, but, carry out software by processor and resolve and transmit said message redirecting to access switch 402 processors.
The detailed process of monitoring: after (1) access switch 402 is intercepted the DHCPv6 request message of intercepting and capturing client 401 through DHCPv6; Binding table according to source medium access control (MAC) address lookup access switch 402; If this Media Access Control address is in binding table; Then said DHCPv6 request message is forwarded from trusted port; Otherwise access switch 402 can be created an interim request (REQUEST) binding table earlier, is used to write down the Media Access Control address of client 401, Transaction Identifier number (Transaction-ID), port and VLAN (the Virtual Local Area Network of DHCPv6 request message; VLAN) information, and then the DHCPv6 request message forwarded from trusted port.(2) after access switch 402 is intercepted the DHCPv6 response message of intercepting and capturing client 401 through DHCPv6; Resolve Transaction Identifier number, the Internet digital distribution mechanism (Internet Assigned Numbers Authority, the IPv6 address of IANA) distributing and effective life cycle of DHCPv6 response message.Number search the query requests binding table according to Transaction Identifier; If there is the correspondent transaction identification number; Then create a binding information, be used to write down Media Access Control address, IPv6 address, rental period, virtual local area network No. and the port numbers of client 401 (being the DHCPv6 client).
The binding information that access switch 402 obtains monitoring joins DHCPv6 and intercepts in the binding message; And said binding message encrypted with hash handle; Then; Address according to the convergence switch 403 of the reception binding information of access switch 402 configuration is sent to convergence switch 403 with said binding information.
In order to guarantee fail safe and anti-tamper, can intercept DHCPv6 and bind message and encrypt with hash and handle.The data encryption standard mode of sharing key is adopted in encryption of the present invention, and hash adopts the Message Digest Algorithm 5 mode.
The DES key is by client 401 configurations, and access switch 402 must be guaranteed consistent with the key of convergence switch 403.Send DHCPv6 intercept bind message before, encrypt earlier, after carry out hash and handle, process is following:
Begin from the SwitchIPAddr field; Until the said binding message content of ending carries out des encryption; Ciphertext is isometric with expressly; Ciphertext is put into DHCPv6 and is intercepted the message zone that the SwitchIPAddr field of binding message begins, and ciphertext length places DHCPv6 to intercept the SecretLen field of binding message, gives the hash processing unit then.DHCPv6 for after the access switch 402DES encryption intercepts the binding message; When calculating the MD5 hash; The at first zero clearing of Signature field is made hash operations to whole binding message then, after hash operation is accomplished; Hashed value is inserted the Signature field, and at this moment DHCPv6 intercepts the binding message and just can send access switch 402.
Said convergence switch 403 is connected with several access switch 402, and the threshold value of the imperfect state neighbor entry of permission is set above that, and the binding information of receiving is saved in the binding information table; And when transmitting the IPv6 message; If the destination address link corresponding layer address of this message does not exist, whether the quantity that then detects imperfect state neighbor entry in the neighbor table reaches said threshold value, if do not reach; Then send the neighbor request message to neighbor node; And in said neighbor table, inserting a neighbor entry, state is set to imperfect state, and the quantity of imperfect state neighbor entry in the neighbor table is added 1; If reach, the neighbor request message in said binding information table, if do not exist, is not then sent in the address of then inquiring about this neighbor node whether, if exist, then sends the neighbor request message.
Convergence switch 403 carries out hash computations earlier after receiving DHCPv6 binding message, deciphering finally parses binding information wherein again, and detailed process is following:
When carrying out hash computations, the first value of backup Signature field, the MD5 hashed value of whole message is calculated in Signature field zero clearing more then; If hashed value is the same with the value of the Signature field of backup, then hash verification success continues that DHCPv6 is intercepted the binding message and makes the DES decryption processing.If the hash verification failure then abandons this DHCPv6 and intercepts the binding message.The successful DHCPv6 of MD5 hash verification for receiving intercepts the binding message; 403 pairs of convergence switches position after the Signature field begins; And length is carried out the DES decryption processing by the binding message content of SecretLen field appointment, restores the DHCPv6 that begins from the SwitchIPAddr field and intercepts the binding message content.
After convergence switch 403 is received the neighbor advertisement message corresponding with said neighbor request message; Inquiry neighbor table according to the destination address of the IPv6 stem of neighbor advertisement message; If look into the neighbor entry corresponding with this destination address; Then the link layer address with said neighbor entry is updated to the link layer address that carries in the neighbor advertisement message, and the state of this neighbor entry is set to reachable state, and the quantity of imperfect state neighbor entry in the neighbor table is subtracted 1.
The embodiment of the invention provides prevents the system that neighbours learn to attack, through the threshold value of the imperfect state neighbor entry that convergence switch 403 allows is set; The quantity of imperfect state neighbor entry is when surpassing threshold value in neighbor table; According to the binding information table of intercepting acquisition through DHCPv6; Judge the accessibility of neighbor node; Thereby avoided malicious data is unwrapped a large amount of neighbours of exhibition study, effectively solved the problem that the neighbours that exist in the IPv6 network learn to attack.
Above-mentioned preferred embodiment of the present invention and the institute's application technology principle of being merely, any technical staff who is familiar with the present technique field is in the technical scope that the present invention discloses, and the variation that can expect easily or replacement all should be encompassed in protection scope of the present invention.