A6. BGP
torna M7 - Planificació i administració de xarxes
Contingut
BGP
El protocol BGP, Border Gateway Protocol, intercanvia informació d'encaminament entre Sistemes Autònoms (Únic protocol EGP en funcionament), els Routers que intercanvien aquesta informació es diuen Routers de frontera o de porta d'enllaç (gateway), i en el context del protocol peer o veí (neighbor).
El context del protocol BGP és tot Internet i per tant a priori el coneixement de totes les rutes a totes les xarxes d'Internet.
BGP executa un protocol de tipus vector camí (path-vector, semblant a l'algorisme de vector distància) que es basa en l'atribut AS-PATH que conté la seqüència de Sistemes Autònoms que s'han de travessar per arribar a una destinació alhora que permet evitar bucles. En general la ruta amb menor nombre d'AS és la millor.
Eines consulta
Consulta IP Pública
https://api.ipify.org/?format=text
Consulta SA al que pertany IP Pública
Des de terminal amb l'ordre whois. O també des de l'adreça http://asn.cymru.com/cgi-bin/whois.cgi
$ whois 176.84.101.61 | grep AS
status: ASSIGNED PA
mnt-by: MAINT-AS3352
mnt-by: MAINT-AS3352
mnt-by: MAINT-AS3352
% Information related to '176.84.0.0/16AS3352'
origin: AS3352
mnt-by: MAINT-AS3352
mnt-routes: MAINT-AS3352
mnt-lower: MAINT-AS3352
Ranquing CAIDA. Informació AS
Consulta Informació sistemes autònoms (SA). Ranquing CAIDA
Informació i eines BGP
Eines BGP diverses
Toolkit BGP a càrrec de Hurricane Electric
Routing Information Service (RIS). Recollida de dades BGP a càrrec de RIPE (Entitat regional europea de la IANA)
https://www.ripe.net/analyse/internet-measurements/routing-information-service-ris/
Projecte Route views. Informació i eines BGP, a càrrec de la Universitat d'Oregon enfocat a la recollida d'informació BGP
https://www.routeviews.org/routeviews/
El projecte disposa de múltiples punts de presència als quals es pot accedir per consultar la informació de routing BGP
https://archive.routeviews.org/
(Nom d'usuari "rviews")
$ telnet route-views.routeviews.org
Configuració i verificació (IOS Cisco)
La configuració bàsica del protocol consisteix en les següents ordres
Router(config)#router bgp <1-65535>
Router(config-router)#neighbor A.B.C.D remote-as <1-65535>
Router(config-router)#network A.B.C.D mask A.B.C.D
- L’ordre router BGP habilita el routing i s'ha d'acompanyar del nombre d'AS.
- L’ordre neighbor indica l’adreça d'un veí i l'AS a què pertany
- Finalment l’ordre "network" permet anunciar les xarxes dins del SA a través del BGP a la resta d'Internet
Per exemple les següents ordres consulten informació BGP i de la taula de ruta de la IP 92.57.80.125. Es pot observar el següent:
- Hi ha 40 camins disponibles des de l'AS on es troba el Router des d'on s'executa l'ordre fins a l'AS que conté la xarxa de la IP
- Dels 40 camins es considera el millor el número 32 (El que s'adjunta best)
- El millor camí conté la seqüència d'AS: 6453 > 5511 > 12479 fins arribar a l'AS que conté la xarxa de la IP
- El veí de la ruta 66.110.0.86 és la IP del Router frontera del primer AS del camí (6453)
route-views>show ip bgp 92.57.80.125
BGP routing table entry for 92.57.64.0/19, version 27465737
Paths: (40 available, best #32, table default)
[...]
6453 5511 12479, (aggregated by 12479 10.34.1.19)
66.110.0.86 from 66.110.0.86 (66.110.0.86)
Origin IGP, localpref 100, valid, external, best
rx pathid: 0, tx pathid: 0x0
[...]
route-views>show ip route bgp | include 92.57.64.0
B 92.57.64.0/19 [20/0] via 66.110.0.86, 7w0d
Exemple de connexió telnet collector Route views
alex@pc-casa:~$ telnet route-views.routeviews.org
Trying 128.223.51.103...
Connected to route-views.routeviews.org.
Escape character is '^]'.
**********************************************************************
Oregon Exchange BGP Route Viewer
route-views.oregon-ix.net / route-views.routeviews.org
route views data is archived on http://archive.routeviews.org
This hardware is part of a grant by the NSF.
Please contact help@routeviews.org if you have questions, or
if you wish to contribute your view.
This router has views of full routing tables from several ASes.
The list of peers is located at http://www.routeviews.org/peers
in route-views.oregon-ix.net.txt
NOTE: The hardware was upgraded in August 2014. If you are seeing
the error message, "no default Kerberos realm", you may want to
in Mac OS X add "default unset autologin" to your ~/.telnetrc
To login, use the username "rviews".
**********************************************************************
User Access Verification
Username: rviews
route-views>
Consultar la versió
route-views>show version
Cisco IOS XE Software, Version 03.14.00.S - Standard Support Release
Cisco IOS Software, ASR1000 Software (X86_64_LINUX_IOSD-ADVENTERPRISEK9-M), Version 15.5(1)S, RELEASE SOFTWARE (fc5)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2014 by Cisco Systems, Inc.
Compiled Thu 20-Nov-14 18:21 by mcpre
Cisco IOS-XE software, Copyright (c) 2005-2014 by cisco Systems, Inc.
All rights reserved. Certain components of Cisco IOS-XE software are
licensed under the GNU General Public License ("GPL") Version 2.0. The
software code licensed under GPL Version 2.0 is free software that comes
with ABSOLUTELY NO WARRANTY. You can redistribute and/or modify such
GPL code under the terms of GPL Version 2.0. For more details, see the
documentation or "License Notice" file accompanying the IOS-XE software,
or the applicable URL provided on the flyer accompanying the IOS-XE
software.
ROM: IOS-XE ROMMON
route-views uptime is 16 weeks, 2 days, 44 minutes
Uptime for this control processor is 16 weeks, 2 days, 45 minutes
System returned to ROM by reload at 17:59:24 UTC Mon Nov 24 2014
System image file is "bootflash:asr1000rp2-adventerprisek9.03.14.00.S.155-1.S-std.bin"
Last reload reason: Critical software exception, check bootflash:crashinfo_RP_00_00_20161130-213123-UTC
This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.
A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
If you require further assistance please contact us by sending email to
export@cisco.com.
cisco ASR1004 (RP2) processor (revision RP2) with 9891715K/6147K bytes of memory.
Processor board ID FXS1739Q3LN
2 Gigabit Ethernet interfaces
1 Ten Gigabit Ethernet interface
32768K bytes of non-volatile configuration memory.
16777216K bytes of physical memory.
1873919K bytes of eUSB flash at bootflash:.
78085207K bytes of SATA hard disk at harddisk:.
Configuration register is 0x2102
route-views>
Consultar la configuració IP del dispositiu
route-views>show ip interface brief
Interface IP-Address OK? Method Status Protocol
Te0/0/0 128.223.51.103 YES NVRAM up up
GigabitEthernet0/1/0 unassigned YES NVRAM administratively down down
GigabitEthernet0/1/1 unassigned YES NVRAM administratively down down
GigabitEthernet0 10.223.51.103 YES NVRAM up up
El resum de la informació del protocol BGP
route-views>show ip bgp summary
BGP router identifier 128.223.51.103, local AS number 6447
BGP table version is 98298272, main routing table version 98298272
679255 network entries using 168455240 bytes of memory
25577124 path entries using 3069254880 bytes of memory
4119466/119342 BGP path/bestpath attribute entries using 1021627568 bytes of memory
3745928 BGP AS-PATH entries using 184064004 bytes of memory
2 BGP ATTR_SET entries using 80 bytes of memory
121460 BGP community entries using 12201316 bytes of memory
764 BGP extended community entries using 33196 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 4455636204 total bytes of memory
BGP activity 6533221/5811488 prefixes, 466626549/438875496 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
4.69.184.193 4 3356 86229777 132397 98298716 0 0 11w5d 626453
5.101.110.2 4 202018 22901198 163190 98298716 0 0 7w2d 629576
12.0.1.63 4 7018 1497618 7009 98298716 0 0 4d10h 627611
64.71.137.241 4 6939 26130964 128657 98298716 0 0 11w4d 648819
66.59.190.221 4 6539 6631176 131385 98298716 0 0 11w5d 632747
66.110.0.86 4 6453 11132145 79118 98298716 0 0 11w5d 626458
66.185.128.48 4 1668 7432141 92961 98298716 0 0 4w1d 624975
69.31.111.244 4 4436 0 0 1 0 0 never Active
80.241.176.31 4 20771 0 0 1 0 0 2d15h Active
89.149.178.10 4 3257 9922098 26503 98298716 0 0 11w5d 628070
93.104.209.174 4 58901 2812183 13916 98298716 0 0 1w1d 618931
94.142.247.3 4 8283 10901819 27872 98298716 0 0 3w2d 629201
95.85.0.2 4 200130 4354558 29175 98298716 0 0 1w2d 629661
103.247.3.45 4 58511 4632047 6599 98298716 0 0 4d03h 651740
103.255.249.22 4 58443 0 0 1 0 0 6w1d Idle
104.192.216.1 4 46450 507551 8344 98298716 0 0 2d15h 630030
114.31.199.1 4 4826 2590920 19179 98298716 0 0 1w5d 651795
123.108.254.218 4 9902 0 0 1 0 0 3d16h Idle
129.250.0.11 4 2914 15299042 230834 98298716 0 0 10w3d 628338
132.198.255.253 4 1351 10111720 128643 98298716 0 0 11w4d 651141
134.222.87.1 4 286 17222098 59493 98298716 0 0 5w2d 628286
137.39.3.55 4 701 7077966 131337 98298716 0 0 11w5d 627267
140.192.8.16 4 54728 870002 18657 98298716 0 0 5d22h 647383
144.228.241.130 4 1239 3452626 43428 98298716 0 0 6w3d 626634
154.11.11.113 4 852 0 0 1 0 0 never Idle
154.11.98.225 4 852 16463115 128659 98298716 0 0 11w4d 629488
162.243.188.2 4 393406 12350931 92993 98298716 0 0 4w1d 628775
162.250.137.254 4 4901 13421993 81371 98298716 0 0 12w1d 629049
173.205.57.234 4 53364 17774604 79111 98298716 0 0 11w5d 628072
192.203.116.253 4 22388 0 0 1 0 0 never Idle
192.241.164.4 4 62567 37114592 260296 98298716 0 0 11w5d 628782
193.0.0.56 4 3333 197788 602 98298716 0 0 04:33:28 638923
193.251.245.74 4 5511 0 0 1 0 0 never Idle
194.85.40.15 4 3267 18634751 128621 98298716 0 0 11w4d 636315
195.66.232.239 4 5459 4865420 108781 98298716 0 0 16w2d 216694
195.208.112.161 4 3277 1031871 2141 98298716 0 0 4d11h 639667
198.32.252.33 4 20080 16734 2608 98298716 0 0 19:57:15 16936
202.93.8.242 4 24441 467570 27895 98298716 0 0 2w3d 143952
202.232.0.2 4 2497 15205954 108821 98298716 0 0 16w2d 635738
203.62.252.83 4 1221 7593941 54459 98298716 0 0 8w1d 629495
203.181.248.168 4 7660 15586654 36408 98298716 0 0 16w2d 544274
206.24.210.80 4 3561 16281812 79138 98298716 0 0 11w5d 628063
207.46.32.34 4 8075 0 0 1 0 0 never Idle
207.172.6.1 4 6079 6631235 82252 98298716 0 0 7w2d 629128
207.172.6.20 4 6079 6447218 82237 98298716 0 0 7w2d 629137
208.51.134.254 4 3549 12314912 128608 98298716 0 0 11w4d 627758
208.74.64.40 4 19214 5823724 63131 98298716 0 0 5w4d 628502
209.124.176.223 4 101 1687585 11679 98298716 0 0 3d17h 630592
212.66.96.126 4 20912 3562351 5541 98298716 0 0 3d11h 633986
213.248.76.202 4 1403 8213001 117921 98298716 0 0 5w2d 629630
217.192.89.50 4 3303 12056918 109044 98298716 0 0 16w2d 629031
route-views>
Consulta les rutes o camins (path) disponibles per a l'adreça pública
route-views>show ip bgp 92.57.80.125
BGP routing table entry for 92.57.64.0/19, version 27465737
Paths: (40 available, best #32, table default)
Not advertised to any peer
Refresh Epoch 1
3333 1273 5511 12479, (aggregated by 12479 10.34.1.19)
193.0.0.56 from 193.0.0.56 (193.0.0.56)
Origin incomplete, localpref 100, valid, external
Community: 1273:22000
rx pathid: 0, tx pathid: 0
Refresh Epoch 1
46450 3356 5511 12479, (aggregated by 12479 10.34.1.19)
104.192.216.1 from 104.192.216.1 (104.192.216.1)
Origin IGP, localpref 100, valid, external
Community: 3356:3 3356:86 3356:575 3356:666 3356:2010 3356:11396
rx pathid: 0, tx pathid: 0
Refresh Epoch 1
20912 174 5511 12479, (aggregated by 12479 10.34.1.19)
212.66.96.126 from 212.66.96.126 (212.66.96.126)
Origin incomplete, localpref 100, valid, external
Community: 174:21100 174:22008 20912:65002
rx pathid: 0, tx pathid: 0
Refresh Epoch 1
101 101 3356 5511 12479, (aggregated by 12479 10.34.1.19)
209.124.176.223 from 209.124.176.223 (209.124.176.223)
Origin IGP, localpref 100, valid, external
Community: 101:20100 101:20110 101:22100 3356:3 3356:22 3356:86 3356:575 3356:666 3356:2011
Extended Community: RT:101:22100
rx pathid: 0, tx pathid: 0
Refresh Epoch 1
58511 3257 5511 12479, (aggregated by 12479 10.34.1.19)
103.247.3.45 from 103.247.3.45 (103.247.3.45)
Origin incomplete, localpref 100, valid, external
rx pathid: 0, tx pathid: 0
...
Cerca quina està marcada com a millor opció (best)
route-views>show ip bgp 92.57.80.125
BGP routing table entry for 92.57.64.0/19, version 27465737
Paths: (40 available, best #32, table default)
[...]
6453 5511 12479, (aggregated by 12479 10.34.1.19)
66.110.0.86 from 66.110.0.86 (66.110.0.86)
Origin IGP, localpref 100, valid, external, best
rx pathid: 0, tx pathid: 0x0
[...]
route-views>show ip route bgp | include 92.57.64.0
B 92.57.64.0/19 [20/0] via 66.110.0.86, 7w0d