Auf dieser Seite
Beispiel: Konfigurieren von BGP für große Communities
In diesem Beispiel wird gezeigt, wie Sie das optionale Attribut "transitiver Pfad" konfigurieren – eine große 12-Byte-BGP-Community, die den wichtigsten 4-Byte-Wert bereitstellt, um die autonome Systemnummer als globaler Administrator zu codieren, und die verbleibenden zwei zugewiesenen 4-Byte-Nummern für die Codierung der lokalen Werte, wie in RFC 8092 definiert. Sie können BGP für eine große Community auf [edit policy-options community community-name members]
Hierarchie- und [edit routing-options static route ip-address community]
Hierarchieebene konfigurieren. Das BGP-Format für große Community-Attribute besteht aus vier Feldern: large
:global administrator:assigned number:assigned number
.
Anforderungen
In diesem Beispiel werden die folgenden Hardware- und Softwarekomponenten verwendet:
Drei Router der MX-Serie
Junos OS Version 17.3 oder höher, das auf allen Geräten ausgeführt wird
Vor der Konfiguration dieses Beispiels ist keine spezielle Konfiguration erforderlich, die über die Geräteinitialisierung hinausgeht.
Überblick
In diesem Beispiel sind Gerät R1 und Gerät R2 OSPF-Nachbarn im autonomen System (AS) 64510. Gerät R3 verfügt über eine externe BGP-Verbindung (EBGP) zu Gerät R1. Gerät R2 verfügt über Kundennetzwerke im Adressraum 172.16/16, die mit Adressen auf seiner Loopback-Schnittstelle (lo0) simuliert werden. Gerät R1 verfügt über statische Routen zu mehreren 172.16.x/24-Netzwerken und fügt diesen Routen reguläre Community-Werte hinzu. Gerät R1 verwendet dann eine Exportrichtlinie, um die Routen zu Gerät R3 anzukündigen. Gerät R3 empfängt diese Routen und verwendet eine Importrichtlinie, um den Routen große Community-Werte hinzuzufügen.
Topologie
Abbildung 1 zeigt das Beispielnetzwerk.

