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

 

  1. Remove OSPF from your router and do shutdown on your serial links. We will only be using the Ethernet links for this exercise.
  2.  

  3. Confirm that you are not longer receiving OSPF routes by doing a show ip route
  4. 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.

     

  5. Figure out your AS number.
  6. AS:

     

  7. Verify your IP address for your PC link. This is the network that we will announce to our BGP peers.
  8.  

    PC interface Ip address: Mask:

     

     

  9. We will set up peering sessions according the map. Decide which IP addresses you are going to use for your Point-to-Point Ethernet links with your neighbor peer.
  10.  

  11. Configure BGP on your router to announce your network.
  12.  

    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

     

  13. Set up a peering session with your neighbor
  14. 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

     

  15. Define the prefix-lists that you will need. This specifies which routes you will send out and which routes you will accept.
  16. 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.

  17. Check to see if the peering session is up:
  18. 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

     

     

  19. Check to see if you are sending routes to your neighbor? Why or why not?
  20. Router#sh ip bgp neighbor x.x.x.x advertised-routes

     

  21. Check to see if you are receiving routes from your neighbor.

 

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

  1. Connect Ethernet links to the table next to you (A connects to B, C connects to D, etc.) You can consult the map for more details on this.
  2. We will now combine adjacent classroom tables into the same AS. A and B become AS 1. C and D become AS 3, etc.
  3.  

  4. Remove the eBGP session you have between your table and your neighbor.
  5. Run OSPF between the two tables. You should verify:

- That you can reach both the PC and the router of your neighbor table.

  1. Now you should configure your eBGP and iBGP peering sessions.

- 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

  1. Determine what routes your neighbors will be sending you.
  2.  

  3. Add route maps to filter your peers. Inbound and Outbound. Only accept the routes that your neighbor is supposed to originate. Only send the routes that your AS is supposed to originate.
  4.  

  5. Can you reach everything in your neighboring AS?

 

 

 

 

 

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.

    1. ISP 4 should allocate IP blocks for ISP 2 and ISP 3. ISP 2 and ISP 3 should get IP address blocks from ISP 4. ISP 1 should get IP addresses from ISP 3.
    2.  

    3. Then, we need to design the topology of the classroom to match that of the map. Use the addresses that youve been allocated from your upstream AS.
    4.  

    5. Make sure that you have connectivity within your AS. You should set-up OSPF so that you have connectivity between the routers and PCs in your ISP.
    6. Verify that you can see routes for all networks in your ISP by using show IP route. Test connectivity using ping and traceroute.
    7. ISP 4 should add some routes to its routing table (because they are the big Upstream provider) including a default. (example, add routes to null 0 and redistribute static or add routes to null and use network statements)
    8. We now need to set up BGP sessions to establish communication between the ASes.

 

- 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.

 

 

    1. Review your filters. Make sure that you are seeing the right information from everyone.
    2.  

       

      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 Fs 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 Es 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?

       

       

       

    3. Verify that you can get to all the PCs in the classroom!

 

 

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.

    1. ISP 1 should prepend its ASpath to ISP 3 so that ISP 3 does not send traffic over the ISP 1-ISP 3 link.
    2. ISP 1 should set local preference on the routes learned from ISP 2 and ISP 3. This is done via a route-map applied on each of the peering sessions "inbound." ISP 1 should prefer the ISP 2 link (set local-preference to 200). ISP 1 should set the routes learned from ISP 3 to a local preference of 90.
    3. ISP 2 should use communities to tag the routes that it learns from ISP 4 and ISP 3. This is done via a route-map applied on each of the peering sessions "inbound". Routes learned from ISP 4 should be tagged with the community <2s AS number>:4. Routes learned from ISP 3 should be tagged with the community <2s AS number>:3. ISP 2 should then use route-maps to announce to ISP 1 only those routes with the community <2s AS number>:4.
    4. Make sure that you accept and send communities from your peers!

      neighbor 207.98.66.11 send-community - Send communities to peers

    5. ISP 3 should use communities to tag the routes that it learns from ISP 4 and ISP 2. This is done via a route-map applied on each of the peering sessions "inbound". Routes learned from ISP 4 should be tagged with the community <3s AS number>:4. Routes learned from ISP 2 should be tagged with the community <3s AS number>:2. ISP 3 should then use route-maps to announce to ISP 2 only those routes with the community <3s AS number>:4.
    6. ISP 4 should use route-maps to tag the all of its routes on its peering sessions "outbound" with a community depending on the prefix. Depending on the prefix, you should set the community. For some prefixes, send a community of 4:11111, for others, send a community of 4:22222.

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?