BGP – Border Gateway Protocol Breve introducción RETINA – 2003
Programa general Configuración básica Interacciones con el IGP – Synchronization Análisis de tablas BGP y ruteo Atributos (localpref, med, weight, etc) Filtros Comunidades, Reflectors, Confederaciones, Peer-groups
Clase 1 Configuración básica Interacciones con el IGP Next Hops Router BGP, neighbor, network Interacciones con el IGP Synchronization (teoría) Redistribución (?) Next Hops Tablas BGP y ruteo Comandos Show básicos
Antes de empezar IGP: protocolo de ruteo interno, ejemplo RIP, EIGRP, OSPF, IS-IS. BGP: protocolo de ruteo externo, 2 casos: iBGP: dentro del sistema autónomo eBGP: entre sistemas autónomos NO CONFUNDIR: IGP con iBGP!!! Esta distinción es importante para entender lo que sigue!!!
Configuración básica router bgp <AS> Crea el proceso BGP dentro del router. neighbor <ip> remote-as <AS-remoto> Vecinos internos (mismo AS) Vecinos externos (distinto AS) Generalmene los externos comparten una subred, son adyacentes. Los internos pueden estar en cualquier parte del sistema autónomo.
Configuración básica network <red> [mask <mascara>] Produce un alta de una red en la tabla BGP y la marca como local al AS. Diferencia de significado con el comando network de un IGP. La máscara permite especificar supernetting o subnetting.
Configuración básica Ejemplo: router bgp 3597 network 200.10.202.0 network 168.96.0.0 mask 255.255.0.0 neighbor 199.248.144.120 remote-as 3597 neighbor 199.248.144.2 remote-as 548
Configuración básica AS3597 AS548 .1 .2 .3 iBGP eBGP 199.248.144.120 200.10.202.0/24 AS3597 AS548 199.248.144.0/30 .1 .2 eBGP 168.96.2.0 168.96.1.0 .3 199.248.144.120 iBGP
Interacciones con el IGP Cómo inyectamos información (prefijos) en la tabla BGP? 2 tipos de info: Rutas estáticas Rutas del IGP (dinámicas) 2 formas: Comando network Redistribución
Interacciones con el IGP
Interacciones con el IGP Forma preferida: comando network y rutas estáticas Menos aconsejado: comando network y rutas del IGP Nunca: redistribute (static, connected, IGP, cualquier cosa)
Interacciones con el IGP Synchronization: no se anuncian rutas de la tabla de BGP que no se aprendieron además por un IGP. Dicho de otro modo: para que un prefijo aprendido por iBGP sea considerado válido, debe haber un match de ese prefijo en la tabla de ruteo IP.
Interacciones con el IGP
Interacciones con el IGP Objetivo de synchronization: no anunciar prefijos que no son alcanzables via el IGP. Sin embargo, la tendencia actual es: IGP y BGP no se mezclan Los prefijos que no son backbone se llevan en BGP (iBGP o eBGP) Synchronization debe estar deshabilitado.
Next Hops En un IGP, el NH es el IP del router que anunció la ruta. En BGP no: En las sesiones eBGP, el NH es el IP del neighbor que anunció la ruta En las sesiones iBGP: Rutas originadas dentro del AS: NH es el IP del router que la origina Rutas incorporadas por eBGP: se transporta inalterado el NH aprendido por eBGP En medios multiacceso (Ethernet, FR, ATM), el NH es la IP de la interfaz del router que originó la ruta.
Next Hops
Next Hops AS2 AS1 eBGP .2 FR ATM OSPF .3 .1 30.0.0.0/24
Next Hops Comando next-hop-self Útil cuando: Rutas externas (eBGP) no se quieren propagar por iBGP con NH del punto a punto. Rutas de clientes (estáticas a la interfaz + comando network) no se quieren propagar por iBGP con NH del punto a punto. Este comando setea el NH como el router-id
Tabla BGP show ip bgp BGP table version is 48394, local router ID is 200.10.202.31 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 *> 170.210.247.0/24 199.248.144.182 95 0 4387 4270 i *>i170.210.248.0/21 199.248.144.126 0 600 0 4270 i * 199.248.144.182 95 0 4387 4270 i *>i192.168.1.0/30 199.248.144.9 100 0 6140 ? *> 200.10.202.0 0.0.0.0 50 32768 i * i 200.10.202.1 28160 100 0 i * i 200.10.202.11 1 100 0 i
Comandos “show” básicos Sh ip bgp summary Sh ip bgp Sh ip bgp <prefix> Sh ip bgp neighbors [ <ip> ] Sh ip bgp neighbors <ip> advertised-routes Sh ip bgp neighbors <ip> routes Sh ip bgp regexp <regexp>
show ip bgp summary Que router es este? Que router es este? BGP router identifier 200.10.202.22, local AS number 3597 BGP table version is 48347, main routing table version 48347 2558 network entries and 3869 paths using 389968 bytes of memory 527 BGP path attribute entries using 28600 bytes of memory 250 BGP AS-PATH entries using 6304 bytes of memory 1 BGP community entries using 24 bytes of memory 191 BGP route-map cache entries using 3056 bytes of memory 1028 BGP filter-list cache entries using 12336 bytes of memory BGP activity 14929/71963 prefixes, 42175/38306 paths Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 199.248.144.114 4 6140 38357 31873 48347 0 0 6d08h 1342 199.248.144.122 4 7908 31728 34362 48347 0 0 6d09h 97 199.248.144.182 4 4387 32203 34388 48347 0 0 2w1d 70 199.248.144.190 4 3597 31146 62851 48347 0 0 2w1d 4 199.248.144.238 4 3597 0 0 0 0 0 never Active 200.10.202.1 4 3597 38217 52708 48347 0 0 6d08h 2329 200.10.202.11 4 3597 31057 57875 48347 0 0 6d08h 3 200.10.202.23 4 3597 31066 57722 48347 0 0 2w1d 1 200.10.202.114 4 3597 244830 57881 48347 0 0 6d07h 0 200.32.127.2 4 3597 33504 31208 48347 0 0 6d07h 18 200.69.141.117 4 3597 31048 31242 48347 0 0 2d14h 2
show ip bgp BGP table version is 48394, local router ID is 200.10.202.22 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 *> 170.210.244.0/24 199.248.144.182 95 0 4387 4270 i *> 170.210.245.0/24 199.248.144.182 95 0 4387 4270 i *> 170.210.246.0/24 199.248.144.182 95 0 4387 4270 i *> 170.210.247.0/24 199.248.144.182 95 0 4387 4270 i *>i170.210.248.0/21 199.248.144.126 0 600 0 4270 i * 199.248.144.182 95 0 4387 4270 i *>i192.168.1.0/30 199.248.144.9 100 0 6140 ? * i194.138.184.0 172.16.20.143 100 0 11058 7908 i * 199.248.144.114 90 100 0 6140 7908 i *> 199.248.144.122 100 0 7908 65012 I *>i200.10.186.0 172.16.20.121 100 0 11058 10481 i * 199.248.144.114 90 100 0 6140 11058 10481 i *> 200.10.202.0 0.0.0.0 50 32768 i * i 200.10.202.1 28160 100 0 i * i 200.10.202.11 1 100 0 i *>i200.10.202.32/27 200.32.127.2 0 100 0 i *>i200.10.202.232/29 200.10.202.23 0 100 0 i Preguntar que partes de esta tabla tienen problemas Identificar c/u un problema y verlo Vemos
show ip bgp <prefix> BGP routing table entry for 194.138.184.0/24, version 26804 Paths: (3 available, best #3) Advertised to non peer-group peers: 199.248.144.190 200.10.202.1 200.10.202.11 200.10.202.23 200.10.202.114 11058 7908, (Received from a RR-client) 172.16.20.143 (metric 30720) from 200.10.202.1 (200.69.129.106) Origin IGP, localpref 100, valid, internal, ref 2 6140 7908 199.248.144.114 from 199.248.144.114 (200.31.1.218) Origin IGP, metric 90, localpref 100, valid, external, ref 2 7908 65012 199.248.144.122 from 199.248.144.122 (200.47.200.104) Origin IGP, metric 100, localpref 100, valid, external, best, ref 2
show ip bgp neighbors [ <ip> ] BGP neighbor is 199.248.144.238, remote AS 3597, internal link BGP version 4, remote router ID 0.0.0.0 BGP state = Active Last read 2w1d, hold time is 180, keepalive interval is 60 seconds Received 0 messages, 0 notifications, 0 in queue Sent 0 messages, 0 notifications, 0 in queue Route refresh request: received 0, sent 0 Minimum time between advertisement runs is 5 seconds For address family: IPv4 Unicast BGP table version 48398, neighbor version 0 Index 5, Offset 0, Mask 0x20 Route-Reflector Client 0 accepted prefixes consume 0 bytes Prefix advertised 0, suppressed 0, withdrawn 0 Connections established 0; dropped 0 Last reset 2w1d, due to User reset No active TCP connection
show ip bgp neighbors <ip> advertised-routes show ip bgp neighbors 199.248.144.114 advertised-routes BGP table version is 48402, local router ID is 200.10.202.22 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 *> 168.83.0.0 199.248.144.182 95 0 4387 i *>i168.96.192.0/29 200.10.202.1 0 100 0 i *>i199.248.144.0 200.10.202.11 1 100 0 i *>i199.248.144.188/30 199.248.144.190 0 100 0 i *> 200.0.198.0/23 0.0.0.0 32768 i *> 200.1.224.0/19 199.248.144.182 95 0 4387 i *> 200.9.242.0/23 199.248.144.182 95 0 4387 i *> 200.9.244.0/23 199.248.144.182 95 0 4387 i *>i200.10.202.232/29 200.10.202.23 0 100 0 i *>i200.12.154.0 172.16.20.118 100 0 11058 26608 5745 i *>i200.16.96.0 200.16.99.100 0 100 0 676 i *>i200.16.96.0/20 200.16.99.100 100 0 676 i *>i200.16.97.0 200.16.99.100 0 100 0 676 i *>i200.16.98.0 172.16.20.127 100 0 11058 11664 676 i *>i200.16.99.0 172.16.20.127 100 0 11058 11664 676 i *>i200.26.125.0 172.16.20.104 100 0 11058 10834 676 i
show ip bgp neighbors <ip> routes show ip bgp neighbors 200.10.202.1 routes BGP table version is 48402, local router ID is 200.10.202.22 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 *>i170.210.168.0/21 199.248.144.126 0 600 0 4270 i *>i170.210.184.0/21 199.248.144.126 0 600 0 4270 i *>i170.210.192.0/21 199.248.144.126 0 600 0 4270 i *>i170.210.200.0/21 199.248.144.126 0 600 0 4270 i *>i170.210.208.0/21 199.248.144.126 0 600 0 4270 i *>i170.210.216.0/22 199.248.144.126 0 600 0 4270 i *>i170.210.224.0/21 199.248.144.126 0 600 0 4270 i *>i170.210.232.0/22 199.248.144.126 0 600 0 4270 i *>i170.210.239.0/24 199.248.144.126 0 600 0 4270 i *>i170.210.240.0/22 199.248.144.126 0 600 0 4270 i *>i170.210.248.0/21 199.248.144.126 0 600 0 4270 i *>i192.168.1.0/30 199.248.144.9 100 0 6140 ? *>i192.193.42.0 172.16.20.132 100 0 11058 7303 i
show ip bgp regexp <regexp> BGP table version is 48402, local router ID is 200.10.202.22 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 *> 168.83.0.0 199.248.144.182 95 0 4387 i *> 200.1.224.0/19 199.248.144.182 95 0 4387 i *> 200.9.242.0/23 199.248.144.182 95 0 4387 i *> 200.9.244.0/23 199.248.144.182 95 0 4387 i