BGP-4 Case Studies Nenad Krajnovic e-mail: krajko@etf.bg.ac.yu
Today topics load balancing over multiple links multihoming to a single provider multihoming to different providers following defaults inside an AS policy routing lab examples 2
Load balancing over multiple links Increasing traffic toward Internet is requesting more and more bandwidth. Increasing of bandwidth can be made by aggregating two or more links and load balancing over them. 3
load balancing over multiple links Loopback Interface 0 172.16.50.1 192.168.4.0/24 1.1.1.1 1.1.1.2 1.1.2.1 1.1.2.2 Loopback Interface 0 172.16.1.1 172.16.4.0/24 1.1.3.1 1.1.3.2 AS 65100 AS 65300 We like to load balance over all tree links between AS 65100 and AS 65300 4
load balancing over multiple links Loopback Interface 0 172.16.50.1 192.168.4.0/24 AS 65100 1.1.1.1 1.1.2.1 1.1.3.1 1.1.1.2 1.1.2.2 1.1.3.2 Loopback Interface 0 172.16.1.1 172.16.4.0/24 AS 65300 interface ethernet 0 ip address 192.168.4.1 255.255.255.0 interface serial 0 ip address 1.1.1.1 255.255.255.0 interface serial 1 ip address 1.1.2.1 255.255.255.0 interface serial 2 ip address 1.1.3.1 255.255.255.0 Interface loopback 0 ip address 172.16.50.1 255.255.255.0 router bgp 65100 network 192.168.4.0 mask 255.255.255.0 neighbor 172.16.1.1 remote-as 65300 neighbor 172.16.1.1 ebgp-multihop neighbor 172.16.1.1 update-source loopback 0 no auto-summary ip route 172.16.1.1 255.255.255.255 1.1.1.2 3 ip route 172.16.1.1 255.255.255.255 1.1.2.2 3 ip route 172.16.1.1 255.255.255.255 1.1.3.2 3 5
load balancing over multiple links interface ethernet 0 ip address 172.16.4.1 255.255.255.0 interface serial 0 ip address 1.1.1.2 255.255.255.0 interface serial 1 ip address 1.1.2.2 255.255.255.0 interface serial 2 ip address 1.1.3.2 255.255.255.0 Interface loopback 0 ip address 172.16.1.1 255.255.255.0 router bgp 65100 network 172.16.4.0 mask 255.255.255.0 neighbor 172.16.50.1 remote-as 65300 neighbor 172.16.50.1 ebgp-multihop neighbor 172.16.50.1 update-source loopback 0 no auto-summary ip route 172.16.50.1 255.255.255.255 1.1.1.1 3 ip route 172.16.50.1 255.255.255.255 1.1.2.1 3 ip route 172.16.50.1 255.255.255.255 1.1.3.1 3 Loopback Interface 0 172.16.50.1 192.168.4.0/24 AS 65100 1.1.1.1 1.1.2.1 1.1.3.1 1.1.1.2 1.1.2.2 1.1.3.2 Loopback Interface 0 172.16.1.1 172.16.4.0/24 AS 65300 6
Multihoming to a single provider In situation where links to the provider isn t reliable enough, it is necessary to have more links to the provider. Beside that, this solution offer better stability and reliability of the network. 7
multihomed to a single provider - default only, one primary and one backup link 192.168.4.0/24 E0 192.168.1.1 E0 1.1.2.1 S0 1.1.2.2 S1 1.1.1.2 S0 172.18.23.0/24 E0 AS 30 0 192.168.1.4 E0 1.1.1.1 S0 AS30 is not learning any BGP routes from AS10 and is sending its own routes via BGP. Outbound traffic from AS30 should always go on the link unless that link fails, in which case it should switch to the other link. Inbound traffic toward AS30 should always come on the link unless that link fails, in which case is should switch to the other link. Prevent any BGP updates from coming into AS3. 8
multihomed to a single provider - default only, one primary and one backup link 192.168.4.0/24 E0 192.168.1.1 E0 1.1.2.1 S0 1.1.2.2 S1 1.1.1.2 S0 172.18.23.0/24 E0 AS 30 0 192.168.1.4 E0 1.1.1.1 S0 router bgp 30 network 172.18.23.0 mask 255.255.255.0 neighbor 1.1.2.1 remote-as 10 neighbor 1.1.2.1 route-map BLOCK in neighbor 1.1.2.1 route-map SETMETRIC1 out neighbor 1.1.1.1 remote-as 10 neighbor 1.1.1.1 route-map BLOCK in neighbor 1.1.1.1 route-map SETMETRIC2 out no auto-summary ip route 0.0.0.0 0.0.0.0 1.1.1.1 40 ip route 0.0.0.0 0.0.0.0 1.1.2.1 60 route-map SETMETRIC1 permit 10 set metric 100 route-map SETMETRIC2 permit 10 set metric 50 route-map BLOCK deny 10 9
multihomed to a single provider - default only, one primary and one backup link 1.1.2.2 S1 192.168.4.0/24 E0 1.1.1.2 S0 172.18.23.0/24 E0 192.168.1.1 E0 1.1.2.1 S0 0 192.168.1.4 E0 1.1.1.1 S0 router# show ip bgp BGP table version 11, local router ID is 192.168.1.4 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP,? - incomplete Network Next Hop Metric LocPrf Weight AS 30 Path *>i 172.18.23.0/24 192.168.1.4 50 100 0 3 i * 1.1.2.1 100 0 3 i *> 192.168.4.0/24 0.0.0.0 0 32768 i router# show ip route Gateway of last resort is 1.1.1.1 to network 0.0.0.0 1.0.0.0 255.0.0.0 is subnetted, 2 subnets C 1.1.1.0 is directly connected, Serial 0 C 1.1.2.0 is directly connected, Serial 1 C 172.18.23.0 is directly connected, Ethernet0 S* 0.0.0.0 0.0.0.0 [40/0] via 1.1.1.1 10
multihomed to a single provider - default, primary and backup plus partial routing 192.68.40.1 193.78.0.0/16 AS 6 192.68.11.2 192.68.6.2 192.68.6.1 NAP 192.68.10.1 192.68.5.2 AS 7 172.16.20.2 S0 172.16.1.1 E1 192.68.5.1 172.16.220.1 E0 172.16.2.254 L0 AS 3 172.16.1.2 E1 172.16.65.1 172.16.10.1 11
multihomed to a single provider - default, primary and backup plus partial routing AS 6 192.68.40.1 192.68.11.2 192.68.6.2 192.68.6.1 193.78.0.0/16 NAP 192.68.10.1 192.68.5.2 AS 7 172.16.20.2 S0 172.16.220.1 E0 172.16.1.1 E1 172.16.2.254 L0 172.16.1.2 E1 172.16.65.1 192.68.5.1 172.16.10.1 AS 3 Routing policies AS3 will only accept AS1 s local routes and its customers routes such as AS6. AS3 will also accept one route from the Internet to set its default toward the provider AS1. For all outbound traffic toward AS1 and AS6 (the partial routes), AS3 should use the link. In case of failure, the other link is used. For all other outbound traffic toward the Internet, AS3 should use the link as the primary link by following a default route. In case of failure, the default via other link should be used. For inbound traffic, AS3 will instruct AS1 to use the link for 172.16.220.0/24. For all other inbound traffic, the link is the primary. 12
multihomed to a single provider - default, primary and backup plus partial routing AS 6 172.16.20.2 S0 172.16.220.1 E0 192.68.40.1 192.68.11.2 192.68.6.2 172.16.1.1 E1 172.16.2.254 L0 AS 3 192.68.6.1 172.16.1.2 E1 172.16.65.1 193.78.0.0/16 NAP 192.68.10.1 192.68.5.2 192.68.5.1 172.16.10.1 AS 7 router bgp 3 no sunchronization network 172.16.1.0 mask 255.255.255.0 network 172.16.10.0 mask 255.255.255.0 network 172.16.65.0 mask 255.255.255.192 network 172.16.220.0 mask 255.255.255.0 neighbor 172.16.1.2 remote-as 3 neighbor 172.16.1.2 update-source loopback0 neighbor 172.16.1.2 next-hop-self neighbor remote-as 1 neighbor route-map SET_OUTBOUND_TRAFFIC in neighbor route-map SET_INBOUND_TRAFFIC out neighbor filter-list 10 out no auto-summary ip route 0.0.0.0 0.0.0.0 193.78.0.0 ip as-path access-list 10 permit ^$ ip as-path access-list 4 permit ^1 6$ ip as-path access-list 4 permit ^1$ access-list 2 permit 172.16.220.0 0.0.0.255 access-list 101 permit ip 193.78.0.0 0.0.255.255 255.255.0.0 0.0.0.0 route-map SET_OUTBOUND_TRAFFIC permit 10 match ip address 101 set local-preference 200 route-map SET_OUTBOUND_TRAFFIC permit 20 match as-path 4 set local-preference 300 route-map SET_INBOUND_TRAFFIC permit 10 match ip address 2 set local-preference 200 route-map SET_INBOUND_TRAFFIC permit 20 set metric 300 13
multihomed to a single provider - default, primary and backup plus partial routing AS 6 192.68.40.1 192.68.11.2 192.68.6.2 172.16.20.2 S0 172.16.1.1 E1 172.16.220.1 E0 172.16.2.254 L0 AS 3 192.68.6.1 172.16.1.2 E1 172.16.65.1 193.78.0.0/16 NAP 192.68.10.1 192.68.5.2 192.68.5.1 172.16.10.1 AS 7 router bgp 3 no sunchronization network 172.16.1.0 mask 255.255.255.0 network 172.16.10.0 mask 255.255.255.0 network 172.16.65.0 mask 255.255.255.192 network 172.16.220.0 mask 255.255.255.0 neighbor 172.16.2.254 remote-as 3 neighbor 172.16.2.254 next-hop-self neighbor 192.68.5.2 remote-as 1 neighbor 192.68.5.2 route-map SET_OUTBOUND_TRAFFIC in neighbor 192.68.5.2 route-map SET_INBOUND_TRAFFIC out neighbor 192.68.5.2 filter-list 10 out no auto-summary ip route 0.0.0.0 0.0.0.0 193.78.0.0 ip as-path access-list 10 permit ^$ ip as-path access-list 4 permit ^1 6$ ip as-path access-list ^1?[0-9]*$ ip as_path access-list 4 permit ^1$ access-list 101 permit ip 193.78.0.0 0.0.255.255 255.255.0.0 0.0.0.0 route-map SET_OUTBOUND_TRAFFIC permit 10 match ip address 101 set local-preference 250 route-map SET_OUTBOUND_TRAFFIC permit 20 match as-path 4 set local-preference 250 route-map SET_INBOUND_TRAFFIC permit 10 set metric 250 14
multihomed to a single provider - automatic load balancing AS 6 192.68.40.1 192.68.11.2 192.68.6.2 AS1 will load balancing traffic over two links between AS1 and AS3. 192.68.6.1 172.16.60.1 172.16.20.2 S0 RTA 172.16.60.2 172.16.1.1 E1 172.16.2.254 L0 AS 3 172.16.1.2 172.16.10.1 15
multihomed to a single provider - automatic load balancing router bgp 3 no sunchronization neighbor 172.16.1.2 remote-as 3 neighbor 172.16.1.2 update-source loopback0 neighbor remote-as 1 neighbor filter-list 10 out neighbor 172.16.60.1 remote-as 1 neighbor 172.16.60.1 filter-list 10 out maximum-paths 2 no auto-summary ip as-path access-list 10 permit ^$ AS 6 192.68.40.1 192.68.11.2 192.68.6.2 172.16.20.2 S0 172.16.60.2 172.16.1.1 E1 AS 3 192.68.6.1 172.16.2.254 L0 172.16.1.2 172.16.60.1 172.16.10.1 router# show ip bgp BGP table version 11, local router ID is 172.168.60.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP,? - incomplete Network Next Hop Metric LocPrf Weight Path *>i 172.16.10.0/24 172.16.1.2 0 100 0 i *> 192.68.11.0 0 0 1 i * 172.16.60.1 0 1 i *> 192.68.40.0 0 1 6 i 16
Multihomed to different provider Multihoming to different provider is offering better stability and reliability of network. Because of that, it can be often found network which is multihomed. 17
multihomed to different provider AS 6 192.68.40.1 192.68.10.4 193.78.0.0/16 AS 7 192.68.10.2 NAP Route Server 192.68.10.1 192.68.10.3 192.68.6.1 AS 2 192.68.5.2 172.16.20.2 S0 172.16.1.1 E1 192.68.5.1 172.16.220.1 E0 172.16.2.254 L0 255.255.255.255 AS 3 172.16.1.2 E1 172.16.65.1 172.16.10.1 18
multihomed to different provider AS 6 192.68.40.1 192.68.10.4 193.78.0.0/16 AS 7 192.68.10.2 NAP Route Server 192.68.10.1 192.68.10.3 192.68.6.1 AS 2 192.68.5.2 172.16.20.2 S0 172.16.220.1 E0 192.68.5.1 Routing policies AS3 will be accepting AS1 s local and customer routes only via the link. All other Internet routes will be accepted via the link (primary). AS3 will accept a default route from AS1 just in case there is a failure in the link. AS3 prefers that the network 172.16.220.0/24 be reachable by the outside world via the link, and networks 172.16.10.0/24 and 172.16.65.0/26 be reachable via the link. AS3 cannot be a transit network for A1 and AS2, which means that under no circumstances will AS1 use AS3 to reach AS2. 172.16.1.1 E1 172.16.2.254 L0 255.255.255.255 AS 3 172.16.1.2 E1 172.16.10.1 172.16.65.1 19
multihomed to different provider router bgp 3 no sunchronization network 172.16.1.0 mask 255.255.255.0 network 172.16.10.0 mask 255.255.255.0 network 172.16.65.0 mask 255.255.255.192 network 172.16.220.0 mask 255.255.255.0 neighbor 172.16.1.2 remote-as 3 neighbor 172.16.1.2 update-source Loopback0 neighbor 172.16.1.2 next-hop-self neighbor remote-as 1 neighbor route-map ACCEPT_ALL in neighbor route-map PREPEND_PATH out no auto-summary ip as-path access-list 1 permit ^1?[0-9]*$ ip as-path access-list 2 permit ^$ access-list 1 permit 172.16.65.0 0.0.0.63 access-list 1 permit 172.16.10.0 0.0.0.255 access-list 10 permit 0.0.0.0 route-map PREPEND_PATH permit 10 match ip address 1 set as-path prepend 3 3 3 route-map PREPEND_PATH permit 20 match as-path 2 route-map ACCEPT_LOCAL permit 10 match ip address 10 set local-preference 50 route-map ACCEPT_LOCAL permit 20 match as-path 1 AS 6 172.16.20.2 S0 172.16.220.1 E0 192.68.40.1 192.68.10.4 192.68.10.3 172.16.1.1 E1 172.16.2.254 L0 255.255.255.255 193.78.0.0/16 AS 3 AS 7 192.68.6.1 172.16.1.2 E1 172.16.65.1 192.68.10.2 NAP 192.68.10.1 192.68.5.2 192.68.5.1 AS 2 172.16.10.1 Route Server 20
multihomed to different provider AS 6 172.16.20.2 S0 172.16.220.1 E0 192.68.40.1 192.68.10.4 192.68.10.3 172.16.1.1 E1 172.16.2.254 L0 255.255.255.255 193.78.0.0/16 AS 3 AS 7 192.68.6.1 172.16.1.2 E1 172.16.65.1 192.68.10.2 NAP 192.68.10.1 192.68.5.2 192.68.5.1 AS 2 172.16.10.1 Route Server router bgp 3 no sunchronization network 172.16.1.0 mask 255.255.255.0 network 172.16.10.0 mask 255.255.255.0 network 172.16.65.0 mask 255.255.255.192 network 172.16.220.0 mask 255.255.255.0 neighbor 172.16.2.254 remote-as 3 neighbor 172.16.2.254 next-hop-self neighbor 192.68.5.2 remote-as 1 neighbor 192.68.5.2 route-map PREPEND_PATH out no auto-summary ip as-path access-list 2 permit ^$ access-list 1 permit 172.16.220.0 0.0.0.255 route-map PREPEND_PATH permit 10 match ip address 1 set as-path prepend 3 3 3 route-map PREPEND_PATH permit 20 match as-path 2 21
multihomed to different provider - customers of the same provider with a backup link 192.68.40.1 AS 6 172.16.10.4 AS 7 NAP 172.16.220.1 172.16.20.2 172.16.1.1 172.16.2.254 L0 255.255.255.255 AS 3 172.16.1.2 172.16.65.1 172.16.10.1 192.68.5.1 192.68.6.2 192.68.6.1 192.68.5.2 AS 2 192.68.6.1 22
multihomed to different provider - customers of the same provider with a backup link 192.68.40.1 AS 6 172.16.10.4 AS 7 NAP 172.16.220.1 172.16.20.2 172.16.1.1 172.16.2.254 L0 255.255.255.255 AS 3 172.16.1.2 172.16.65.1 172.16.10.1 192.68.5.1 192.68.6.2 192.68.6.1 192.68.5.2 AS 2 192.68.6.1 Routing policies In normal condition, AS1 and AS2 will use the private link only for traffic between AS1 and AS2; for all other Internet traffic, the direct link to the provider AS3 is used. AS1 and AS2 agree to use each other as backup in case their links to AS3 fail. 23
multihomed to different provider - customers of the same provider with a backup link router bgp 1 network 192.168.11.0 mask 255.255.255.0 neighbor 172.16.20.2 remote-as 3 neighbor 172.16.20.2 route-map PREF_FROM_AS3 in neighbor 192.68.6.1 remote-as 1 neighbor 192.68.6.1 route-map PREF_FROM_AS2 in no auto-summary ip as-path access-list 1 permit _2_ route-map PREF_FROM_AS3 permit 10 match ip address 1 set local-preference 100 route-map PREF_FROM_AS3 permit 20 match local-preference 300 route-map PREF_FROM_AS2 permit 10 set local-preference 200 AS 6 172.16.220.1 192.68.40.1 172.16.20.2 172.16.10.4 192.68.6.2 172.16.1.1 172.16.2.254 L0 255.255.255.255 AS 3 AS 7 172.16.1.2 172.16.65.1 192.68.6.1 NAP 172.16.10.1 192.68.5.1 192.68.5.2 AS 2 192.68.6.1 24
multihomed to different provider - customers of the same provider with a backup link AS 6 192.68.40.1 172.16.10.4 AS 7 NAP 172.16.220.1 172.16.20.2 172.16.1.1 172.16.2.254 L0 255.255.255.255 AS 3 172.16.1.2 172.16.65.1 172.16.10.1 192.68.5.1 router# show ip bgp BGP table version 11, local router ID is Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP,? - incomplete Network Next Hop Metric LocPrf Weight Path *>i 172.16.1.0/24 172.16.20.2 0 300 0 3 i * 192.68.6.1 200 0 2 3 i *> 172.16.10.0/24 172.16.20.2 20 300 0 3 i * 192.68.6.1 200 0 2 3 i *> 172.16.65.0/26 172.16.20.2 20 300 0 3 i * 192.68.6.1 200 0 2 3 i *> 172.16.220.0/24 172.16.20.2 0 300 0 3 i * 192.68.6.1 200 0 2 3 i * 192.68.10.0 172.16.20.2 0 100 0 3 2 i *> 192.68.6.1 200 0 2 i *> 192.68.11.0 0.0.0.0 0 32768 i *> 192.68.40.0 172.16.20.2 300 0 3 6 i *> 192.68.6.1 200 0 2 3 6 192.68.6.2 192.68.6.1 192.68.5.2 AS 2 192.68.6.1 25
multihomed to different provider - customers of different providers with a backup link 172.16.2.254 L0 255.255.255.255 AS 4 172.16.220.1 172.16.20.2 172.16.1.1 172.16.65.1 172.16.1.2 192.68.5.1 172.16.10.1 AS 3 192.68.6.2 192.68.6.1 192.68.5.2 AS 2 192.68.10.1 26
multihomed to different provider - customers of different providers with a backup link 172.16.2.254 L0 255.255.255.255 AS 4 172.16.220.1 172.16.20.2 172.16.1.1 172.16.65.1 172.16.10.1 172.16.1.2 AS 3 192.68.5.1 192.68.6.2 192.68.6.1 192.68.5.2 AS 2 192.68.10.1 Routing policies In normal condition, AS1 and AS2 will use the private link only for traffic between AS1 and AS2; for all other Internet traffic, both customers would like to go out via their direct providers, AS1 via AS4 and AS2 via AS3 In case the private link goes down, the customers should be able to talk to one another via the providers. If a link to the provider fails, the other customer should be used to reach the Internet. 27
multihomed to different provider - customers of different providers with a backup link router bgp 4 network 172.16.220.0 mask 255.255.255.0 neighbor 172.16.1.2 remote-as 3 neighbor 172.16.1.2 route-map CHECK_COMMUNITY in neighbor remote-as 1 neighbor route-map CHECK_COMMUNITY in no auto-summary ip community-list 2 permit 4:40 ip community-list 3 permit 4:60 route-map CHECK_COMMUNITY permit 10 match community 2 set local-preference 40 route-map CHECK_COMMUNITY permit 20 match community 3 set local-preference 60 route-map CHECK_COMMUNITY permit 30 set local-preference 100 172.16.2.254 L0 255.255.255.255 AS 4 172.16.220.1 172.16.20.2 192.68.6.2 172.16.1.1 172.16.65.1 172.16.10.1 172.16.1.2 192.68.5.1 192.68.6.1 AS 3 192.68.5.2 AS 2 192.68.10.1 Solution No. 1 - The Community Approach 28
multihomed to different provider - customers of different providers with a backup link router bgp 1 network 192.68.11.0 mask 255.255.255.0 neighbor 172.16.20.2 remote-as 4 neighbor 172.16.20.2 send-community neighbor 172.16.20.2 route-map SETCOMMUNITY out neighbor 172.16.20.2 filter-list 10 out neighbor 192.68.6.1 remote-as 2 no auto-summary ip as-path access-list 2 permit _2_ ip as-path access-list 10 permit ^$ ip as-path access-list 10 permit ^2$ route-map SETCOMMUNITY permit 10 match as-path 2 set community 4:40 route-map SETCOMMUNITY permit 20 172.16.2.254 L0 255.255.255.255 AS 4 172.16.220.1 172.16.20.2 192.68.6.2 172.16.1.1 172.16.65.1 172.16.10.1 172.16.1.2 192.68.5.1 192.68.6.1 AS 3 192.68.5.2 AS 2 192.68.10.1 Solution No. 1 - The Community Approach 29
multihomed to different provider - customers of different providers with a backup link router bgp 3 network 172.16.10.0 mask 255.255.255.0 network 172.16.65.0 mask 255.255.255.192 neighbor 172.16.1.1 remote-as 4 neighbor 172.16.1.1 send-community neighbor 172.16.1.1 route-map setcommunity out neighbor 192.68.5.2 remote-as 2 no auto-summary route-map setcommunity permit 10 set community 4:60 172.16.2.254 L0 255.255.255.255 AS 4 172.16.220.1 172.16.20.2 172.16.1.1 172.16.65.1 172.16.10.1 172.16.1.2 192.68.5.1 AS 3 192.68.6.2 192.68.6.1 192.68.5.2 AS 2 192.68.10.1 Solution No. 1 - The Community Approach 30
multihomed to different provider - customers of different providers with a backup link router# show ip bgp BGP table version 11, local router ID is 172.16.2.254 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP,? - incomplete Network Next Hop Metric LocPrf Weight Path *> 172.16.10.0/24 172.16.1.2 0 60 0 3 i *> 172.16.65.0/26 172.16.1.2 0 60 0 3 i *> 172.16.220.0/24 0.0.0.0 0 32768 i *> 192.68.10.0 172.16.1.2 0 60 0 3 2 i * 40 0 1 2 i *> 192.68.11.0 0 100 0 1 i 172.16.2.254 L0 255.255.255.255 AS 4 172.16.220.1 172.16.20.2 172.16.1.1 172.16.65.1 172.16.10.1 172.16.1.2 192.68.5.1 AS 3 192.68.6.2 192.68.6.1 192.68.5.2 AS 2 Solution No. 1 - The Community Approach 192.68.10.1 31
multihomed to different provider - customers of different providers with a backup link router bgp 1 network 192.68.11.0 mask 255.255.255.0 neighbor 172.16.20.2 remote-as 4 neighbor 172.16.20.2 route-map setpath out neighbor 172.16.20.2 filter-list 10 out neighbor 192.68.6.1 remote-as 2 no auto-summary ip as-path access-list 2 permit _2_ ip as-path access-list 10 permit ^$ ip as-path access-list 10 permit ^2$ route-map setpath permit 10 match as-path 2 set as-path prepend 1 route-map setpath permit 20 172.16.2.254 L0 255.255.255.255 AS 4 172.16.220.1 172.16.20.2 192.68.6.2 172.16.1.1 172.16.65.1 172.16.10.1 172.16.1.2 192.68.5.1 192.68.6.1 AS 3 192.68.5.2 AS 2 192.68.10.1 Solution No. 2 - The AS_Path Approach 32
multihomed to different provider - customers of different providers with a backup link router# show ip bgp BGP table version 9, local router ID is 172.16.2.254 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP,? - incomplete Network Next Hop Metric LocPrf Weight Path *> 172.16.10.0/24 172.16.1.2 0 0 3 i *> 172.16.65.0/26 172.16.1.2 0 0 3 i *> 172.16.220.0/24 0.0.0.0 0 32768 i *> 192.68.10.0 172.16.1.2 0 0 3 2 i * 0 1 1 2 i *> 192.68.11.0 0 100 0 1 i 172.16.2.254 L0 255.255.255.255 AS 4 172.16.220.1 172.16.20.2 172.16.1.1 172.16.65.1 172.16.10.1 172.16.1.2 192.68.5.1 AS 3 192.68.6.2 192.68.6.1 192.68.5.2 AS 2 Solution No. 2 - The Community Approach 192.68.10.1 33
Following default inside an AS Inserting default route in an AS can make a lot of problem if it wasn t do on appropriate way. 34
following defaults inside an AS Border routers HAVE physical connection. NAP AS 7 192.68.10.2 193.78.0.0/16 192.68.10.1 192.68.10.3 AS 2 192.68.5.2 172.16.20.2 172.16.1.1 AS 3 192.68.5.1 172.16.220.1 172.16.70.1 IGP 172.16.70.2 172.16.1.2 RTG IGP 172.16.50.2 172.16.50.1 35
following defaults inside an AS 192.68.10.2 NAP AS 7 193.78.0.0/16 192.68.10.1 192.68.10.3 AS 2 192.68.5.2 172.16.20.2 172.16.1.1 172.16.220.1 172.16.70.1 IGP 172.16.70.2 AS 3 RTG 172.16.1.2 IGP 172.16.50.2 192.68.5.1 172.16.50.1 Routing policies RTG is an interior router in AS3 that is running an OSPF; RTG is following the default route 0/0 to reach networks outside AS3 AS3 is multihomed to two different providers. 36
following defaults inside an AS router ospf 16 passive-interface Serial0 network 172.16.0.0 0.0.255.255 area 0 default-information originate always router bgp 3 no synchronization network 172.16.1.0 mask 255.255.255.0 network 172.16.70.0 mask 255.255.255.0 network 172.16.220.0 mask 255.255.255.0 neighbor remote-as 1 neighbor filter-list 10 out neighbor 172.16.1.2 remote-as 3 no auto-summary ip as-path access-list 10 permit ^$ 192.68.10.3 NAP AS 7 192.68.10.2 193.78.0.0/16 192.68.10.1 AS 2 192.68.5.2 172.16.20.2 172.16.1.1 172.16.220.1 172.16.70.1 IGP 172.16.70.2 AS 3 RTG 172.16.1.2 IGP 172.16.50.2 192.68.5.1 172.16.50.1 37
following defaults inside an AS 172.16.20.2 172.16.1.1 172.16.220.1 172.16.70.1 192.68.10.3 IGP 172.16.70.2 192.68.10.2 NAP 193.78.0.0/16 AS 7 AS 3 192.68.10.1 192.68.5.2 192.68.5.1 172.16.1.2 172.16.50.1 RTG IGP 172.16.50.2 AS 2 router ospf 16 passive-interface Serial0 network 172.16.0.0 0.0.255.255 area 0 default-information originate always router bgp 3 no synchronization network 172.16.1.0 mask 255.255.255.0 network 172.16.50.0 mask 255.255.255.0 neighbor 172.16.1.1 remote-as 1 neighbor 172.16.1.1 next-hop-self neighbor 172.16.5.2 remote-as 2 neighbor 172.16.5.2 filter-list 10 out no auto-summary ip as-path access-list 10 permit ^$ router ospf 16 network 172.16.0.0 0.0.255.255 area 0 38
following defaults inside an AS Border routers DON T HAVE physical connection. 192.68.10.2 NAP AS 7 193.78.0.0/16 192.68.10.1 192.68.10.3 AS 2 192.68.5.2 172.16.20.2 AS 3 192.68.5.1 172.16.220.1 172.16.70.1 IGP 172.16.70.2 RTG IGP 172.16.50.2 172.16.50.1 39
following defaults inside an AS router ospf 16 passive-interface Serial0 network 172.16.0.0 0.0.255.255 area 0 default-information originate route-map send_default router bgp 3 no synchronization network 172.16.70.0 mask 255.255.255.0 network 172.16.220.0 mask 255.255.255.0 neighbor remote-as 1 neighbor filter-list 10 out neighbor 172.16.50.1 remote-as 3 neighbor 172.16.50.1 route-map setlocalpref in no auto-summary ip as-path access-list 10 permit ^$ 192.68.10.3 access-list 1 permit 0.0.0.0 access-list 2 permit route-map setlocalpref permit 10 set local-preference 300 172.16.20.2 route-map send_default permit 10 match ip address 1 172.16.220.1 172.16.70.1 match ip next-hop 2 IGP 172.16.70.2 NAP AS 7 RTG 192.68.10.2 193.78.0.0/16 192.68.10.1 AS 3 IGP 172.16.50.2 192.68.5.2 192.68.5.1 172.16.50.1 AS 2 40
following defaults inside an AS 172.16.20.2 172.16.220.1 192.68.10.3 172.16.70.1 IGP 172.16.70.2 NAP AS 7 RTG 192.68.10.2 193.78.0.0/16 192.68.10.1 AS 3 IGP 172.16.50.2 192.68.5.2 192.68.5.1 172.16.50.1 AS 2 router ospf 16 passive-interface Serial0 network 172.16.0.0 0.0.255.255 area 0 default-information originate route-map send_default router bgp 3 no synchronization network 172.16.50.0 mask 255.255.255.0 neighbor 172.16.70.1 remote-as 3 neighbor 172.16.70.1 net-hop-self neighbor 192.68.5.2 remote-as 2 neighbor 192.68.5.2 filter-list 10 out no auto-summary ip as-path access-list 10 permit ^$ access-list 1 permit 0.0.0.0 access-list 2 permit 192.68.5.2 route-map send_default permit 10 match ip address 1 match ip next-hop 2 router ospf 16 network 172.16.0.0 0.0.255.255 area 0 41
Policy routing Possibility to route traffic based on source IP address, instead of destination IP address. 42
policy routing 192.68.10.1 192.68.6.2 192.68.6.1 172.16.80.2 AS 2 172.16.20.2 172.16.80.1 172.16.10.1 172.16.220.1 172.16.70.1 IGP 172.16.70.2 172.16.112.1 IGP 172.16.50.2 172.16.50.1 AS 3 Routing policies Traffic from network 172.16.10.0/24 is directed toward AS2, over link. Traffic from network 172.16.112.0/24 is directed toward AS1 over link; in case of a link failure to AS1, the traffic will go to AS2. For all other source IP address, follow normal routing. 43
policy routing 192.68.6.2 172.16.20.2 172.16.80.1 192.68.6.1 172.16.80.2 172.16.10.1 192.68.10.1 AS 2 172.16.220.1 172.16.70.1 IGP 172.16.70.2 172.16.112.1 IGP 172.16.50.2 172.16.50.1 AS 3 interface ethernet0 ip address 172.16.80.1 255.255.255.0 interface serial1 ip address 172.16.70.1 255.255.255.0 ip policy route-map CHECK_SOURCE router ospf 16 passive-interface Serial0 passive-interface Ethernet0 network 172.16.0.0 0.0.255.255 area 0 default-information originate always router bgp 3 network 172.16.70.0 mask 255.255.255.0 network 172.16.50.0 mask 255.255.255.0 network 172.16.10.0 mask 255.255.255.0 network 172.16.112.0 mask 255.255.255.0 neighbor remote-as 1 neighbor filter-list 10 out neighbor 172.16.80.2 remote-as 2 neighbor 172.16.80.2 filter-list 10 out no auto-summary ip as-path access-list 10 permit ^$ access-list 1 permit 172.16.10.0 255.255.255.0 access-list 2 permit 172.16.112.0 255.255.255.0 route-map CHECK_SOURCE permit 10 match ip address 1 set ip next-hop 172.16.80.2 route-map CHECK_SOURCE permit 20 match ip address 2 set ip next-hop 172.16.80.2 44
Lab examples Equipment: CISCO 2501 (1x10BaseAUI + 2xSerial) 3 pcs. DTE cables...3 pcs DCE cables...3 pcs hub 45
lab example 1 192.168.4.0/24 E0 192.168.1.1 S1 1.1.2.1 S0 1.1.2.2 S1 1.1.1.2 S0 172.18.23.0/24 E0 AS 30 0 192.168.1.2 S1 1.1.1.1 S0 AS30 is not learning any BGP routes from AS10 and is sending its own routes via BGP. Outbound traffic from AS30 should always go on the link unless that link fails, in which case it should switch to the other link. Inbound traffic toward AS30 should always come on the link unless that link fails, in which case is should switch to the other link. Prevent any BGP updates from coming into AS3. 46
lab example 1 192.168.4.0/24 E0 192.168.1.1 S1 1.1.2.1 S0 0 192.168.1.2 S1 1.1.1.1 S0 1.1.2.2 S1 1.1.1.2 S0 172.18.23.0/24 E0 AS 30 interface ethernet 0 ip address 172.18.23.1 255.255.255.0 interface serial 0 ip address 1.1.1.2 255.255.255.0 clockrate 64000 interface serial 1 ip address 1.1.2.2 255.255.255.0 clockrate 6400 router bgp 30 network 172.18.23.0 mask 255.255.255.0 network 1.1.0.0 mask 255.255.252.0 neighbor 1.1.2.1 remote-as 10 neighbor 1.1.2.1 route-map BLOCK in neighbor 1.1.2.1 route-map SETMET1 out neighbor 1.1.1.1 remote-as 10 neighbor 1.1.1.1 route-map BLOCK in neighbor 1.1.1.1 route-map SETMET2 out no auto-summary ip route 0.0.0.0 0.0.0.0 1.1.1.1 40 ip route 0.0.0.0 0.0.0.0 1.1.2.1 60 route-map SETMET1 permit 10 set metric 100 route-map SETMET2 permit 10 set metric 50 route-map BLOCK deny 10 47
lab example 1 192.168.4.0/24 E0 192.168.1.1 S1 1.1.2.1 S0 0 192.168.1.2 S1 1.1.1.1 S0 1.1.2.2 S1 1.1.1.2 S0 172.18.23.0/24 E0 AS 30 interface ethernet 0 ip address 192.168.4.1 255.255.255.0 interface serial 0 ip address 1.1.2.1 255.255.255.0 interface serial 1 ip address 192.168.1.1 255.255.255.0 router bgp 10 network 192.168.0.0 mask 255.255.0.0 neighbor 1.1.2.2 remote-as 30 neighbor 192.168.1.2 remote-as 10 no auto-summary 48
lab example 1 192.168.4.0/24 E0 192.168.1.1 S1 1.1.2.1 S0 0 192.168.1.2 S1 1.1.1.1 S0 1.1.2.2 S1 1.1.1.2 S0 172.18.23.0/24 E0 AS 30 interface serial 0 ip address 1.1.1.1 255.255.255.0 interface serial 1 ip address 192.168.1.2 255.255.255.0 router bgp 10 network 192.168.0.0 mask 255.255.0.0 network 1.1.1.0 mask 255.255.255.0 neighbor 1.1.1.2 remote-as 30 neighbor 192.168.1.1 remote-as 10 no auto-summary 49
lab example 2-a RTA 172.18.2.1 E0 192.168.1.1 S1 1.1.2.1 S0 1.1.2.2 S1 172.18.3.1 E0 RTB 192.168.1.2 S1 RTC 0 1.1.1.2 S0 1.1.1.1 S0 172.18.23.1 E0 Routing policies Traffic to the Internet should go toward 172.18.2.10. is running between RTA and RTB; IGP is running between RTB and RTC. 50
lab example 2-a interface ethernet 0 ip address 172.18.2.1 255.255.255.0 interface serial 0 ip address 1.1.2.1 255.255.255.0 clockrate 64000 interface serial 1 ip address 192.168.1.1 255.255.255.0 clockrate 6400 router bgp 10 no synchronization network 172.18.2.0 mask 255.255.255.0 network 1.1.0.0 mask 255.255.252.0 neighbor 192.168.1.2 remote-as 10 neighbor 192.168.1.2 next-hop-self redistribute static route-map default_only no auto-summary ip route 0.0.0.0 0.0.0.0 172.18.2.1 40 access-list 1 permit 0.0.0.0 route-map default_only permit 10 match ip address 1 set local-preference 300 route-map default_only deny 20 RTA 172.18.2.1 E0 192.168.1.1 S1 1.1.2.2 S1 RTB 192.168.1.2 S1 1.1.2.1 S0 1.1.1.1 S0 RTC 0 172.18.23.1 E0 172.18.3.1 E0 1.1.1.2 S0 51
lab example 2-a interface ethernet 0 ip address 172.18.3.1 255.255.255.0 RTA 172.18.2.1 E0 192.168.1.1 S1 1.1.2.1 S0 1.1.2.2 S1 RTC 172.18.23.1 E0 172.18.3.1 E0 192.168.1.2 S1 1.1.1.1 S0 1.1.1.2 S0 RTB 0 interface serial 0 ip address 1.1.1.1 255.255.255.0 interface serial 1 ip address 192.168.1.2 255.255.255.0 router bgp 10 no synchronization network 172.18.3.0 mask 255.255.255.0 network 1.1.0.0 mask 255.255.252.0 neighbor 192.168.1.1 remote-as 10 neighbor 192.168.1.1 next-hop-self no auto-summary router ospf 16 network 1.1.0.0 0.0.3.255 area 0 default-originate route-map def-only access-list 1 permit 0.0.0.0 route-map def_only permit 10 match ip address 1 52
lab example 2-a RTA 172.18.2.1 E0 192.168.1.1 S1 1.1.2.1 S0 172.18.3.1 E0 RTB 192.168.1.2 S1 1.1.1.1 S0 1.1.2.2 S1 RTC 1.1.1.2 S0 0 172.18.23.1 E0 interface ethernet 0 ip address 172.18.23.1 255.255.255.0 interface serial 0 ip address 1.1.1.2 255.255.255.0 interface serial 1 ip address 1.1.2.2 255.255.255.0 router ospf 16 network 1.1.0.0 0.0.3.255 area 0 53
lab example 2-b RTA 172.18.3.1 E0 RTB 172.18.2.1 E0 1.1.2.1 S0 1.1.1.1 S0 1.1.2.2 S1 RTC 1.1.1.2 S0 0 172.18.23.1 E0 Routing policies Traffic to the Internet should go toward 172.18.2.10. is running between RTA and RTB; IGP is running between RTB and RTC. 54
lab example 2-b interface ethernet 0 ip address 172.18.2.1 255.255.255.0 interface serial 0 ip address 1.1.2.1 255.255.255.0 clockrate 64000 router bgp 10 no synchronization network 172.18.2.0 mask 255.255.255.0 network 1.1.0.0 mask 255.255.252.0 neighbor 1.1.1.1 remote-as 10 neighbor 1.1.1.1 next-hop-self redistribute static route-map default_only no auto-summary ip route 0.0.0.0 0.0.0.0 172.18.2.1 40 access-list 1 permit 0.0.0.0 route-map default_only permit 10 match ip address 1 set local-preference 300 route-map default_only deny 20 RTA 172.18.2.1 E0 1.1.2.2 S1 RTB 1.1.2.1 S0 1.1.1.1 S0 RTC 0 172.18.23.1 E0 172.18.3.1 E0 1.1.1.2 S0 55
lab example 2-b interface ethernet 0 ip address 172.18.3.1 255.255.255.0 interface serial 0 ip address 1.1.1.1 255.255.255.0 RTA 172.18.2.1 E0 1.1.2.1 S0 1.1.2.2 S1 RTC 172.18.23.1 E0 172.18.3.1 E0 1.1.1.2 S0 1.1.1.1 S0 RTB 0 router bgp 10 no synchronization network 172.18.3.0 mask 255.255.255.0 network 1.1.0.0 mask 255.255.252.0 neighbor 1.1.2.1 remote-as 10 neighbor 1.1.2.1 next-hop-self no auto-summary router ospf 16 network 1.1.0.0 0.0.3.255 area 0 default-originate route-map def-only access-list 1 permit 0.0.0.0 route-map def_only permit 10 match ip address 1 56
lab example 2-b RTA 172.18.3.1 E0 RTB 172.18.2.1 E0 1.1.2.1 S0 1.1.1.1 S0 1.1.2.2 S1 RTC 1.1.1.2 S0 0 172.18.23.1 E0 interface ethernet 0 ip address 172.18.23.1 255.255.255.0 interface serial 0 ip address 1.1.1.2 255.255.255.0 interface serial 1 ip address 1.1.2.2 255.255.255.0 router ospf 16 network 1.1.0.0 0.0.3.255 area 0 57
lab example 3 Loopback Interface 0 172.16.50.1 192.168.4.1 E0 1.1.1.1 S0 1.1.1.2 S0 1.1.2.2 S1 1.1.2.1 S1 Loopback Interface 0 172.16.1.1 172.16.4.1 E0 AS 65100 AS 65300 We like to load balance over two links between AS 65100 and AS 65300 58
lab example 3 Loopback Interface 0 172.16.50.1 192.168.4.1 E0 AS 65100 1.1.1.1 S0 1.1.1.2 S0 1.1.2.2 S1 1.1.2.1 S1 Loopback Interface 0 172.16.1.1 172.16.4.1 E0 AS 65300 interface ethernet 0 ip address 192.168.4.1 255.255.255.0 interface serial 0 ip address 1.1.1.1 255.255.255.0 clockrate 64000 interface serial 1 ip address 1.1.2.1 255.255.255.0 clockrate 64000 Interface loopback 0 ip address 172.16.50.1 255.255.255.0 router bgp 65100 network 192.168.4.0 mask 255.255.255.0 network 172.16.50.0 mask 255.255.255.0 neighbor 172.16.1.1 remote-as 65300 neighbor 172.16.1.1 ebgp-multihop neighbor 172.16.1.1 update-source loopback 0 no auto-summary ip route 172.16.1.1 255.255.255.255 1.1.1.2 3 ip route 172.16.1.1 255.255.255.255 1.1.2.2 3 59
lab example 3 Loopback Interface 0 172.16.50.1 192.168.4.1 E0 AS 65100 1.1.1.1 S0 1.1.1.2 S0 1.1.2.2 S1 1.1.2.1 S1 Loopback Interface 0 172.16.1.1 172.16.4.1 E0 AS 65300 interface ethernet 0 ip address 172.16.4.1 255.255.255.0 interface serial 0 ip address 1.1.1.2 255.255.255.0 interface serial 1 ip address 1.1.2.2 255.255.255.0 Interface loopback 0 ip address 172.16.1.1 255.255.255.0 router bgp 65300 network 172.16.4.0 mask 255.255.255.0 network 172.16.1.0 mask 255.255.255.0 neighbor 172.16.50.1 remote-as 65100 neighbor 172.16.50.1 ebgp-multihop neighbor 172.16.50.1 update-source loopback 0 no auto-summary ip route 172.16.50.1 255.255.255.255 1.1.1.1 3 ip route 172.16.50.1 255.255.255.255 1.1.2.1 3 60