簡介
本文檔介紹用於將預設路由通告給基於Cisco Nexus NX-OS的交換機上的BGP鄰居的配置邊界網關協定。
必要條件
需求
思科建議事先瞭解以下主題:
- Nexus NX-OS軟體
- 路由通訊協定,尤其是邊界閘道通訊協定(BGP)。
採用元件
本文檔中的資訊基於採用NX-OS版本7.3(0)D1(1)的Cisco Nexus 7000。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
設定
網路指令
network 0.0.0.0/0命令將預設路由注入BGP RIB (BGP路由資訊庫)。
前提是透過任何其他路由協定在路由表中使用預設路由,或者手動配置靜態路由。
進入BGP RIB後,預設路由將通告給所有BGP鄰居,除非每個鄰居配置的出站過濾器明確拒絕。
show running-config輸出中顯示的BGP配置。
Nexus BGP配置 |
Nexus# show running-config bgp
!Command: show running-config bgp
!Time: Tue Dec 4 01:27:43 2018
version 7.3(0)D1(1)
feature bgp
router bgp 64512
address-family ipv4 unicast
network 0.0.0.0/0
neighbor 10.1.3.3
remote-as 64512
address-family ipv4 unicast
|
在本示例中,Nexus從增強型內部網關路由協定(EIGRP)協定接收預設路由。因此,Nexus路由表顯示預設路由可以透過EIGRP使用。
Nexus路由表 |
Nexus# show ip route 0.0.0.0 IP Route Table for VRF "default" '*' denotes best ucast next-hop '**' denotes best mcast next-hop '[x/y]' denotes [preference/metric] '%<string>' in via output denotes VRF <string>
0.0.0.0/0, ubest/mbest: 1/0 *via 10.1.2.2, Eth2/1, [170/2816], 00:00:50, eigrp-1, external Nexus# |
BGP RIB將0.0.0.0/0顯示為滿足前提條件的有效和最佳路徑。預設路由在路由表中,而network 0.0.0.0/0命令在BGP配置部分配置。
Nexus BGP肋(BGP表) |
Nexus# show bgp ipv4 unicast
BGP routing table information for VRF default, address family IPv4 Unicast
BGP table version is 13, local router ID is 10.255.255.1
Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best
Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i
njected
Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup
Network Next Hop Metric LocPrf Weight Path
*>l0.0.0.0/0 0.0.0.0 100 32768 i
|
advertised-routes引數顯示預設路由會通告給BGP對等體10.1.3.3。
向特定BGP對等體通告的Nexus BGP路由 |
Nexus# show bgp ipv4 unicast neighbors 10.1.3.3 advertised-routes
Peer 10.1.3.3 routes for address family IPv4 Unicast:
BGP table version is 13, local router ID is 10.255.255.1
Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best
Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i
njected
Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup
Network Next Hop Metric LocPrf Weight Path
*>l0.0.0.0/0 0.0.0.0 100 32768 i
|
Redistribute和Default-Information Originate命令
在BGP進程下配置的redistribute命令將存在於路由表中由特定源路由協定(且由路由對映允許)存在的所有路由注入到BGP RIB中,預設路由除外。
此外,要允許從BGP RIB中的源路由協定安裝預設路由,需要命令default-information originate。
進入BGP RIB後,預設路由將通告給所有BGP鄰居,除非每個鄰居配置的出站過濾器明確拒絕。
BGP配置部分顯示了redistribute EIGRP和default-information originate in place。
Nexus BGP配置 |
Nexus# show running-config bgp
!Command: show running-config bgp
!Time: Tue Dec 4 01:33:41 2018
version 7.3(0)D1(1)
feature bgp
router bgp 64512
address-family ipv4 unicast
redistribute eigrp 1 route-map PERMIT-ALL
default-information originate
neighbor 10.1.3.3
remote-as 64512
address-family ipv4 unicast
A route map with no match entry permits all routes.
route-map PERMIT-ALL permit 10 |
在本示例中,Nexus從EIGRP協定接收預設路由。因此,Nexus路由表顯示預設路由可以透過EIGRP使用。
Nexus路由表 |
Nexus# show ip route eigrp
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>
0.0.0.0/0, ubest/mbest: 1/0
*via 10.1.2.2, Eth2/1, [170/2816], 00:07:19, eigrp-1, external
192.168.2.0/24, ubest/mbest: 1/0
*via 10.1.2.2, Eth2/1, [170/2816], 00:00:07, eigrp-1, external
|
BGP RIB將0.0.0.0/0顯示為有效且符合先決條件後的最佳路徑。在BGP中,已從源路由協定重分配了預設路由,並在BGP配置部分配置了default-information originate命令。
Nexus BGP肋(BGP表) |
Nexus# show bgp ipv4 unicast
BGP routing table information for VRF default, address family IPv4 Unicast
BGP table version is 17, local router ID is 10.255.255.1
Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best
Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i
njected
Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup
Network Next Hop Metric LocPrf Weight Path
*>r0.0.0.0/0 0.0.0.0 2816 100 32768 ?
*>r192.168.2.0/24 0.0.0.0 2816 100 32768 ?
|
advertised-routes引數顯示預設路由會通告給BGP對等體10.1.3.3。
向特定BGP對等體通告的Nexus BGP路由 |
Nexus# show bgp ipv4 unicast neighbors 10.1.3.3 advertised-routes
Peer 10.1.3.3 routes for address family IPv4 Unicast:
BGP table version is 17, local router ID is 10.255.255.1
Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best
Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i
njected
Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup
Network Next Hop Metric LocPrf Weight Path
*>r0.0.0.0/0 0.0.0.0 2816 100 32768 ?
*>r192.168.2.0/24 0.0.0.0 2816 100 32768 ?
|
如果BGP配置中沒有default-information originate命令,則BGP RIB不會安裝預設路由。
BGP配置部分接下來僅顯示已部署EIGRP的再分配。
Nexus BGP配置 |
Nexus# show run bgp
!Command: show running-config bgp
!Time: Tue Dec 4 01:39:30 2018
version 7.3(0)D1(1)
feature bgp
router bgp 64512
address-family ipv4 unicast
redistribute eigrp 1 route-map PERMIT-ALL
neighbor 10.1.3.3
remote-as 64512
address-family ipv4 unicast
A route-map with no match entry permits all routes.
route-map PERMIT-ALL permit 10 |
路由表輸出顯示EIGRP協定提供預設路由。
Nexus路由表 |
Nexus# show ip route eigrp
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>
0.0.0.0/0, ubest/mbest: 1/0
*via 10.1.2.2, Eth2/1, [170/2816], 00:07:19, eigrp-1, external
192.168.2.0/24, ubest/mbest: 1/0
*via 10.1.2.2, Eth2/1, [170/2816], 00:00:07, eigrp-1, external
|
在使用no default-information originate命令時,BGP RIB不安裝0.0.0.0/0網路字首。
Nexus BGP RIB (BGP表) |
Nexus# show bgp ipv4 unicast
BGP routing table information for VRF default, address family IPv4 Unicast
BGP table version is 18, local router ID is 10.255.255.1
Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best
Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i
njected
Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup
Network Next Hop Metric LocPrf Weight Path
*>r192.168.2.0/24 0.0.0.0 2816 100 32768 ?
|
注意:在Nexus 7000系列的NX-OS版本6.2(2)和Nexus 5000系列的6.0(2)N3(1)版本之前,不需要使用default-information originate命令。也用於透過redistribute命令注入BGP RIB中的預設路由。
Default-Originate命令
default-originate命令是根據每個BGP鄰居進行配置的。此命令會人工生成預設路由,並只將其通告給特定的BGP對等體。
預設路由不需要存在於路由表中,也不會在BGP RIB中建立。
default-originate命令基於每個鄰居進行配置。
Nexus BGP配置 |
Nexus# show running-config bgp
!Command: show running-config bgp !Time: Tue Dec 4 02:22:43 2018
version 7.3(0)D1(1) feature bgp
router bgp 64512 address-family ipv4 unicast network 192.168.1.0/24 neighbor 10.1.3.3 remote-as 64512 address-family ipv4 unicast default-originate |
路由表中不需要預設路由。
Nexus路由表 |
Nexus# show ip route 0.0.0.0
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>
Nexus# |
BGP表中未建立0.0.0.0/0條目。
Nexus BGP RIB (BGP表) |
Nexus# show bgp ipv4 unicast
BGP routing table information for VRF default, address family IPv4 Unicast
BGP table version is 20, local router ID is 10.255.255.1
Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best
Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i
njected
Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup
Network Next Hop Metric LocPrf Weight Path
*>l192.168.1.0/24 0.0.0.0 100 32768 i
|
在通告給BGP對等體10.1.3.3的路由中可以找到始發預設網路0.0.0.0/0條目
向特定BGP對等體通告的Nexus BGP路由 |
Nexus# show bgp ipv4 unicast neighbors 10.1.3.3 advertised-routes
Peer 10.1.3.3 routes for address family IPv4 Unicast:
BGP table version is 20, local router ID is 10.255.255.1
Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best
Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i
njected
Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup
Originating default network 0.0.0.0/0
Network Next Hop Metric LocPrf Weight Path
*>l192.168.1.0/24 0.0.0.0 100 32768 i
|
或者,default-originate命令可以將路由對映用作引數,以有條件地通告預設路由。
可選的Default-Originate Route-Map |
Nexus(config-router-neighbor-af)# default-originate ?
<CR>
route-map Route-map to specify criteria for originating default |
路由對映需要與路由表中安裝的路由匹配,以便使default-originate向BGP對等體通告default-route。
Nexus路由表 |
Nexus# show ip route 192.168.3.0
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>
Route not found
|
在這種情況下,名為ADVERTISE-DEFAULT-IF的路由對映引用一個名為NETWORKS的字首清單和後一個192.168.3.0/24網路字首,這些字首必須存在於路由表中才能通告預設路由。
Nexus BGP配置 |
ip prefix-list NETWORKS seq 5 permit 192.168.3.0/24 !
route-map ADVERTISE-DEFAULT-IF permit 10
match ip address prefix-list NETWORKS ! router bgp 64512 address-family ipv4 unicast network 192.168.1.0/24 neighbor 10.1.3.3 remote-as 64512 address-family ipv4 unicast default-originate route-map ADVERTISE-DEFAULT-IF |
由於192.168.3.0/24不在路由表中,因此不會通告預設路由。
向特定BGP對等體通告的Nexus BGP路由 |
Nexus# show bgp ipv4 unicast neighbors 10.1.3.3 advertised-routes
Peer 10.1.3.3 routes for address family IPv4 Unicast:
BGP table version is 20, local router ID is 10.255.255.1
Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best
Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i
njected
Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup
Network Next Hop Metric LocPrf Weight Path
*>l192.168.1.0/24 0.0.0.0 100 32768 i
|