Inspired by the biological immune system against outside invasion in nature, this paper propose a network security strategy using Agent technology. The Agents with independent behavior capacity are set for resisting network intrusion using their spontaneous coordinate organization. Based on the comparisons of existing immunization strategies, such as target immune, acquaintance immune and random immunity, it is found that the importance of nodes in network are influenced by interaction between nodes, degree of nodes, information flow, and other factors. If the nodes are more important, they have a greater influence over the whole network. When important nodes are infected by virus, there will be a higher probability of spreading of hazard information. Therefore, this paper proposes a network security model using Agent technology, where important nodes are implanted with relationship immunization strategy. Experimental results show when the network suffered from random or malicious attacks, relationship immunization strategy is more effective than others existing methods.