
ISP -通过default route将eBGP发送到sw1/2
sw1 -配置
router ospf 100
network 0.0.0.0 255.255.255.255 area 0
default-information originate always
!
router bgp 100
bgp log-neighbor-changes
network 70.70.70.0 mask 255.255.255.0
timers bgp 10 30
redistribute ospf 100
neighbor 74.74.74.1 remote-as 200
neighbor 192.168.1.19 remote-as 100
neighbor 192.168.1.19 update-source Loopback0
neighbor 192.168.1.19 next-hop-selfsw2 -配置
router ospf 100
network 0.0.0.0 255.255.255.255 area 0
default-information originate always
!
router bgp 100
bgp log-neighbor-changes
network 70.70.70.0 mask 255.255.255.0
timers bgp 10 30
redistribute ospf 100
neighbor 64.64.64.1 remote-as 200
neighbor 192.168.1.20 remote-as 100
neighbor 192.168.1.20 update-source Loopback0
neighbor 192.168.1.20 next-hop-self
!sw3 -配置
router ospf 100
network 0.0.0.0 255.255.255.255 area 0问题:
在这一点上一切正常,我的路由表在sw3上如下所示
sw1 - 10.0.0.5
sw2 - 10.0.0.10你可以看到它的负载平衡流量。
Gateway of last resort is 10.0.0.10 to network 0.0.0.0
O*E2 0.0.0.0/0 [110/1] via 10.0.0.10, 00:35:37, GigabitEthernet0/3
[110/1] via 10.0.0.5, 00:35:47, GigabitEthernet0/1现在我继续关闭sw1接口A (ISP侧接口)。
然后我在sw3上看到下面的路由表,如果您注意到我的默认网关现在是10.0.0.5,10.0.0.10消失了,那么现在我的流量就像这样
sw3-->sw1-->sw2-->ISP
Gateway of last resort is 10.0.0.5 to network 0.0.0.0
O*E2 0.0.0.0/0 [110/1] via 10.0.0.5, 00:39:04, GigabitEthernet0/1
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks有人能解释为什么OSPF在这里选择长路径而不是向10.0.0.10 (sw2)发送流量(sw1)吗?
OSPF数据库输出:
sw1#sh ip ospf database
OSPF Router with ID (200.200.200.1) (Process ID 100)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
70.70.70.1 70.70.70.1 219 0x80000004 0x00756F 3
192.168.1.19 192.168.1.19 1320 0x80000005 0x007C09 4
200.200.200.1 200.200.200.1 22 0x80000007 0x006B44 5
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
10.0.0.1 200.200.200.1 240 0x80000002 0x004BB1
10.0.0.5 200.200.200.1 240 0x80000002 0x00EE3B
10.0.0.10 192.168.1.19 198 0x80000002 0x00855B
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
0.0.0.0 192.168.1.19 1317 0x80000001 0x00C946 100
0.0.0.0 200.200.200.1 13 0x80000001 0x001369 100BGP命令输出:192.168.1.19和192.168.1.20是iBGP的回送接口
sw1 - BGP
sw1#sh ip bgp
BGP table version is 43, local router ID is 200.200.200.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0 74.201.98.1 0 0 200 ?
* i 192.168.1.19 0 100 0 200 ?
* i 10.0.0.0/30 192.168.1.19 0 100 0 ?
*> 0.0.0.0 0 32768 ?
* i 10.0.0.4/30 192.168.1.19 2 100 0 ?
*> 0.0.0.0 0 32768 ?
*> 10.0.0.8/30 10.0.0.6 2 32768 ?
* i 192.168.1.19 0 100 0 ?
*> 64.64.64.0/30 10.0.0.2 2 32768 ?
* i 192.168.1.19 0 100 0 ?
* i 70.64.196.0/24 192.168.1.19 2 100 0 ?
*> 10.0.0.6 2 32768 ?
* i 74.74.74.0/30 192.168.1.19 2 100 0 ?
*> 0.0.0.0 0 32768 ?
Network Next Hop Metric LocPrf Weight Path
r>i 192.168.1.19/32 192.168.1.19 0 100 0 ?
*> 192.168.1.20/32 0.0.0.0 0 32768 ?
*> 200.200.200.0 0.0.0.0 0 32768 ?
r>i 200.200.200.1/32 192.168.1.19 2 100 0 ?
*> 202.1.1.0 74.74.74.1 0 0 200 i
* i 192.168.1.19 0 100 0 200 i
*> 202.202.202.0 74.74.74.1 0 0 200 i
* i 192.168.1.19 0 100 0 200 isw2 - BGP
sw2#sh ip bgp
BGP table version is 37, local router ID is 192.168.1.19
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
* i 0.0.0.0 192.168.1.20 0 100 0 200 ?
*> 64.64.64.1 0 0 200 ?
* i 10.0.0.0/30 192.168.1.20 0 100 0 ?
*> 0.0.0.0 0 32768 ?
*> 10.0.0.4/30 10.0.0.9 2 32768 ?
* i 192.168.1.20 0 100 0 ?
* i 10.0.0.8/30 192.168.1.20 2 100 0 ?
*> 0.0.0.0 0 32768 ?
* i 64.64.64.0/30 192.168.1.20 2 100 0 ?
*> 0.0.0.0 0 32768 ?
* i 70.70.70.0/24 192.168.1.20 2 100 0 ?
*> 10.0.0.9 2 32768 ?
*> 74.74.74.0/30 10.0.0.1 2 32768 ?
* i 192.168.1.20 0 100 0 ?
Network Next Hop Metric LocPrf Weight Path
*> 192.168.1.19/32 0.0.0.0 0 32768 ?
r>i 192.168.1.20/32 192.168.1.20 0 100 0 ?
*>i 200.200.200.0 192.168.1.20 0 100 0 ?
*> 200.200.200.1/32 10.0.0.1 2 32768 ?
* i 202.1.1.0 192.168.1.20 0 100 0 200 i
*> 64.64.64.1 0 0 200 i
* i 202.202.202.0 192.168.1.20 0 100 0 200 i
*> 64.64.64.1 0 0 200 i发布于 2018-03-05 17:55:12
我认为您的问题在于always关键字:
default-information originate always这将始终从该路由器注入一个默认路由到OSPF。由于我从以前的问题/聊天中了解到您的情况,您将收到ISP的默认路由。如果不使用always关键字,则路由器只有在路由表中已经存在时才会将默认路由注入OSPF:
default-information originate如果您正在从ISP接收默认路由,那么当连接到ISP时,您的路由器只会将来自ISP的默认路由注入OSPF。
https://networkengineering.stackexchange.com/questions/48850
复制相似问题