One of the methods that can be used to prevent these types of attack is the use of routing protocol authentication.
However, using dial-up or leased lines to provide network access is expensive when compared to the cost of providing network access using a VPN connection.
You prefer that the most efficient use of bandwidth be made so that packets will travel to their destination over the truly shortest path, rather than just the path with the lowest number of hops.
You have heard that routing loops can be a problem and wish to avoid them.
There are two general ways that authentication is implemented by most routing protocols: using a routing protocol centric solution that configures the passwords or keys to use within the routing protocol configuration, or by using a broader solution that utilizes separately configured keys that are able to be used by multiple routing protocols.
Both OSPF and BGP use the prior of these methods and configure the specific authentication type and passwords/keys within their specific respective configurations.