| 1 | % Advanced Routing Workshop |
|---|
| 2 | % BGP Policy Lab |
|---|
| 3 | |
|---|
| 4 |  |
|---|
| 5 | |
|---|
| 6 | \pagebreak |
|---|
| 7 | |
|---|
| 8 | # Introduction |
|---|
| 9 | |
|---|
| 10 | The purpose of this exercise is to: |
|---|
| 11 | |
|---|
| 12 | * Apply the concepts of BGP policy learned in class |
|---|
| 13 | to achieve the desired traffic patterns, particularly |
|---|
| 14 | in an academic environment. |
|---|
| 15 | * Learn how to use Local Preference, BGP Communities, AS Path |
|---|
| 16 | Prepending and related BGP operational commands. |
|---|
| 17 | |
|---|
| 18 | # Pre-requisites |
|---|
| 19 | |
|---|
| 20 | This exercise builds upon the configurations implemented in |
|---|
| 21 | the basic BGP routing lab. You must: |
|---|
| 22 | |
|---|
| 23 | * Verify that all your BGP sessions are up |
|---|
| 24 | * Be able to see every lab prefix in your routing table |
|---|
| 25 | * Be able to ping and traceroute successfully to any other router |
|---|
| 26 | in the lab. |
|---|
| 27 | |
|---|
| 28 | **Remember, all the above applies to both IPv4 and IPv6.** |
|---|
| 29 | |
|---|
| 30 | # Routing Policy in academic networks |
|---|
| 31 | |
|---|
| 32 | Research and Education Networks (RENs) are designed for high throughput |
|---|
| 33 | and low latency. In many cases their links are also subsidized by |
|---|
| 34 | governments and other organizations. Therefore, it is common in academic |
|---|
| 35 | environments to want to apply routing policies that prefer these paths |
|---|
| 36 | over the "commodity" (commercial) ones. |
|---|
| 37 | |
|---|
| 38 | # Local Preference |
|---|
| 39 | |
|---|
| 40 | Our first goal is to configure our routers to prefer the paths |
|---|
| 41 | via the NREN for outgoing traffic to ALL destinations. |
|---|
| 42 | |
|---|
| 43 | 1. Use the Local Preference attribute to prefer all routes learned |
|---|
| 44 | via the NREN: |
|---|
| 45 | |
|---|
| 46 | R11: |
|---|
| 47 | |
|---|
| 48 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 49 | route-map set-lpref permit 10 |
|---|
| 50 | set local-preference 150 |
|---|
| 51 | route-map set-lpref permit 20 |
|---|
| 52 | ! |
|---|
| 53 | router bgp 10 |
|---|
| 54 | address-family ipv4 |
|---|
| 55 | neighbor 10.101.254.1 route-map set-lpref in |
|---|
| 56 | address-family ipv6 |
|---|
| 57 | neighbor fd00:101:fe:: route-map set-lpref in |
|---|
| 58 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | R12: |
|---|
| 62 | |
|---|
| 63 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 64 | route-map set-lpref permit 10 |
|---|
| 65 | set local-preference 50 |
|---|
| 66 | route-map set-lpref permit 20 |
|---|
| 67 | ! |
|---|
| 68 | router bgp 10 |
|---|
| 69 | address-family ipv4 |
|---|
| 70 | neighbor 10.201.254.1 route-map set-lpref in |
|---|
| 71 | address-family ipv6 |
|---|
| 72 | neighbor fd00:201:fe:: route-map set-lpref in |
|---|
| 73 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 74 | |
|---|
| 75 | What is the default local preference in Cisco IOS? |
|---|
| 76 | Notice that we are setting a higher preference on the NREN |
|---|
| 77 | side, and a lower preference on the ISP side. Can you think |
|---|
| 78 | of a reason why this could be useful? |
|---|
| 79 | |
|---|
| 80 | Check your BGP routes. The next hop should be the P2P |
|---|
| 81 | address of your NREN's router (except for your own prefix). |
|---|
| 82 | |
|---|
| 83 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 84 | show ip bgp |
|---|
| 85 | show bgp ipv6 unicast |
|---|
| 86 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 87 | |
|---|
| 88 | All good now, right? |
|---|
| 89 | |
|---|
| 90 | Wait!... What about the prefixes of ASs with whom |
|---|
| 91 | you are peering directly? Remember the path selection algorithm? |
|---|
| 92 | What comes first, highest local preference or shortest AS path? |
|---|
| 93 | |
|---|
| 94 | 2. Modify the route map to apply a higher local preference |
|---|
| 95 | attribute to prefixes originated by your direct peers. |
|---|
| 96 | |
|---|
| 97 | *Here, AS10 peers with AS20, but also with the NREN (AS101) |
|---|
| 98 | and the ISP (AS201). Notice the AS Path access list.* |
|---|
| 99 | |
|---|
| 100 | R11: |
|---|
| 101 | |
|---|
| 102 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 103 | ip as-path access-list 1 permit _20$ |
|---|
| 104 | ip as-path access-list 1 permit _101$ |
|---|
| 105 | ip as-path access-list 1 permit _201$ |
|---|
| 106 | ! |
|---|
| 107 | no route-map set-lpref |
|---|
| 108 | ! |
|---|
| 109 | route-map set-lpref permit 10 |
|---|
| 110 | match as-path 1 |
|---|
| 111 | set local-preference 200 |
|---|
| 112 | route-map set-lpref permit 20 |
|---|
| 113 | set local-preference 150 |
|---|
| 114 | route-map set-lpref permit 30 |
|---|
| 115 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 116 | |
|---|
| 117 | R12: |
|---|
| 118 | |
|---|
| 119 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 120 | ip as-path access-list 1 permit _20$ |
|---|
| 121 | ip as-path access-list 1 permit _101$ |
|---|
| 122 | ip as-path access-list 1 permit _201$ |
|---|
| 123 | ! |
|---|
| 124 | no route-map set-lpref |
|---|
| 125 | ! |
|---|
| 126 | route-map set-lpref permit 10 |
|---|
| 127 | match as-path 1 |
|---|
| 128 | set local-preference 200 |
|---|
| 129 | route-map set-lpref permit 20 |
|---|
| 130 | set local-preference 50 |
|---|
| 131 | route-map set-lpref permit 30 |
|---|
| 132 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 133 | |
|---|
| 134 | Use BGP refresh to make sure that the policies are applied: |
|---|
| 135 | |
|---|
| 136 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 137 | clear ip bgp * in |
|---|
| 138 | clear ip bgp * out |
|---|
| 139 | clear bgp ipv6 unicast * in |
|---|
| 140 | clear bgp ipv6 unicast * out |
|---|
| 141 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 142 | |
|---|
| 143 | Check your BGP routes again. What is the next hop towards your direct |
|---|
| 144 | peers' prefixes? (Hint: the path should be direct!) |
|---|
| 145 | |
|---|
| 146 | 3. STOP - Checkpoint |
|---|
| 147 | |
|---|
| 148 | All groups must finish this part before continuing. Do NOT continue |
|---|
| 149 | until the instructor says so. |
|---|
| 150 | |
|---|
| 151 | # Path Prepending |
|---|
| 152 | |
|---|
| 153 | At this point we have influenced outbound traffic only. Now we want to |
|---|
| 154 | influence the traffic *coming in* to our AS. We want traffic to come |
|---|
| 155 | to us via the R&E networks as much as possible. |
|---|
| 156 | |
|---|
| 157 | In the case of this lab, every other group is already preferring the |
|---|
| 158 | NREN link for their outgoing traffic. For groups connected to your |
|---|
| 159 | same NREN, the traffic towards you will NOT go via the commodity |
|---|
| 160 | (commercial) Internet. However, this is not the case for groups |
|---|
| 161 | connected to other NRENs. |
|---|
| 162 | |
|---|
| 163 | To see this, check your paths towards groups NOT connected to your |
|---|
| 164 | NREN. For example, from AS10: |
|---|
| 165 | |
|---|
| 166 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 167 | R11# show ip bgp 10.40.0.0 |
|---|
| 168 | R11# traceroute 10.40.255.1 |
|---|
| 169 | R11# show bgp ipv6 unicast fd00:40::/32 |
|---|
| 170 | R11# traceroute fd00:40:ff::1 |
|---|
| 171 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 172 | |
|---|
| 173 | Notice that the traffic leaves via the R&E networks, but then enters |
|---|
| 174 | AS40 through their commercial ISP. |
|---|
| 175 | |
|---|
| 176 | The same happens with traffic coming back to you from other NRENs. |
|---|
| 177 | How can you influence their path selection so that traffic towards |
|---|
| 178 | you enters via your NREN? |
|---|
| 179 | |
|---|
| 180 | We will now use a technique called AS path prepending, which consists |
|---|
| 181 | of adding extra "fake" hops to a path using our ASN multiple times. |
|---|
| 182 | |
|---|
| 183 | 1. Prepend your AS number twice in the path announced to your ISP: |
|---|
| 184 | |
|---|
| 185 | R12: |
|---|
| 186 | |
|---|
| 187 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 188 | ip prefix-list AS10-prefix permit 10.10.0.0/16 |
|---|
| 189 | ! |
|---|
| 190 | route-map set-prepend permit 100 |
|---|
| 191 | match ip address prefix-list AS10-prefix |
|---|
| 192 | set as-path prepend 10 10 |
|---|
| 193 | route-map set-prepend permit 200 |
|---|
| 194 | ! |
|---|
| 195 | ipv6 prefix-list ipv6-AS10-prefix permit fd00:10::/32 |
|---|
| 196 | ! |
|---|
| 197 | route-map ipv6-set-prepend permit 100 |
|---|
| 198 | match ipv6 address prefix-list ipv6-AS10-prefix |
|---|
| 199 | set as-path prepend 10 10 |
|---|
| 200 | route-map ipv6-set-prepend permit 200 |
|---|
| 201 | ! |
|---|
| 202 | router bgp 10 |
|---|
| 203 | address-family ipv4 |
|---|
| 204 | neighbor 10.201.254.1 route-map set-prepend out |
|---|
| 205 | address-family ipv6 |
|---|
| 206 | neighbor fd00:201:fe:: route-map ipv6-set-prepend out |
|---|
| 207 | ! |
|---|
| 208 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 209 | |
|---|
| 210 | Use BGP refresh to re-announce your prefix to the ISP: |
|---|
| 211 | |
|---|
| 212 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 213 | R12# clear ip bgp 10.201.254.1 out |
|---|
| 214 | R12# clear bgp ipv6 unicast fd00:201:fe:: out |
|---|
| 215 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 216 | |
|---|
| 217 | Ask remote groups (connected to the other NRENs), to verify that |
|---|
| 218 | their paths towards you do not traverse the commercial ISPs. |
|---|
| 219 | |
|---|
| 220 | 2. STOP - Checkpoint |
|---|
| 221 | |
|---|
| 222 | All groups must finish this part before continuing. Do NOT continue |
|---|
| 223 | until the instructor says so. |
|---|
| 224 | |
|---|
| 225 | # BGP Communities |
|---|
| 226 | |
|---|
| 227 | Now let's reflect on our initial outbound policy. Since our NREN |
|---|
| 228 | carries commodity Internet prefixes in addition to R&E prefixes, |
|---|
| 229 | we decided to use the Local Preference attribute to send |
|---|
| 230 | *everything* via the NREN. |
|---|
| 231 | |
|---|
| 232 | In reality this may not be optimal, because the NREN may not |
|---|
| 233 | always have the best paths towards the rest of the Internet and also |
|---|
| 234 | because we're not taking advantage of our dual connections |
|---|
| 235 | to load-balance our outbound traffic. |
|---|
| 236 | |
|---|
| 237 | What we really need is a way to tell *which prefixes are originated |
|---|
| 238 | from the R&E community*, so that we prefer the NREN link when sending |
|---|
| 239 | to *those* prefixes only, and let the rest be decided by the regular |
|---|
| 240 | BGP selection process. This is where BGP communities are useful. |
|---|
| 241 | |
|---|
| 242 | 1. Remove the configurations from the Local Preference section. |
|---|
| 243 | Notice the correct order in which this should be done (hint: |
|---|
| 244 | do not remove something if it's still referenced by something |
|---|
| 245 | else): |
|---|
| 246 | |
|---|
| 247 | R11: |
|---|
| 248 | |
|---|
| 249 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 250 | router bgp 10 |
|---|
| 251 | address-family ipv4 |
|---|
| 252 | no neighbor 10.101.254.1 route-map set-lpref in |
|---|
| 253 | address-family ipv6 |
|---|
| 254 | no neighbor fd00:101:fe:: route-map set-lpref in |
|---|
| 255 | ! |
|---|
| 256 | no route-map set-lpref |
|---|
| 257 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 258 | |
|---|
| 259 | *Remember to do the equivalent thing on the other router.* |
|---|
| 260 | |
|---|
| 261 | RENs use BGP communities (basically tags) to mark groups of routes |
|---|
| 262 | together as a unit, which makes it easier for their members to |
|---|
| 263 | apply policies to those groups of routes. |
|---|
| 264 | |
|---|
| 265 | In this particular case, the NRENs carry research and education |
|---|
| 266 | (R&E) routes, as well as commercial Internet routes. The R&E |
|---|
| 267 | routes are marked with a special community (99) as they are |
|---|
| 268 | received from each customer. Also, the NREN passes those communities |
|---|
| 269 | on to other customers and to the RREN. |
|---|
| 270 | |
|---|
| 271 | Notice that the NRENs and the RREN also use the communities to |
|---|
| 272 | set a higher local preference value, in order to prefer the R&E paths. |
|---|
| 273 | This is because they also can learn those prefixes via the ISPs with |
|---|
| 274 | whom they peer. |
|---|
| 275 | |
|---|
| 276 | NREN1: |
|---|
| 277 | |
|---|
| 278 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 279 | ip bgp-community new-format |
|---|
| 280 | ! |
|---|
| 281 | route-map set-RE-comm permit 10 |
|---|
| 282 | set community 101:99 |
|---|
| 283 | route-map set-RE-comm permit 20 |
|---|
| 284 | ! |
|---|
| 285 | ip community-list 1 permit 100:99 |
|---|
| 286 | ! |
|---|
| 287 | route-map set-RE-lpref permit 10 |
|---|
| 288 | match community 1 |
|---|
| 289 | set local-preference 150 |
|---|
| 290 | route-map set-RE-lpref permit 20 |
|---|
| 291 | ! |
|---|
| 292 | router bgp 101 |
|---|
| 293 | address-family ipv4 |
|---|
| 294 | neighbor 10.101.254.2 send-community |
|---|
| 295 | neighbor 10.101.254.2 route-map set-RE-comm in |
|---|
| 296 | neighbor 10.101.254.6 send-community |
|---|
| 297 | neighbor 10.101.254.6 route-map set-RE-comm in |
|---|
| 298 | neighbor 10.101.254.10 send-community |
|---|
| 299 | neighbor 10.101.254.10 route-map set-RE-comm in |
|---|
| 300 | neighbor 10.100.254.1 send-community |
|---|
| 301 | neighbor 10.100.254.1 route-map set-RE-lpref in |
|---|
| 302 | address-family ipv6 |
|---|
| 303 | neighbor fd00:101:fe::1 send-community |
|---|
| 304 | neighbor fd00:101:fe::1 route-map set-RE-comm in |
|---|
| 305 | neighbor fd00:101:fe::3 send-community |
|---|
| 306 | neighbor fd00:101:fe::3 route-map set-RE-comm in |
|---|
| 307 | neighbor fd00:101:fe::5 send-community |
|---|
| 308 | neighbor fd00:101:fe::5 route-map set-RE-comm in |
|---|
| 309 | neighbor fd00:100:fe:: send-community |
|---|
| 310 | neighbor fd00:100:fe:: route-map set-RE-lpref in |
|---|
| 311 | ! |
|---|
| 312 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 313 | |
|---|
| 314 | NREN2: |
|---|
| 315 | |
|---|
| 316 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 317 | ip bgp-community new-format |
|---|
| 318 | ! |
|---|
| 319 | route-map set-RE-comm permit 10 |
|---|
| 320 | set community 102:99 |
|---|
| 321 | route-map set-RE-comm permit 20 |
|---|
| 322 | ! |
|---|
| 323 | ip community-list 1 permit 100:99 |
|---|
| 324 | ! |
|---|
| 325 | route-map set-RE-lpref permit 10 |
|---|
| 326 | match community 1 |
|---|
| 327 | set local-preference 150 |
|---|
| 328 | route-map set-RE-lpref permit 20 |
|---|
| 329 | ! |
|---|
| 330 | router bgp 102 |
|---|
| 331 | address-family ipv4 |
|---|
| 332 | neighbor 10.102.254.2 send-community |
|---|
| 333 | neighbor 10.102.254.2 route-map set-RE-comm in |
|---|
| 334 | neighbor 10.102.254.6 send-community |
|---|
| 335 | neighbor 10.102.254.6 route-map set-RE-comm in |
|---|
| 336 | neighbor 10.102.254.10 send-community |
|---|
| 337 | neighbor 10.102.254.10 route-map set-RE-comm in |
|---|
| 338 | neighbor 10.100.254.5 send-community |
|---|
| 339 | neighbor 10.100.254.5 route-map set-RE-lpref in |
|---|
| 340 | address-family ipv6 |
|---|
| 341 | neighbor fd00:102:fe::1 send-community |
|---|
| 342 | neighbor fd00:102:fe::1 route-map set-RE-comm in |
|---|
| 343 | neighbor fd00:102:fe::3 send-community |
|---|
| 344 | neighbor fd00:102:fe::3 route-map set-RE-comm in |
|---|
| 345 | neighbor fd00:102:fe::5 send-community |
|---|
| 346 | neighbor fd00:102:fe::5 route-map set-RE-comm in |
|---|
| 347 | neighbor fd00:100:fe::2 send-community |
|---|
| 348 | neighbor fd00:100:fe::2 route-map set-RE-lpref in |
|---|
| 349 | ! |
|---|
| 350 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 351 | |
|---|
| 352 | The regional REN (RREN) connects multiple NRENs, so they |
|---|
| 353 | replace communities in the R&E routes learned from NRENs |
|---|
| 354 | with their own community: |
|---|
| 355 | |
|---|
| 356 | RREN: |
|---|
| 357 | |
|---|
| 358 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 359 | ip bgp-community new-format |
|---|
| 360 | ! |
|---|
| 361 | ip community-list 1 permit 101:99 |
|---|
| 362 | ip community-list 1 permit 102:99 |
|---|
| 363 | ! |
|---|
| 364 | route-map set-RE-comm-in permit 10 |
|---|
| 365 | match community 1 |
|---|
| 366 | set community 100:99 additive |
|---|
| 367 | set local-preference 150 |
|---|
| 368 | route-map set-RE-comm-in permit 20 |
|---|
| 369 | ! |
|---|
| 370 | router bgp 100 |
|---|
| 371 | address-family ipv4 |
|---|
| 372 | neighbor 10.100.254.2 send-community |
|---|
| 373 | neighbor 10.100.254.2 route-map set-RE-comm-in in |
|---|
| 374 | neighbor 10.100.254.6 send-community |
|---|
| 375 | neighbor 10.100.254.6 route-map set-RE-comm-in in |
|---|
| 376 | address-family ipv6 |
|---|
| 377 | neighbor fd00:100:fe::1 send-community |
|---|
| 378 | neighbor fd00:100:fe::1 route-map set-RE-comm-in in |
|---|
| 379 | neighbor fd00:100:fe::3 send-community |
|---|
| 380 | neighbor fd00:100:fe::3 route-map set-RE-comm-in in |
|---|
| 381 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 382 | |
|---|
| 383 | ISPs will originate additional prefixes to represent the |
|---|
| 384 | rest of the commodity Internet: |
|---|
| 385 | |
|---|
| 386 | ISP1: |
|---|
| 387 | |
|---|
| 388 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 389 | router bgp 201 |
|---|
| 390 | address-family ipv4 |
|---|
| 391 | network 172.16.0.0 mask 255.255.0.0 |
|---|
| 392 | network 172.17.0.0 mask 255.255.0.0 |
|---|
| 393 | network 172.18.0.0 mask 255.255.0.0 |
|---|
| 394 | network 172.19.0.0 mask 255.255.0.0 |
|---|
| 395 | address-family ipv6 |
|---|
| 396 | network 2001:db8::/32 |
|---|
| 397 | network 2001:db9::/32 |
|---|
| 398 | network 2001:dba::/32 |
|---|
| 399 | network 2001:dbb::/32 |
|---|
| 400 | ! |
|---|
| 401 | ip route 172.16.0.0 255.255.0.0 null0 |
|---|
| 402 | ip route 172.17.0.0 255.255.0.0 null0 |
|---|
| 403 | ip route 172.18.0.0 255.255.0.0 null0 |
|---|
| 404 | ip route 172.19.0.0 255.255.0.0 null0 |
|---|
| 405 | ! |
|---|
| 406 | ipv6 route 2001:db8::/32 null0 |
|---|
| 407 | ipv6 route 2001:db9::/32 null0 |
|---|
| 408 | ipv6 route 2001:dba::/32 null0 |
|---|
| 409 | ipv6 route 2001:dbb::/32 null0 |
|---|
| 410 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 411 | |
|---|
| 412 | ISP2: |
|---|
| 413 | |
|---|
| 414 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 415 | router bgp 202 |
|---|
| 416 | address-family ipv4 |
|---|
| 417 | network 172.20.0.0 mask 255.255.0.0 |
|---|
| 418 | network 172.21.0.0 mask 255.255.0.0 |
|---|
| 419 | network 172.22.0.0 mask 255.255.0.0 |
|---|
| 420 | network 172.23.0.0 mask 255.255.0.0 |
|---|
| 421 | address-family ipv6 |
|---|
| 422 | network 2001:dbc::/32 |
|---|
| 423 | network 2001:dbd::/32 |
|---|
| 424 | network 2001:dbe::/32 |
|---|
| 425 | network 2001:dbf::/32 |
|---|
| 426 | ! |
|---|
| 427 | ip route 172.20.0.0 255.255.0.0 null0 |
|---|
| 428 | ip route 172.21.0.0 255.255.0.0 null0 |
|---|
| 429 | ip route 172.22.0.0 255.255.0.0 null0 |
|---|
| 430 | ip route 172.23.0.0 255.255.0.0 null0 |
|---|
| 431 | ! |
|---|
| 432 | ipv6 route 2001:dbc::/32 null0 |
|---|
| 433 | ipv6 route 2001:dbd::/32 null0 |
|---|
| 434 | ipv6 route 2001:dbe::/32 null0 |
|---|
| 435 | ipv6 route 2001:dbf::/32 null0 |
|---|
| 436 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 437 | |
|---|
| 438 | 2. Set local preference ONLY on the R&E routes (marked with |
|---|
| 439 | the R&E community) learned from the NREN. Notice that |
|---|
| 440 | your NREN is also passing you the communities set by |
|---|
| 441 | the regional REN, so you need to match either one. |
|---|
| 442 | |
|---|
| 443 | Also notice that we do not set the local preference on the |
|---|
| 444 | prefixes originated by our direct peers. |
|---|
| 445 | |
|---|
| 446 | R11: |
|---|
| 447 | |
|---|
| 448 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 449 | ip bgp-community new-format |
|---|
| 450 | ! |
|---|
| 451 | ip as-path access-list 1 permit _20$ |
|---|
| 452 | ip as-path access-list 1 permit _101$ |
|---|
| 453 | ip as-path access-list 1 permit _201$ |
|---|
| 454 | ! |
|---|
| 455 | ip community-list 1 permit 100:99 |
|---|
| 456 | ip community-list 1 permit 101:99 |
|---|
| 457 | ! |
|---|
| 458 | route-map set-local-pref permit 10 |
|---|
| 459 | match as-path 1 |
|---|
| 460 | continue 30 |
|---|
| 461 | route-map set-local-pref permit 20 |
|---|
| 462 | match community 1 |
|---|
| 463 | set local-preference 150 |
|---|
| 464 | route-map set-local-pref permit 30 |
|---|
| 465 | ! |
|---|
| 466 | router bgp 10 |
|---|
| 467 | address-family ipv4 |
|---|
| 468 | neighbor 10.101.254.1 route-map set-local-pref in |
|---|
| 469 | address-family ipv6 |
|---|
| 470 | neighbor fd00:101:fe:: route-map set-local-pref in |
|---|
| 471 | ! |
|---|
| 472 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 473 | |
|---|
| 474 | Refresh to/from your neighbors: |
|---|
| 475 | |
|---|
| 476 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 477 | clear ip bgp * in |
|---|
| 478 | clear ip bgp * out |
|---|
| 479 | clear bgp ipv6 unicast * in |
|---|
| 480 | clear bgp ipv6 unicast * out |
|---|
| 481 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 482 | |
|---|
| 483 | Verify that communities are being set and transmitted: |
|---|
| 484 | |
|---|
| 485 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 486 | R11#show ip bgp 10.20.0.0 |
|---|
| 487 | R11#show ip bgp 10.40.0.0 |
|---|
| 488 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 489 | |
|---|
| 490 | Check your BGP routes again. |
|---|
| 491 | |
|---|
| 492 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 493 | show ip bgp |
|---|
| 494 | show ip route |
|---|
| 495 | show bgp ipv6 unicast |
|---|
| 496 | show ipv6 route |
|---|
| 497 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 498 | |
|---|
| 499 | The result should be that you now prefer the NREN path for any |
|---|
| 500 | prefix originated by an R&E member. For all other prefixes, |
|---|
| 501 | including the ones from the commercial Internet, your routers |
|---|
| 502 | will choose based on BGP defaults. |
|---|
| 503 | |
|---|
| 504 | # Multihoming with Partial Routes and Defaults |
|---|
| 505 | |
|---|
| 506 | Another way to load-balance outbound traffic in our multihoming setup |
|---|
| 507 | is to play with partial routing tables and default routes. |
|---|
| 508 | The idea is that our routers will prefer the more specific R&E routes |
|---|
| 509 | coming from the NREN, and the rest of the outgoing traffic will use the |
|---|
| 510 | ISP. Only if the ISP fails, our non-R&E traffic will leave through the NREN. |
|---|
| 511 | Similarly, if the NREN link fails, the ISP will route all our |
|---|
| 512 | outbound traffic. |
|---|
| 513 | |
|---|
| 514 | This has the advantage of reducing our routing table size, and |
|---|
| 515 | therefore memory requirements and convergence time. The disadvantage |
|---|
| 516 | is that we may not always follow the best paths, but it might be a good |
|---|
| 517 | compromise. |
|---|
| 518 | |
|---|
| 519 | We are going to ask the NREN to only send us R&E routes, plus |
|---|
| 520 | the default route: |
|---|
| 521 | |
|---|
| 522 | NREN1: |
|---|
| 523 | |
|---|
| 524 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 525 | ip community-list 1 permit 100:99 |
|---|
| 526 | ip community-list 1 permit 101:99 |
|---|
| 527 | ! |
|---|
| 528 | route-map send-RE-only permit 10 |
|---|
| 529 | match community 1 |
|---|
| 530 | ! |
|---|
| 531 | router bgp 101 |
|---|
| 532 | address-family ipv4 |
|---|
| 533 | no neighbor 10.101.254.2 send-community |
|---|
| 534 | no neighbor 10.101.254.6 send-community |
|---|
| 535 | no neighbor 10.101.254.10 send-community |
|---|
| 536 | neighbor 10.101.254.2 route-map send-RE-only out |
|---|
| 537 | neighbor 10.101.254.2 default-originate |
|---|
| 538 | neighbor 10.101.254.6 route-map send-RE-only out |
|---|
| 539 | neighbor 10.101.254.6 default-originate |
|---|
| 540 | neighbor 10.101.254.10 route-map send-RE-only out |
|---|
| 541 | neighbor 10.101.254.10 default-originate |
|---|
| 542 | address-family ipv6 |
|---|
| 543 | no neighbor fd00:101:fe::1 send-community |
|---|
| 544 | no neighbor fd00:101:fe::3 send-community |
|---|
| 545 | no neighbor fd00:101:fe::5 send-community |
|---|
| 546 | neighbor fd00:101:fe::1 route-map send-RE-only out |
|---|
| 547 | neighbor fd00:101:fe::1 default-originate |
|---|
| 548 | neighbor fd00:101:fe::3 route-map send-RE-only out |
|---|
| 549 | neighbor fd00:101:fe::3 default-originate |
|---|
| 550 | neighbor fd00:101:fe::5 route-map send-RE-only out |
|---|
| 551 | neighbor fd00:101:fe::5 default-originate |
|---|
| 552 | ! |
|---|
| 553 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 554 | |
|---|
| 555 | NREN2: |
|---|
| 556 | |
|---|
| 557 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 558 | ip community-list 1 permit 100:99 |
|---|
| 559 | ip community-list 1 permit 102:99 |
|---|
| 560 | ! |
|---|
| 561 | route-map send-RE-only permit 10 |
|---|
| 562 | match community 1 |
|---|
| 563 | ! |
|---|
| 564 | router bgp 102 |
|---|
| 565 | address-family ipv4 |
|---|
| 566 | no neighbor 10.102.254.2 send-community |
|---|
| 567 | no neighbor 10.102.254.6 send-community |
|---|
| 568 | no neighbor 10.102.254.10 send-community |
|---|
| 569 | neighbor 10.102.254.2 route-map send-RE-only out |
|---|
| 570 | neighbor 10.102.254.2 default-originate |
|---|
| 571 | neighbor 10.102.254.6 route-map send-RE-only out |
|---|
| 572 | neighbor 10.102.254.6 default-originate |
|---|
| 573 | neighbor 10.102.254.10 route-map send-RE-only out |
|---|
| 574 | neighbor 10.102.254.10 default-originate |
|---|
| 575 | address-family ipv6 |
|---|
| 576 | no neighbor fd00:102:fe::1 send-community |
|---|
| 577 | no neighbor fd00:102:fe::3 send-community |
|---|
| 578 | no neighbor fd00:102:fe::5 send-community |
|---|
| 579 | neighbor fd00:102:fe::1 route-map send-RE-only out |
|---|
| 580 | neighbor fd00:102:fe::1 default-originate |
|---|
| 581 | neighbor fd00:102:fe::3 route-map send-RE-only out |
|---|
| 582 | neighbor fd00:102:fe::3 default-originate |
|---|
| 583 | neighbor fd00:102:fe::5 route-map send-RE-only out |
|---|
| 584 | neighbor fd00:102:fe::5 default-originate |
|---|
| 585 | ! |
|---|
| 586 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 587 | |
|---|
| 588 | |
|---|
| 589 | Similarly, we will ask the ISP to only send us a default |
|---|
| 590 | route: |
|---|
| 591 | |
|---|
| 592 | |
|---|
| 593 | ISP1: |
|---|
| 594 | |
|---|
| 595 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 596 | ip prefix-list default permit 0.0.0.0/0 |
|---|
| 597 | ipv6 prefix-list ipv6-default permit ::/0 |
|---|
| 598 | ! |
|---|
| 599 | router bgp 201 |
|---|
| 600 | address-family ipv4 |
|---|
| 601 | neighbor 10.201.254.2 default-originate |
|---|
| 602 | neighbor 10.201.254.2 prefix-list default out |
|---|
| 603 | neighbor 10.201.254.6 default-originate |
|---|
| 604 | neighbor 10.201.254.6 prefix-list default out |
|---|
| 605 | neighbor 10.201.254.10 default-originate |
|---|
| 606 | neighbor 10.201.254.10 prefix-list default out |
|---|
| 607 | address-family ipv6 |
|---|
| 608 | neighbor FD00:201:FE::1 default-originate |
|---|
| 609 | neighbor FD00:201:FE::1 prefix-list ipv6-default out |
|---|
| 610 | neighbor FD00:201:FE::3 default-originate |
|---|
| 611 | neighbor FD00:201:FE::3 prefix-list ipv6-default out |
|---|
| 612 | neighbor FD00:201:FE::5 default-originate |
|---|
| 613 | neighbor FD00:201:FE::5 prefix-list ipv6-default out |
|---|
| 614 | ! |
|---|
| 615 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 616 | |
|---|
| 617 | ISP2: |
|---|
| 618 | |
|---|
| 619 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 620 | ip prefix-list default permit 0.0.0.0/0 |
|---|
| 621 | ipv6 prefix-list ipv6-default permit ::/0 |
|---|
| 622 | ! |
|---|
| 623 | router bgp 202 |
|---|
| 624 | address-family ipv4 |
|---|
| 625 | neighbor 10.202.254.2 default-originate |
|---|
| 626 | neighbor 10.202.254.2 prefix-list default out |
|---|
| 627 | neighbor 10.202.254.6 default-originate |
|---|
| 628 | neighbor 10.202.254.6 prefix-list default out |
|---|
| 629 | neighbor 10.202.254.10 default-originate |
|---|
| 630 | neighbor 10.202.254.10 prefix-list default out |
|---|
| 631 | address-family ipv6 |
|---|
| 632 | neighbor FD00:202:FE::1 default-originate |
|---|
| 633 | neighbor FD00:202:FE::1 prefix-list ipv6-default out |
|---|
| 634 | neighbor FD00:202:FE::3 default-originate |
|---|
| 635 | neighbor FD00:202:FE::3 prefix-list ipv6-default out |
|---|
| 636 | neighbor FD00:202:FE::5 default-originate |
|---|
| 637 | neighbor FD00:202:FE::5 prefix-list ipv6-default out |
|---|
| 638 | ! |
|---|
| 639 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 640 | |
|---|
| 641 | Check what you are now receiving from your NREN and |
|---|
| 642 | your ISP: |
|---|
| 643 | |
|---|
| 644 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 645 | R11#show ip bgp neighbors 10.101.254.1 routes |
|---|
| 646 | R11#show bgp ipv6 uni neighbors fd00:101:fe:: routes |
|---|
| 647 | R11#show ip route 0.0.0.0 0.0.0.0 |
|---|
| 648 | R11#show ipv6 route ::/0 |
|---|
| 649 | |
|---|
| 650 | R12#show ip bgp neighbors 10.201.254.1 routes |
|---|
| 651 | R12#show bgp ipv6 uni neighbors fd00:201:fe:: routes |
|---|
| 652 | R12#show ip route 0.0.0.0 0.0.0.0 |
|---|
| 653 | R12#show ipv6 route ::/0 |
|---|
| 654 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 655 | |
|---|
| 656 | At this point you should see that each of your routers |
|---|
| 657 | has a default route pointing to its upstream peer. This |
|---|
| 658 | is an OK situation. But let's say that we want the ISP |
|---|
| 659 | to handle all the non-R&E outbound traffic. |
|---|
| 660 | |
|---|
| 661 | Configure your RX2 router to assign a higher local preference |
|---|
| 662 | to the default announced by the ISP: |
|---|
| 663 | |
|---|
| 664 | R12: |
|---|
| 665 | |
|---|
| 666 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 667 | ip prefix-list default permit 0.0.0.0/0 |
|---|
| 668 | ipv6 prefix-list ipv6-default permit ::/0 |
|---|
| 669 | ! |
|---|
| 670 | route-map set-lpref-default permit 10 |
|---|
| 671 | match ip address prefix-list default |
|---|
| 672 | set local-preference 150 |
|---|
| 673 | ! |
|---|
| 674 | route-map set-lpref-ipv6-default permit 10 |
|---|
| 675 | match ip address prefix-list ipv6-default |
|---|
| 676 | set local-preference 150 |
|---|
| 677 | ! |
|---|
| 678 | router bgp 10 |
|---|
| 679 | address-family ipv4 |
|---|
| 680 | neighbor 10.201.254.1 route-map set-lpref-default in |
|---|
| 681 | address-family ipv6 |
|---|
| 682 | neighbor fd00:201:fe:: route-map set-lpref-ipv6-default in |
|---|
| 683 | ! |
|---|
| 684 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 685 | |
|---|
| 686 | Check your default route on both routers: |
|---|
| 687 | |
|---|
| 688 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 689 | show ip bgp 0.0.0.0 0.0.0.0 |
|---|
| 690 | show ip route 0.0.0.0 0.0.0.0 |
|---|
| 691 | |
|---|
| 692 | show bgp ipv6 uni ::/0 |
|---|
| 693 | show ipv6 route ::/0 |
|---|
| 694 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 695 | |
|---|
| 696 | |
|---|
| 697 | Also, check your BGP routing table. Has it shrinked? |
|---|
| 698 | |
|---|
| 699 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 700 | show ip bgp |
|---|
| 701 | show bgp ipv6 unicast |
|---|
| 702 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 703 | |
|---|