扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
要求:对于as2内部的用户,去往1.1.0.0/24和1.1.2.0/24默认从r2走,去往1.1.2.0/24和1.1.3.0/24默认从r3走,并且保证r2或r3任意一台down掉,网络仍然那保持连通性。
option 3就是使用MED,和ospf的cost没什么区别,只是叫法不同。
R1
hostname R1
!
interface Loopback0
ip address 1.1.0.1 255.255.255.0
!
interface Loopback1
ip address 1.1.1.1 255.255.255.0
!
interface Loopback2
ip address 1.1.2.1 255.255.255.0
!
interface Loopback3
ip address 1.1.3.1 255.255.255.0
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
speed 100
full-duplex
!
interface FastEthernet0/1
ip address 192.168.13.1 255.255.255.0
speed 100
full-duplex
!
router bgp 10
no synchronization
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 1.1.0.0 mask 255.255.255.0
network 1.1.1.0 mask 255.255.255.0
network 1.1.2.0 mask 255.255.255.0
network 1.1.3.0 mask 255.255.255.0
neighbor 192.168.12.2 remote-as 20
neighbor 192.168.12.2 soft-reconfiguration inbound
neighbor 192.168.12.2 route-map r2 out
neighbor 192.168.13.3 remote-as 20
neighbor 192.168.13.3 soft-reconfiguration inbound
neighbor 192.168.13.3 route-map r3 out
no auto-summary
!
ip prefix-list detail1 seq 5 permit 1.1.0.0/24
ip prefix-list detail1 seq 10 permit 1.1.1.0/24
!
ip prefix-list detail2 seq 5 permit 1.1.2.0/24
ip prefix-list detail2 seq 10 permit 1.1.3.0/24
!
route-map r2 permit 10
match ip address prefix-list detail1
set metric 50
!
route-map r2 permit 20
match ip address prefix-list detail2
set metric 100
!
route-map r2 permit 30
!
route-map r3 permit 10
match ip address prefix-list detail2
set metric 50
!
route-map r3 permit 20
match ip address prefix-list detail1
set metric 100
!
route-map r3 permit 30
!
end
R2
hostname R2
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
speed 100
full-duplex
!
interface FastEthernet0/1
ip address 192.168.23.2 255.255.255.0
speed 100
full-duplex
!
router bgp 20
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
network 192.168.23.0
neighbor 192.168.12.1 remote-as 10
neighbor 192.168.12.1 soft-reconfiguration inbound
neighbor 192.168.23.3 remote-as 20
neighbor 192.168.23.3 next-hop-self
neighbor 192.168.23.3 soft-reconfiguration inbound
no auto-summary
!
end
R3
hostname R3
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.13.3 255.255.255.0
speed 100
full-duplex
!
interface FastEthernet0/1
ip address 192.168.23.3 255.255.255.0
speed 100
full-duplex
!
router bgp 20
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
network 192.168.23.0
neighbor 192.168.13.1 remote-as 10
neighbor 192.168.13.1 soft-reconfiguration inbound
neighbor 192.168.23.2 remote-as 20
neighbor 192.168.23.2 next-hop-self
neighbor 192.168.23.2 soft-reconfiguration inbound
no auto-summary
!
end
verification
R2#sho ip bgp
BGP table version is 22, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, >best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.0.0/24 192.168.12.1 50 0 10 i
*> 1.1.1.0/24 192.168.12.1 50 0 10 i
*>i1.1.2.0/24 192.168.23.3 50 100 0 10 i
* 192.168.12.1 100 0 10 i
*>i1.1.3.0/24 192.168.23.3 50 100 0 10 i
* 192.168.12.1 100 0 10 i
*> 192.168.23.0 0.0.0.0 0 32768 i
* i 192.168.23.3 0 100 0 i
R2#sho ip route 1.1.3.0
Routing entry for 1.1.3.0/24
Known via "bgp 20", distance 200, metric 0
Tag 10, type internal
Last updatefrom 192.168.23.3 00:33:57 ago
Routing Descriptor Blocks:
* 192.168.23.3, from 192.168.23.3, 00:33:57 ago
Route metric is 0, traffic share count is 1
AS Hops 1
Route tag 10
R2#tra
R2#traceroute 1.1.3.1 pro
R2#traceroute 1.1.3.1 probe 1
Type escape sequence to abort.
Tracing the route to 1.1.3.1
1 192.168.23.3 128 msec
2 192.168.13.1 300 msec
R3#sho ip route 1.1.1.0
Routing entry for 1.1.1.0/24
Known via "bgp 20", distance 200, metric 0
Tag 10, type internal
Last update from 192.168.23.2 00:33:49 ago
Routing Descriptor Blocks:
* 192.168.23.2, from 192.168.23.2, 00:33:49 ago
Route metric is 0, traffic share count is 1
AS Hops 1
Route tag 10
R3#tra
R3#traceroute 1.1.1.1 pro
R3#traceroute 1.1.1.1 probe 1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
1 192.168.23.2 48 msec
2 192.168.12.1 360 msec
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。