摘要
本文在无冲突哈希算法和异或哈希算法的基础上,提出了一种双哈希的IP分类算法,该算法的核心有三点:一是基于目的/源端口和协议域构造无冲突哈希,由于该三域的组合数目非常少,避免了空间爆炸;二是在异或哈希算法的基础上,将目的/源IP连成比特串后分为四块后进行异或,为了降低冲突率,将异或后的关键值再与一个随机数进行异或,获得分类索引值,并用此值生成多比特Trie树,一般情况下减小了空间和时间复杂度;三是在Trie树终点存放最终分类规则的索引值,为了保证查找到的规则的正确性,对每一个索引值的源/目的IP地址均匹配一次。通过以上三点改进一般要降低算法的时间复杂度和空间复杂度,通过仿真,当对1万务分类规则进行包分类时,该算法的包分类速度可以达到2MPps,所消耗的最大内存为4MB。
In this paper, the authors survey the recent advances in the research of IP classification and introduce some of the typical algorithms. We describe a combination scheme that combines the advantages of both schemes. At last, a novel IP classification is proposed based on the double-hash algorithm, which is based on Non-Collision Hash Trie-Tree Algorithm and XOR hash algorithm. The core of algorithm consists of three parts: (1) structure the non-collision hash function,which is constructed mainly based on destination/source port and protocol type field so that the hash function usually can avoid space explosion problem; (2) introduce multibit Trie-tree based the key value of XOR hash in order to reduce time complexity; (3) lookup every rule index in order to ensure the validity that we get the final rule index. The test results show that the classification rate of double-hash algorithm is up to 2 million packets per second and the maximum memory consumed is 4MB for 10,000 rules.
出处
《计算机科学》
CSCD
北大核心
2004年第11期89-92,共4页
Computer Science
基金
重庆市科技攻关重点项目(合同编号:7220-13-20)
重庆邮电学院青年教师基金(合同编号:A2003-03)
重庆市自然科学基金