Konfiguration
CLI-Schnellkonfiguration
Um dieses Beispiel schnell zu konfigurieren, kopieren Sie die folgenden Befehle, fügen Sie sie in eine Textdatei ein, entfernen Sie alle Zeilenumbrüche, ändern Sie alle Details, die für Ihre Netzwerkkonfiguration erforderlich sind, und kopieren Sie dann die Befehle und fügen Sie sie in die CLI auf der Hierarchieebene [edit] ein.
Gerät R1
set interfaces fe-1/2/0 unit 0 family inet address 10.0.0.1/30 set interfaces fe-1/2/3 unit 0 family inet address 10.0.0.14/30 set interfaces lo0 unit 0 family inet address 192.168.0.1/32 primary set routing-options static route 172.16.1.0/24 next-hop 10.0.0.2 set routing-options static route 172.16.1.0/24 community 64510:1 set routing-options static route 172.16.1.0/24 community large:64510:100:1 set routing-options static route 172.16.2.0/24 next-hop 10.0.0.2 set routing-options static route 172.16.2.0/24 community 64510:2 set routing-options static route 172.16.2.0/24 community large:64510:200:2 set routing-options static route 172.16.3.0/24 next-hop 10.0.0.2 set routing-options static route 172.16.3.0/24 community 64510:3 set routing-options static route 172.16.4.0/24 next-hop 10.0.0.2 set routing-options static route 172.16.4.0/24 community 64510:4 set routing-options router-id 192.168.0.1 set routing-options autonomous-system 64510 set protocols bgp group ext type external set protocols bgp group ext export send-static set protocols bgp group ext peer-as 64511 set protocols bgp group ext neighbor 10.0.0.13 set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface fe-1/2/0.0 set policy-options policy-statement send-static term 1 from protocol static set policy-options policy-statement send-static term 1 then accept
Gerät R2
set interfaces fe-1/2/0 unit 0 family inet address 10.0.0.2/30 set interfaces lo0 unit 0 family inet address 192.168.0.2/32 set interfaces lo0 unit 0 family inet address 172.16.1.1/32 set interfaces lo0 unit 0 family inet address 172.16.2.2/32 set interfaces lo0 unit 0 family inet address 172.16.3.3/32 set interfaces lo0 unit 0 family inet address 172.16.4.4/32 set routing-options router-id 192.168.0.2 set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface fe-1/2/0.0
Gerät R3
set interfaces fe-1/2/3 unit 0 family inet address 10.0.0.13/30 set interfaces lo0 unit 0 family inet address 192.168.0.3/32 set routing-options router-id 192.168.0.3 set routing-options autonomous-system 64511 set protocols bgp group to-R1 type external set protocols bgp group to-R1 import set-large-comms set protocols bgp group to-R1 peer-as 64510 set protocols bgp group to-R1 neighbor 10.0.0.14 set policy-options policy-statement set-large-comms term route-1 from route-filter 172.16.1.0/24 exact set policy-options policy-statement set-large-comms term route-1 then community add large2-as set policy-options policy-statement set-large-comms term route-1 then accept set policy-options policy-statement set-large-comms term route-2 from route-filter 172.16.2.0/24 exact set policy-options policy-statement set-large-comms term route-2 then community add large2-ip set policy-options policy-statement set-large-comms term route-2 then accept set policy-options policy-statement set-large-comms term route-3 from route-filter 172.16.3.0/24 exact set policy-options policy-statement set-large-comms term route-3 then community add large1-as set policy-options policy-statement set-large-comms term route-3 then accept set policy-options policy-statement set-large-comms term route-4 from route-filter 172.16.4.0/24 exact set policy-options policy-statement set-large-comms term route-4 then community add large1-ip set policy-options policy-statement set-large-comms term route-4 then accept set policy-options community large1-as members large:64511:3:1 set policy-options community large1-ip members large:7777:4:1 set policy-options community large2-as members large:64511:1:1 set policy-options community large2-ip members large:7777:2:1
Verfahren
Schritt-für-Schritt-Anleitung
Im folgenden Beispiel müssen Sie durch verschiedene Ebenen in der Konfigurationshierarchie navigieren. Informationen zum Navigieren in der CLI finden Sie Verwenden des CLI-Editors im Konfigurationsmodus im Junos OS CLI-Benutzerhandbuch.
So konfigurieren Sie Gerät R3:
Konfigurieren Sie die Schnittstellen.
[edit interfaces] set fe-1/2/3 unit 0 family inet address 10.0.0.13/30 set lo0 unit 0 family inet address 192.168.0.3/32
Konfigurieren Sie die AS-Nummer (Autonomous System) und die Router-ID.
[edit routing-options] set router-id 192.168.0.3 set autonomous-system 64511
Konfigurieren Sie die EBGP-Verbindung mit Gerät R1.
[edit protocols bgp group to-R1] set type external set import set-large-comms set peer-as 64510 set neighbor 10.0.0.14
Konfigurieren Sie die Richtlinie, die den von Gerät R1 empfangenen Routen große Community-Werte hinzufügt.
Eine große Community verwendet die Notation
large
:global administrator:assigned number:assigned number
. Die spezifischen Community-Werte können alles sein, was Ihre administrativen Ziele innerhalb bestimmter Parameter erreicht.[edit policy-options policy-statement set-large-comms] set term route-1 from route-filter 172.16.1.0/24 exact set term route-1 then community add large2-as set term route-1 then accept set term route-2 from route-filter 172.16.2.0/24 exact set term route-2 then community add large2-ip set term route-2 then accept set term route-3 from route-filter 172.16.3.0/24 exact set term route-3 then community add large1-as set term route-3 then accept set term route-4 from route-filter 172.16.4.0/24 exact set term route-4 then community add large1-ip set term route-4 then accept
[edit policy-options ] set community large1-as members large:64511:3:1 set community large1-ip members large:7777:4:1 set community large2-as members large:64511:1:1 set community large2-ip members large:7777:2:1
Ergebnisse
Bestätigen Sie im Konfigurationsmodus Ihre Konfiguration, indem Sie die show interfaces
Befehle , show protocols
, show policy-options
und show routing-options
eingeben. Wenn die Ausgabe nicht die gewünschte Konfiguration anzeigt, wiederholen Sie die Anweisungen in diesem Beispiel, um die Konfiguration zu korrigieren.
user@R3# show interfaces fe-1/2/3 { unit 0 { family inet { address 10.0.0.13/30; } } } lo0 { unit 0 { family inet { address 192.168.0.3/32; } } }
user@R3# show protocols bgp { group to-R1 { type external; import set-large-comms; peer-as 64510; neighbor 10.0.0.14; } }
user@R3# show policy-options policy-statement set-large-comms { term route-1 { from { route-filter 172.16.1.0/24 exact; } then { community add large2-as; accept; } } term route-2 { from { route-filter 172.16.2.0/24 exact; } then { community add large2-ip; accept; } } term route-3 { from { route-filter 172.16.3.0/24 exact; } then { community add large1-as; accept; } } term route-4 { from { route-filter 172.16.4.0/24 exact; } then { community add large1-ip; accept; } } } community large1-as members large:64511:3:1; community large1-ip members large:7777:4:1; community large2-as members large:64511:1:1; community large2-ip members large:7777:2:1;
user@R3# show routing-options router-id 192.168.0.3; autonomous-system 64511;
Wenn Sie mit der Konfiguration des Geräts fertig sind, rufen Sie den Konfigurationsmodus auf commit
.
Verifizierung
Vergewissern Sie sich, dass die Konfiguration ordnungsgemäß funktioniert.
R1 verifizieren
Zweck
Überprüfen Sie auf Gerät R1 die Option 172.16. Routen in der Routing-Tabelle.
Action!
user@R1> show route protocol static match-prefix 172.16.* detail inet.0: 17 destinations, 17 routes (17 active, 0 holddown, 0 hidden) 172.16.1.0/24 (1 entry, 1 announced) *Static Preference: 5 Next hop type: Router, Next hop index: 580 Address: 0xb7a1270 Next-hop reference count: 9 Next hop: 10.0.0.2 via fe-1/2/0.0, selected Session Id: 0x140 State: < Active Int Ext > Local AS: 64510 Age: 4d 19:02:23 Validation State: unverified Task: RT Announcement bits (2): 0-KRT 4-BGP_RT_Background AS path: I Communities: 64510:1 large:64510:100:1 172.16.2.0/24 (1 entry, 1 announced) *Static Preference: 5 Next hop type: Router, Next hop index: 580 Address: 0xb7a1270 Next-hop reference count: 9 Next hop: 10.0.0.2 via fe-1/2/0.0.0, selected Session Id: 0x140 State: < Active Int Ext > Local AS: 64510 Age: 4d 19:02:23 Validation State: unverified Task: RT Announcement bits (2): 0-KRT 4-BGP_RT_Background AS path: I Communities: 64510:2 large:64510:200:2 172.16.3.0/24 (1 entry, 1 announced) *Static Preference: 5 Next hop type: Router, Next hop index: 580 Address: 0xb7a1270 Next-hop reference count: 9 Next hop: 10.0.0.2 via fe-1/2/0.0.0, selected Session Id: 0x140 State: < Active Int Ext > Local AS: 64510 Age: 4d 22:17:12 Validation State: unverified Task: RT Announcement bits (2): 0-KRT 4-BGP_RT_Background AS path: I Communities: 64510:3 172.16.4.0/24 (1 entry, 1 announced) *Static Preference: 5 Next hop type: Router, Next hop index: 580 Address: 0xb7a1270 Next-hop reference count: 9 Next hop: 10.0.0.2 via fe-1/2/0.0.0, selected Session Id: 0x140 State: < Active Int Ext > Local AS: 64510 Age: 4d 22:17:12 Validation State: unverified Task: RT Announcement bits (2): 0-KRT 4-BGP_RT_Background AS path: I Communities: 64510:4 . . .
Bedeutung
Die Ausgabe zeigt, dass die regulären Community- und großen Community-Werte an die Routen angehängt sind.
Die Communities sind an statische Routen angehängt, was veranschaulicht, dass sowohl reguläre als auch große Communities an statische Routen angehängt werden können.
Verifizieren von R3
Zweck
Überprüfen Sie auf Gerät R3 die Option 172.16. Routen in der Routing-Tabelle.
Action!
user@R3> show route protocol bgp match-prefix 172.16.* detail inet.0: 14 destinations, 14 routes (14 active, 0 holddown, 0 hidden) 172.16.1.0/24 (1 entry, 1 announced) *BGP Preference: 170/-101 Next hop type: Router, Next hop index: 581 Address: 0xb7a10f0 Next-hop reference count: 8 Source: 10.0.0.14 Next hop: 10.0.0.14 via fe-1/2/3.0, selected Session Id: 0x140 State: < Active Ext > Local AS: 64511 Peer AS: 64510 Age: 3d 16:36:18 Validation State: unverified Task: BGP_64510.10.0.0.14 Announcement bits (1): 0-KRT AS path: 64510 I Communities: 64510:1 large:64510:100:1 large:64511:1:1 Accepted Localpref: 100 Router ID: 192.168.0.1 172.16.2.0/24 (1 entry, 1 announced) *BGP Preference: 170/-101 Next hop type: Router, Next hop index: 581 Address: 0xb7a10f0 Next-hop reference count: 8 Source: 10.0.0.14 Next hop: 10.0.0.14 via fe-1/2/3.0, selected Session Id: 0x140 State: < Active Ext > Local AS: 64511 Peer AS: 64510 Age: 3d 16:36:18 Validation State: unverified Task: BGP_64510.10.0.0.14 Announcement bits (1): 0-KRT AS path: 64510 I Communities: 64510:2 large:7777:2:1 large:64510:200:2 Accepted Localpref: 100 Router ID: 192.168.0.1 172.16.3.0/24 (1 entry, 1 announced) *BGP Preference: 170/-101 Next hop type: Router, Next hop index: 581 Address: 0xb7a10f0 Next-hop reference count: 8 Source: 10.0.0.14 Next hop: 10.0.0.14 via fe-1/2/3.0, selected Session Id: 0x140 State: < Active Ext > Local AS: 64511 Peer AS: 64510 Age: 3d 16:36:18 Validation State: unverified Task: BGP_64510.10.0.0.14 Announcement bits (1): 0-KRT AS path: 64510 I Communities: 64510:3 large:64511:3:1 Accepted Localpref: 100 Router ID: 192.168.0.1 172.16.4.0/24 (1 entry, 1 announced) *BGP Preference: 170/-101 Next hop type: Router, Next hop index: 581 Address: 0xb7a10f0 Next-hop reference count: 8 Source: 10.0.0.14 Next hop: 10.0.0.14 via fe-1/2/3.0, selected Session Id: 0x140 State: < Active Ext > Local AS: 64511 Peer AS: 64510 Age: 3d 16:36:18 Validation State: unverified Task: BGP_64510.10.0.0.14 Announcement bits (1): 0-KRT AS path: 64510 I Communities: 64510:4 large:7777:4:1 Accepted Localpref: 100 Router ID: 192.168.0.1 . . .
Bedeutung
Die Ausgabe zeigt, dass die angekündigten regulären und großen Community-Werte an die Routen angehängt bleiben und dass die neuen großen Community-Werte hinzugefügt werden, wenn sie von R3 empfangen werden.