BGP Exercises
Anatomy of a BGP Configuration
ip bgp-community new-format
!
router bgp 3582 - Initial BGP config statement with ASN
no synchronization - Do not synchronize with the IGP
no auto-summary - no classfull boundaries
bgp dampening - dampen route flaps
network 128.223.0.0 - network to announce into BGP
neighbor 207.98.66.11 send-community - Send communities to peers
neighbor 207.98.66.11 version 4 - BGP version 4 negotiation
neighbor 207.98.66.11 soft-reconfiguration inbound - Store updates & allow reads. Without reset
neighbor 207.98.66.11 prefix-list sanity-filter in - filter all incoming prefixes against this prefix-list
neighbor 207.98.66.11 prefix-list my-routes out neighbor 207.98.66.11 prefix-list my-routes out - filter all outgoing prefixes against this prefix-list
neighbor 207.98.66.11 remote-as 3701 - neighbor peering session
neighbor 207.98.66.11 description NERO Transit (noc@nero.net) - neighbor description
neighbor 207.98.66.11 update-source POS 6/0/0 - peering session connection source
neighbor 198.108.0.1 remote-as 3582 - set up an ibgp peering session
neighbor 198.108.0.1 version 4 - BGP version 4
neighbor 198.108.0.1 description IBGP-peer - neighbor description
neighbor 198.108.0.1 update-source loopback - peering session connection source
!
ip prefix-list my-routes seq 5 permit 128.223.0.0/16 - prefix-list filtering all outgoing advertised
ip prefix-list my-routes seq 50 deny 0.0.0.0/0 le 32 prefixes.
!
ip prefix-list pond seq 5 permit 205.240.25.0/24 - prefix-list filtering all incoming advertised
ip prefix-list pond seq 10 permit 199.217.92.0/22 prefixes from peer.
ip prefix-list pond seq 15 permit 206.40.128.0/22
ip prefix-list pond seq 50 deny 0.0.0.0/0 le 32
!
ip prefix-list sanity-filter description "Deny default, RFC1918, net 10" - no bogons
ip prefix-list sanity-filter seq 10 deny 127.0.0.0/8 le 32
ip prefix-list sanity-filter seq 15 deny 10.0.0.0/8 le 32
ip prefix-list sanity-filter seq 20 deny 172.16.0.0/12 le 32
ip prefix-list sanity-filter seq 25 deny 192.168.0.0/16 le 32
ip prefix-list sanity-filter seq 30 deny 192.0.2.0/24 le 32
ip prefix-list sanity-filter seq 50 permit 0.0.0.0/0 le 32
!
BGP Lab Exercise 1 - eBGP link to upstream provider.
We will now set up eBGP between all of the routers in the classroom. Each table will be its own AS. For example, Table A is AS 100. Table B is AS 200, etc. Instructors operate AS 1 and AS 2.
AS:
PC interface – Ip address: Mask:
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)# ip bgp-community new-format
Router(config)#router bgp 100 // use your AS number
Router(config-router)#network 133.27.162.30 mask 255.255.255.248
// use your network and mask
Router(config-router)#no synchronization // you should have these commands as part // of your default BGP configuration
Router(config-router)#no auto-summary
Router(config-router)#bgp dampening
BGP is now configured on your router
Router(config)#router bgp 1 //use your AS number
Router(config-router)#neighbor 133.27.162.112 remote-as 2
// use the IP address and AS number of your neighbor
Router(config-router)#neighbor 133.27.162.112 description My-Peer-with-AS2
Router(config-router)#neighbor 133.27.162.112 prefix-list my-routes out
Router(config-router)#neighbor 133.27.162.112 prefix-list sanity-filter in
Router(config)#ip prefix-list my-routes seq 5 permit 133.27.162.30/29
Router(config)#ip prefix-list my-routes seq 50 deny 0.0.0.0/0 le 32
Router(config)#
Router(config)#ip prefix-list sanity-filter seq 10 deny 127.0.0.0/8 le 32
Router(config)#ip prefix-list sanity-filter seq 15 deny 10.0.0.0/8 le 32
Router(config)#ip prefix-list sanity-filter seq 20 deny 172.16.0.0/12 le 32
Router(config)#ip prefix-list sanity-filter seq 25 deny 192.168.0.0/16 le 32
Router(config)#ip prefix-list sanity-filter seq 30 deny 192.0.2.0/24 le 32
Router(config)#ip prefix-list sanity-filter seq 50 permit 0.0.0.0/0 le 32
Double check that you set your "my-routes" outbound filter to contain the network you wish to announce. The entries with sequence number 50 are used to deny all other routes.
In this exercise, you trust your provider enough that you can use a simple sanity filter that denies a few things and then permits everything else.
Router#show ip bgp sum
BGP router identifier 133.27.167.252, local AS number 1
BGP table version is 3, main routing table version 3
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
133.27.162.112 4 2 0 0 0 0 0 never Idle
Router#sh ip bgp neighbor x.x.x.x advertised-routes
Router#show ip bgp
What routes are you receiving?
Other commands to monitor BGP:
Router#sh ip route
Router#sh ip bgp
Router#sh ip bgp neighbor
Router#sh ip bgp neighbor x.x.x.x received-routes [*]
[*] Only works if "soft-reconfiguration inbound" has been configured for this peer
BGP Exercise 2 –
Add links to a local BGP peer
Router(config)#ip prefix-list as1200-routes seq 10 permit 80.248.72.64/28
Router(config)#ip prefix-list as1200-routes seq 50 deny 0.0.0.0/0 le 32
BGP Exercise 3 -
Dual-homed/OSPF IGP/iBGP/Local eBGP peering- Configure iBGP with the router in your AS
Router(config-router)#neighbor 133.27.162.112 update-source loopback0
BGP Testing