Summary of the invention
For above-mentioned technical problem, the object of the present invention is to provide a kind of method and system preventing neighbor learning attack, it effectively solves the problem of the neighbor learning attack existed in IPv6 network.
For achieving the above object, the present invention is achieved through the following technical solutions:
Prevent a method for neighbor learning attack, described method comprises the steps:
A, the threshold value of imperfect state neighbor entry that convergence switch allows is set;
B, access switch intercept the DHCPv6 request process monitoring client by DHCPv6, create and preserve binding information, and this binding information is sent to described convergence switch;
C, convergence switch receive binding information, and are saved in binding information table;
D, convergence switch are when forwarding IPv6 message, if the link layer address that the destination address of this message is corresponding does not exist, whether the quantity then detecting imperfect state neighbor entry in neighbor table reaches described threshold value, if do not reached, then sends neighbor request message to neighbor node; If reached, then inquire about the address of this neighbor node whether in described binding information table, if exist, then send neighbor request message, if do not exist, then do not send neighbor request message;
After E, convergence switch receive the neighbor advertisement message corresponding with described neighbor request message, the quantity of state neighbor entry imperfect in its neighbor table is subtracted 1.
Especially, described step B also comprises:
Access switch issues the rule of DHCPv6 message redirecting to this exchange processor to exchange chip, after exchange chip receives DHCPv6 message, do not perform hardware and forward behavior, but by described message redirecting to access switch processor, carry out software parses and forwarding by processor.
Especially, described step B comprises further:
Described binding information is joined DHCPv6 and intercepts in binding message by access switch, and described binding message is encrypted and hashing, then, according to the address of the convergence switch of the reception binding information of access switch configuration, described binding message is sent to convergence switch.
Especially, institute step C specifically comprises:
Convergence switch parses DHCPv6 and intercepts the binding information bound in message, and is saved in by this binding information in local binding information table, and wherein, described binding message refers to the binding message that all access switch be connected with described convergence switch import into.
Especially, in described step D, if the quantity of imperfect state neighbor entry does not reach threshold value in neighbor table, then send neighbor request message to neighbor node, and a neighbor entry is inserted in described neighbor table, state is set to imperfect state, and the quantity of state neighbor entry imperfect in neighbor table is added 1.
Especially, described step e specifically also comprises:
Convergence switch is according to the destination address inquiry neighbor table of the IPv6 stem of neighbor advertisement message, if find the neighbor entry corresponding with this destination address, then the link layer address of described neighbor entry is updated to the link layer address carried in neighbor advertisement message, and the state of this neighbor entry is set to reachable state, the quantity of state neighbor entry imperfect in neighbor table is subtracted 1.
The invention also discloses a kind of system preventing neighbor learning attack, described system comprises:
Access switch, with client's side link, intercepts the DHCPv6 request process monitoring client by DHCPv6, create and preserve binding information, and this binding information is sent to convergence switch;
Convergence switch, is connected with access switch, arranges the threshold value of the imperfect state neighbor entry of permission thereon, is saved to by the binding information received in binding information table; And when forwarding IPv6 message, if the link layer address that the destination address of this message is corresponding does not exist, whether the quantity then detecting imperfect state neighbor entry in neighbor table reaches described threshold value, if do not reached, then send neighbor request message to neighbor node, and a neighbor entry is inserted in described neighbor table, state is set to imperfect state, and the quantity of state neighbor entry imperfect in neighbor table is added 1; If reached, then the address inquiring about this neighbor node, whether in described binding information table, if do not exist, does not then send neighbor request message, if exist, then sends neighbor request message.
Especially, described access switch concrete also for
The rule of DHCPv6 message redirecting to this exchange processor is issued to exchange chip, after exchange chip receives DHCPv6 message, do not perform hardware and forward behavior, but by described message redirecting to access switch processor, carry out software parses and forwarding by processor; Described binding information being joined DHCPv6 intercepts in binding message, and described binding message is encrypted and hashing, then, according to the address of the convergence switch of the reception binding information of access switch configuration, described binding message is sent to convergence switch.
Especially, described convergence switch also for
Parse DHCPv6 and intercept the binding information bound in message, and be saved in by this binding information in local binding information table, wherein, described binding message refers to the binding message that all access switch be connected with described convergence switch import into.
Especially, described convergence switch concrete also for
Destination address according to the IPv6 stem of the neighbor advertisement message corresponding with neighbor request message received inquires about neighbor table, if find the neighbor entry corresponding with this destination address, then the link layer address of described neighbor entry is updated to the link layer address carried in neighbor advertisement message, and the state of this neighbor entry is set to reachable state, the quantity of state neighbor entry imperfect in neighbor table is subtracted 1.
Beneficial effect of the present invention is, described a kind of method and system preventing neighbor learning attack, by arranging the threshold value of the imperfect state neighbor entry that convergence switch allows; When in neighbor table, the quantity of imperfect state neighbor entry is above threshold value, according to the binding information table of being intercepted acquisition by DHCPv6, judge the accessibility of neighbor node, thus avoid to malicious data unwrap exhibition a large amount of neighbor learning, effectively solve the problem of the neighbor learning attack existed in IPv6 network.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly, below in conjunction with drawings and Examples, the invention will be further described.
Please refer to shown in Fig. 1, the method flow diagram preventing neighbor learning attack that Fig. 1 provides for the embodiment of the present invention.
Prevent the method for neighbor learning attack from comprising the steps: in the present embodiment
Step 101, the threshold value of imperfect (Incomplete) state neighbor entry that convergence switch allows is set.The enable IPv6 version based on DHCP (Dynamic HostConfiguration Protocol for IPv6 on convergence switch, DHCPv6) intercept the function preventing neighbor learning attack of (SNOOPING), and the threshold value of the imperfect state neighbor entry that this convergence switch allows is set.
Step 102, on access switch, enable DHCPv6 intercepts, and arranges trusted port, and configuration receives the address of the described convergence switch of binding information.
After the enable DHCPv6 of access switch intercepts, the rule of DHCPv6 message redirecting to this exchange processor (CPU) is issued to exchange chip, after exchange chip receives DHCPv6 message, do not perform hardware and forward behavior, but by described message redirecting to access switch processor, carry out software parses and forwarding by processor.
Step 103, access switch intercept the DHCPv6 request process monitoring client by DHCPv6.
Concrete snoop procedure is as follows:
(1) after access switch intercepts the DHCPv6 request message intercepting and capturing client by DHCPv6, according to the binding table of source medium access control (MAC) address lookup access switch, if this Media Access Control address is in binding table, then described DHCPv6 request message is forwarded from trusted port, otherwise, access switch first can create interim request (REQUEST) binding table, for recording the Media Access Control address of client, the Transaction Identifier number (Transaction-ID) of DHCPv6 request message, port and VLAN (Virtual Local Area Network, VLAN) information, and then DHCPv6 request message is forwarded from trusted port.
(2) after access switch intercepts the DHCPv6 response message intercepting and capturing client by DHCPv6, resolve the Transaction Identifier number of DHCPv6 response message, IPv6 address that the Internet digital distribution mechanism (Internet AssignedNumbers Authority, IANA) distributes and effective life cycle.Inquiry request binding table is searched according to Transaction Identifier number, if there is corresponding Transaction Identifier number, then create a binding information, for recording the Media Access Control address of client (i.e. DHCPv6 client), IPv6 address, rental period, virtual local area network No. and port numbers.
Step 104, access switch will create and the binding information preserved joins DHCPv6 intercepts (SNOOPING) and bind in message, and described binding message is encrypted and hashing, then, according to the address of the convergence switch of the reception binding information of access switch configuration, described binding message is sent to convergence switch.
DHCPv6 between access switch and convergence switch intercepts binding message and uses User Datagram Protocol (User Datagram Protocol, UDP) to be connected to after on network, propagates.In order to ensure fail safe and anti-tamper, binding message can be intercepted to DHCPv6 and being encrypted and hashing.Encryption of the present invention adopts data encryption standard (the Data Encryption Standard of shared key, DES) mode, hash adopts Message Digest Algorithm 5 (Message Digest Algorithm MD5 is called for short MD5) mode.
As shown in Figure 2, Fig. 2 intercepts binding message format schematic diagram for DHCPv6 that the embodiment of the present invention provides.
DHCPv6 intercepts binding message and is carried in User Datagram Protocol, and the implication of each field of this message is as follows:
Version: version number is 1 at present;
Type: type is 1 at present, represents and comprises binding information;
SeqNo: sequence number, often sends a message, adds 1;
SecretLen: the length of encrypted message;
Signature:DHCPv6 intercepts the MD5 hashed result of all fields in binding 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: binding quantity;
ClientMAC: the Media Access Control address renting the client of address, wherein 6octets represents 6 hytes;
Reserved: retain, insert 0;
ClientVlanId: the VLAN ID number of the switch of client access;
PortNum: the switch ports themselves number at client place;
ClientIP: the IPv6 address of client, wherein 16octets represents 16 hytes;
Effective life cycle of the address that ClientValidLifetime:DHCPv6 distributes;
BindingTimeStamp: the timestamp of allocation address.
DES key is by client configuration, and access switch must be guaranteed consistent with the key of convergence switch.Send DHCPv6 intercept binding message before, be first encrypted, after carry out hashing, process is as follows:
From SwitchIPAddr field, until the described binding message content of ending carries out des encryption, ciphertext is with expressly isometric, ciphertext puts into the message region that starts of SwitchIPAddr field that DHCPv6 intercepts binding message, ciphertext length is placed in the SecretLen field that DHCPv6 intercepts binding message, then gives hashing unit.Binding message is intercepted for the DHCPv6 after access switch des encryption, when calculating MD5 hash, first Signature field resets, then hash operations is done to whole binding message, after Hash operation completes, hashed value is inserted Signature field, at this moment DHCPv6 intercepts binding message and just can send access switch.
Step 105, convergence switch parse DHCPv6 and intercept the binding information bound in message, and are saved in by this binding information in local binding information table.
Convergence switch is after receiving DHCPv6 binding message, and first carry out hash calculating, then decipher, last solution separates out binding information wherein, and detailed process is as follows:
When carrying out hash and calculating, first back up the value of Signature field, then Signature field resets, and then calculates the MD5 hashed value of whole message; If hashed value is the same with the value of the Signature field of backup, then Hash verification success, continues to intercept binding message to DHCPv6 and makes DES decryption processing.If Hash verification failure, then abandon this DHCPv6 and intercept binding message.Binding message is intercepted for the successful DHCPv6 of MD5 Hash verification received, convergence switch is to from position after Signature field, and the binding message content that length is specified by SecretLen field carries out DES decryption processing, restore the DHCPv6 started from SwitchIPAddr field and intercept binding message content.
Step 106, convergence switch, when forwarding destination address is the IPv6 message of this network segment, if the link layer address that the destination address of this message is corresponding (Link-Layer Address) does not exist, with reference to shown in Fig. 3, are handled as follows:
In step 1061, detection neighbor table, whether the quantity of imperfect state neighbor entry reaches described threshold value.
Step 1062, testing result according to step 1061, if the quantity of imperfect state neighbor entry does not reach described threshold value, then send neighbor request message to neighbor node, and a neighbor entry is inserted in described neighbor table, state is set to imperfect state, and the quantity of state neighbor entry imperfect in neighbor table is added 1.
Step 1063, testing result according to step 1061, if the quantity of imperfect state neighbor entry reaches described threshold value, then inquire about the address of this neighbor node whether in described binding information table.
Step 1064, Query Result according to step 1063, if the address of this neighbor node is in described binding information table, then send neighbor request message to described neighbor node.
Step 1065, Query Result according to step 1063, if the address of this neighbor node is not in described binding information table, then do not send neighbor request message to described neighbor node, and abandon the IPv6 message that will forward.
After step 107, convergence switch receive the neighbor advertisement message corresponding with described neighbor request message, the quantity of state neighbor entry imperfect in its neighbor table is subtracted 1.
After convergence switch receives neighbor advertisement message, according to the destination address inquiry neighbor table of the IPv6 stem of neighbor advertisement message, if find the neighbor entry corresponding with this destination address, then the link layer address of described neighbor entry is updated to the link layer address carried in neighbor advertisement message, and the state of this neighbor entry is set to can reach (Reachable) state, in neighbor table, the quantity of imperfect state neighbor entry subtracts 1.
With reference to shown in Fig. 4, the system block diagram preventing neighbor learning attack that Fig. 4 provides for the embodiment of the present invention.
Prevent the system of neighbor learning attack from comprising in the present embodiment: access switch 402 and convergence switch 403.Wherein, described convergence switch 403 is three-layer network switching equipment, connects multiple IPv6 network segment.
Described access switch 402, is connected with client 401, arranges trusted port, and is intercepted the DHCPv6 request process monitoring client 401 by DHCPv6, creates and preserves binding information, this binding information is sent to convergence switch 403.
Access switch 402 configures the address of the described convergence switch 403 receiving binding information, and issue the rule of DHCPv6 message redirecting to this exchange processor (CPU) to exchange chip, after exchange chip receives DHCPv6 message, do not perform hardware and forward behavior, but by described message redirecting to access switch 402 processor, carry out software parses and forwarding by processor.
The detailed process monitored: (1) access switch 402 intercepts the DHCPv6 request message intercepting and capturing client 401 by DHCPv6 after, according to the binding table of source medium access control (MAC) address lookup access switch 402, if this Media Access Control address is in binding table, then described DHCPv6 request message is forwarded from trusted port, otherwise, access switch 402 first can create interim request (REQUEST) binding table, for recording the Media Access Control address of client 401, the Transaction Identifier number (Transaction-ID) of DHCPv6 request message, port and VLAN (Virtual Local Area Network, VLAN) information, and then DHCPv6 request message is forwarded from trusted port.(2) after access switch 402 intercepts the DHCPv6 response message intercepting and capturing client 401 by DHCPv6, resolve the Transaction Identifier number of DHCPv6 response message, IPv6 address that the Internet digital distribution mechanism (Internet Assigned Numbers Authority, IANA) distributes and effective life cycle.Inquiry request binding table is searched according to Transaction Identifier number, if there is corresponding Transaction Identifier number, then create a binding information, for recording the Media Access Control address of client 401 (i.e. DHCPv6 client), IPv6 address, rental period, virtual local area network No. and port numbers.
Audible for prison binding information is joined DHCPv6 and intercepts in binding message by access switch 402, and described binding message is encrypted and hashing, then, according to the address of the convergence switch 403 of the reception binding information of access switch 402 configuration, described binding information is sent to convergence switch 403.
In order to ensure fail safe and anti-tamper, binding message can be intercepted to DHCPv6 and being encrypted and hashing.Encryption of the present invention adopts the data encryption standard mode of shared key, and hash adopts Message Digest Algorithm 5 mode.
DES key is configured by client 401, and access switch 402 must be guaranteed consistent with the key of convergence switch 403.Send DHCPv6 intercept binding message before, be first encrypted, after carry out hashing, process is as follows:
From SwitchIPAddr field, until the described binding message content of ending carries out des encryption, ciphertext is with expressly isometric, ciphertext puts into the message region that starts of SwitchIPAddr field that DHCPv6 intercepts binding message, ciphertext length is placed in the SecretLen field that DHCPv6 intercepts binding message, then gives hashing unit.Binding message is intercepted for the DHCPv6 after access switch 402DES encrypts, when calculating MD5 hash, first Signature field resets, then hash operations is done to whole binding message, after Hash operation completes, hashed value is inserted Signature field, at this moment DHCPv6 intercepts binding message and just can send access switch 402.
Described convergence switch 403, is connected with several access switch 402, arranges the threshold value of the imperfect state neighbor entry of permission thereon, is saved to by the binding information received in binding information table; And when forwarding IPv6 message, if the link layer address that the destination address of this message is corresponding does not exist, whether the quantity then detecting imperfect state neighbor entry in neighbor table reaches described threshold value, if do not reached, then send neighbor request message to neighbor node, and a neighbor entry is inserted in described neighbor table, state is set to imperfect state, and the quantity of state neighbor entry imperfect in neighbor table is added 1; If reached, then the address inquiring about this neighbor node, whether in described binding information table, if do not exist, does not then send neighbor request message, if exist, then sends neighbor request message.
Convergence switch 403 is after receiving DHCPv6 binding message, and first carry out hash calculating, then decipher, last solution separates out binding information wherein, and detailed process is as follows:
When carrying out hash and calculating, first back up the value of Signature field, then Signature field resets, and then calculates the MD5 hashed value of whole message; If hashed value is the same with the value of the Signature field of backup, then Hash verification success, continues to intercept binding message to DHCPv6 and makes DES decryption processing.If Hash verification failure, then abandon this DHCPv6 and intercept binding message.Binding message is intercepted for the successful DHCPv6 of MD5 Hash verification received, convergence switch 403 is to from position after Signature field, and the binding message content that length is specified by SecretLen field carries out DES decryption processing, restore the DHCPv6 started from SwitchIPAddr field and intercept binding message content.
After convergence switch 403 receives the neighbor advertisement message corresponding with described neighbor request message, according to the destination address inquiry neighbor table of the IPv6 stem of neighbor advertisement message, if find the neighbor entry corresponding with this destination address, then the link layer address of described neighbor entry is updated to the link layer address carried in neighbor advertisement message, and the state of this neighbor entry is set to reachable state, the quantity of state neighbor entry imperfect in neighbor table is subtracted 1.
The system of what the embodiment of the present invention provided prevent neighbor learning attack, by arranging the threshold value of the imperfect state neighbor entry that convergence switch 403 allows; When in neighbor table, the quantity of imperfect state neighbor entry is above threshold value, according to the binding information table of being intercepted acquisition by DHCPv6, judge the accessibility of neighbor node, thus avoid to malicious data unwrap exhibition a large amount of neighbor learning, effectively solve the problem of the neighbor learning attack existed in IPv6 network.
Above are only preferred embodiment of the present invention and institute's application technology principle, be anyly familiar with those skilled in the art in the technical scope that the present invention discloses, the change that can expect easily or replacement, all should be encompassed in protection scope of the present invention.