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
Local eBGP peering
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 1. Table B is AS 2, etc.
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 1 // 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 my-peer 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 my-peer seq 5 permit 133.27.162.112/29
Router(config)#ip prefix-list my-peer seq 50 deny 0.0.0.0/0 le 32
Notice that you will have to confirm with your neighbor as to what routes they are planning
to send you. In the case above, the neighbor is sending 133.27.162.112/29. 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.
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
Dual-homed/OSPF IGP/iBGP/Local eBGP peering
- That you can reach both the PC and the router of your neighbor table.
- Configure iBGP with the router in your AS
- Configure eBGP according to the diagram (via serial links!)
Router(config-router)#neighbor 133.27.162.112 update-source loopback0
BGP Exercise 3 – Connecting to an ISP
In this exercise, we will simulate being an ISP. Each group will have to get their own AS number from the registries (the instructors) and will have to get ISP addresses from their upstream provider. We will use the topology in the diagram to prefer certain paths.
ISP 4 is our upstream ISP. All of the ISPs within the classroom directly or indirectly buy connectivity from ISP 4. ISP 4 will need to get an IP address block and an AS from the registry. ISP 1, ISP 2 and ISP 3 will need to get an AS number from the registry.
- Make sure to set up iBGP within your AS.
A, B, C and D should speak iBGP within ISP 1.
E and G should speak iBGP within ISP 2
F and H should speak iBGP within ISP 3
I and J should speak iBGP within ISP 4
- use prefix lists and/or as-path filters as appropriate J
- ISP 4 should announce all of its routes to its downstreams ISP 2 and ISP 3.
9. What routes do you see in your routing table? What do the ASpaths look like? Which routes are preferred?
Look at the routing table of other ASes to understand how traffic flows in the network.
Do you see both an aggregate and a specific that covers ISP 1?
Do you understand how this works?
ISP 1: Do you see multiple paths for any destinations? Which ones?
ISP 2: What path do you use to get to Table F’s PC network? What routes are you sending to ISP 1? To ISP 4? To ISP 3?
ISP 3: What path do you use to get to Table E’s PC network? What are you sending to ISP 1? To ISP 4? To ISP 2?
ISP 4: What routes do you see from the ISPs in the classroom? What routes are you sending to your downstream ISPs?
10. Break the connection between ISP 1 and ISP 2 and see what happens! How do the
routing tables change?
BGP Exercise 4 - Changing BGP Policy
In this exercise, we will modify the previous exercise to put advanced policy in our network.
Try to implement the following policies using route-maps on your peering sessions.
Make sure that you accept and send communities from your peers!
neighbor 207.98.66.11 send-community - Send communities to peers
6. On your map of the network, label how you think the routing information flows.
7. Discuss how this compares to real-world scenarios. How is this the same as the real world? How is this different?