262To do… Use the command… RemarksSubstitute local ASnumber for the ASnumber of a peer orpeer group in theAS_PATH attributepeer { group-name | ip-address} substitute-asOptionalThe substitution isnot configured bydefault.Configure BGP to notkeep private AS numbersin the AS_PATH attributeof updates to a peer orpeer grouppeer { group-name | ip-address} public-as-onlyOptionalBy default, BGPupdates carryprivate AS numbers.• Using a routing policy can set preferences for routes matching it. Routes not matching it use the defaultpreferences.• If other conditions are identical, the route with the smallest MED value is selected as the best externalroute.• Using the peer next-hop-local command can specify the router as the next hop for routes sent to apeer or peer group. If BGP load balancing is configured, the router can specify itself as the next hop forroutes sent to a peer or peer group regardless of whether the peer next-hop-local command isconfigured.• In a “third-party next hop" network, that is, a BGP router has two eBGP peers in a common broadcastsubnet, the BGP router does not specify itself as the next hop for routes sent to such an eBGP peer,unless the peer next-hop-local command is configured.• In general, BGP checks whether the AS_PATH attribute of a route from a peer contains the local ASnumber. If so, it discards the route to avoid routing loops.• You can specify a fake AS number to hide the real one as needed. The fake AS number applies toroutes sent to eBGP peers only, that is, eBGP peers in other ASs can only find the fake AS number.• The peer substitute-as command is used only in specific networking environments. Inappropriate useof the command may cause routing loops.Tuning and optimizing BGP networksPrerequisitesBGP connections are created.Configuring BGP keepalive interval and holdtimeAfter establishing a BGP connection, two routers send keepalive messages periodically to eachother to keep the connection. If a router receives no keepalive or update message from the peerwithin the holdtime, it tears down the connection.