The interdomain Border Gateway Protocol determines paths between autonomous systems on the Internet.
WARNING: to be sure changes to the BGP configuration are put into effect be sure to read the section "Propagating BGP policy changes" at the bottom of this page for an explanation of the "clear ip bgp *" command.
Router2> enable
Password: <enable secret>
Router2# configure terminal
Router2(config)# no ip routing
Router2(config)# ip routing
Router2(config)# interface FastEthernet0/0
Router2(config-if)# no shutdown
Router2(config-if)# ip address 10.0.2.2 255.255.255.0
Router2(config-if)# interface FastEthernet0/1
Router2(config-if)# ip address 10.0.1.2 255.255.255.240
Router2(config-if)# router bgp 200
Router2(config-router)# neighbor 10.0.1.1 remote-as 100
Router2(config-router)# neighbor 10.0.4.3 renote-as 300
Router2(config-router)# network 10.0.2.0 mask 255.255.255.0
Router2(config-router)# end
Router2# clear ip bgp *
Route Maps are the primary method used to implement BGP filters.
route-map MAP-TAG [permit | deny] [sequence-number]
match [ip address #|as-path # | community NAME| prefix-list NAME]
set [community aa:nn | ip NEXT-HOP| local-preference # | as-path prepend AS-LIST]
router bgp 300
neighbor IP-ADDRESS route-map MAP-NAME [in | out]
ip access-list 1 permit IP
route-map MAP-NAME permit 10
match ip address 1
ip as-path access-list 2 permit ^[AS#]_
match as-path 2
ip prefix-list PEER seq 5 permit 192.0.2.0/24
match prefix-list PEER
set community aa:nn
ip community-list standard COMMUNITY-NAME aa:nn
match community COMMUNITY-NAME
set local-preference 200
route-map R2-PROVIDER-IN permit 10
set local-pref 70
route-map R2-PEER-IN permit 10
set local-pref 80
router bgp 200
neighbor 10.6.0.2 route-map R2-PROVIDER-IN in
neighbor 10.5.0.1 route-map R2-PEER-IN in
clear bgp *
route-map R4-PEER-OUT permit 10
set as-path prepend 400 400
router bgp 400
neighbor 10.8.0.2 route-map R4-PEER-OUT out
clear ip bgp * soft
clear ip bgp *
Cisco BGP documentation (PDF)
PacketLife Cheat Sheets: BGP