Sometimes I find the information on the Internet that is so far from the facts that it might actually hurt someone. For example, the configuration in this post supposedly prevents you from becoming a transit AS (which is a really bad idea if you're a multi-homed end-user). Actually, it achieves the goal as it drops all incoming routes due to a malformed AS-path access-list that denies everything :) … but then, why do you need BGP in the first place?
Fortunately, someone provided correct configuration in the comments to the post, just made in unnecessarily complex with the introduction of a route-map.
It really pays off to study all the available BGP filtering mechanisms: AS-path access-list can be applied to updates directly with the neighbor filter-list command. The minimum configuration that guarantees you won't become a transit AS is thus as follows:
router bgp 65000
neighbor 10.1.1.1 filter-list 1 out
ip as-path access-list 1 permit ^$
Of course you can make things really interesting by introducing BGP communities: if you mark all routes received from the EBGP peers with the NO_EXPORT community, they will be filtered out on other EBGP sessions automatically :) Here's a sample configuration:
router bgp 65001
neighbor 10.0.1.2 route-map setNoExport in
neighbor 10.0.1.3 route-map setNoExport in
route-map setNoExport permit 10
set community no-export additive
If you're looking for more in-depth BGP knowledge, try our Configuring BGP on Cisco Routers e-learning solution. If you just need to enhance your hands-on skill, the BGP Remote Lab Bundle is the perfect choice.