Motivated by the high cost problem of ternary CAM, we proposed a new technique for providing a compaction routing table. With the comparisons with existing algorithms, our new technique can improve the use of ternary-CAM space under reasonable compressing time, performs well without consider the size of routing table size. And our scheme outperforms other existing schemes in terms of the use of the ternary-CAM space and the processing time.