Abstract:Border Gateway Protocol (BGP) is a distribute d dynamic routing protocol for exchanging routing information among autonomous s ystems. In this paper, the implementation of distributed routing protocol BGP-4 in high performance router developed by Tsinghua University is presented. A met hod based on event-driven programming is presented to implement the complicated protocol. Event-driven programming can reflect the real situation of networks, so it is suitable for the network programming. This method can also be used to implement other higher layer protocols of Internet.