在上一个IGP中做下边的实验。
实验要求:
1、 EBGP:R3---R2 R4---R3 R2---R1
2、 IBGP:R2---R4 R4---R5 R2---R5
3、 所有 BGP 邻居关系建立都使用 LO0 做更新源(R2—R1 除外) 。使用 X。X。X。
X 作为 router-id
4、 R3 公告 lo20:200.200.1.0/24,R5 学习这条路由要优选 R2。
5、 R5 公告 lo20:200.200.5.0/24,AS200的管理员希望 AS100 优选来自 R2 的路由访问
此目的网络。
6、 R1 公告 lo20:200.200.4.0/24,这条路由只能在 AS200 内传递。
实验拓扑:
配置要点
R1:router bgp 400
no synchronization
bgp log-neighbor-changes
network 200.200.4.0
neighbor 12.1.1.2 remote-as 200
no auto-summary
R2:router bgp 200
no synchronization
bgp log-neighbor-changes
neighbor 3.3.3.3 remote-as 100
neighbor 3.3.3.3 ebgp-multihop 10
neighbor 3.3.3.3 update-source Loopback10
neighbor 3.3.3.3 route-map A out
neighbor 5.5.5.5 remote-as 200
neighbor 5.5.5.5 update-source Loopback10
neighbor 5.5.5.5 next-hop-self
neighbor 12.1.1.1 remote-as 400
no auto-summary
ip proute-map A deny 10
match ip address prefix-list A
route-map A permit 20refix-list A seq 5 permit 200.200.4.0/24
R3:router bgp 100
no synchronization
bgp log-neighbor-changes
network 200.200.1.0
neighbor 2.2.2.2 remote-as 200
neighbor 2.2.2.2 ebgp-multihop 10
neighbor 2.2.2.2 update-source Loopback10
neighbor 4.4.4.4 remote-as 200
neighbor 4.4.4.4 ebgp-multihop 10
neighbor 4.4.4.4 update-source Loopback10
no auto-summary
R4:router bgp 200
no synchronization
bgp log-neighbor-changes
neighbor 3.3.3.3 remote-as 100
neighbor 3.3.3.3 ebgp-multihop 10
neighbor 3.3.3.3 update-source Loopback10
neighbor 5.5.5.5 remote-as 200
neighbor 5.5.5.5 update-source Loopback10
neighbor 5.5.5.5 next-hop-self
no auto-summary
R5:router bgp 200
no synchronization
bgp log-neighbor-changes
network 200.200.5.0
neighbor 2.2.2.2 remote-as 200
neighbor 2.2.2.2 update-source Loopback10
neighbor 2.2.2.2 next-hop-self
neighbor 4.4.4.4 remote-as 200
neighbor 4.4.4.4 update-source Loopback10
no auto-summary
测试:
分别查看R3和R5的BGP表:
R5#show ip bgp
BGP table version is 6, local router ID is 5.5.5.5
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
*>i200.200.1.0 2.2.2.2 0 100 0 100 i
* i 4.4.4.4 0 100 0 100 i
*>i200.200.4.0 2.2.2.2 0 100 0 400 i
*> 200.200.5.0 0.0.0.0 0 32768 i
R3# show ip bgp
BGP table version is 11, local router ID is 3.3.3.3
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
*> 200.200.1.0 0.0.0.0 0 32768 i
*> 200.200.5.0 2.2.2.2 0 200 i
* 4.4.4.4 0 200 i
看下R5的路由表:
R5#show ip route
B 200.200.4.0/24 [200/0] via 2.2.2.2, 00:21:33
34.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D EX 34.1.1.3/32 [170/1657856] via 45.1.1.4, 01:33:48, Serial1/0
[170/1657856] via 54.1.1.4, 01:33:48, FastEthernet0/0
D EX 34.1.1.0/24 [170/1657856] via 45.1.1.4, 01:33:48, Serial1/0
[170/1657856] via 54.1.1.4, 01:33:48, FastEthernet0/0
C 200.200.5.0/24 is directly connected, Loopback20
2.0.0.0/24 is subnetted, 4 subnets
D EX 2.2.1.0 [170/1657856] via 45.1.1.4, 01:33:32, Serial1/0
[170/1657856] via 54.1.1.4, 01:33:32, FastEthernet0/0
D EX 2.2.2.0 [170/1657856] via 45.1.1.4, 01:33:32, Serial1/0
[170/1657856] via 54.1.1.4, 01:33:32, FastEthernet0/0
D EX 2.2.3.0 [170/1657856] via 45.1.1.4, 01:33:32, Serial1/0
[170/1657856] via 54.1.1.4, 01:33:32, FastEthernet0/0
D EX 2.2.4.0 [170/1657856] via 45.1.1.4, 01:33:33, Serial1/0
[170/1657856] via 54.1.1.4, 01:33:33, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
D EX 3.3.3.3 [170/1657856] via 45.1.1.4, 01:33:33, Serial1/0
[170/1657856] via 54.1.1.4, 01:33:33, FastEthernet0/0
4.0.0.0/24 is subnetted, 1 subnets
D EX 4.4.4.0 [170/1657856] via 45.1.1.4, 03:07:09, Serial1/0
[170/1657856] via 54.1.1.4, 03:07:09, FastEthernet0/0
5.0.0.0/24 is subnetted, 1 subnets
C 5.5.5.0 is directly connected, Loopback10
B 200.200.1.0/24 [200/0] via 2.2.2.2, 00:21:33
54.0.0.0/24 is subnetted, 1 subnets
C 54.1.1.0 is directly connected, FastEthernet0/0
23.0.0.0/24 is subnetted, 1 subnets
D EX 23.1.1.0 [170/1657856] via 45.1.1.4, 01:33:33, Serial1/0
[170/1657856] via 54.1.1.4, 01:33:33, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
D EX 12.1.1.0 [170/1657856] via 45.1.1.4, 01:33:33, Serial1/0
[170/1657856] via 54.1.1.4, 01:33:33, FastEthernet0/0
45.0.0.0/24 is subnetted, 1 subnets
C 45.1.1.0 is directly connected, Serial1/0
虽然路由表以及BGP表都可以看到路由,但是相互间依然PING不通,IGP中根本没有路由。
R5#ping 200.200.1.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.200.1.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 212/277/344 ms
R5#ping 200.200.4.1 source 200.200.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.200.4.1, timeout is 2 seconds:
Packet sent with a source address of 200.200.5.5
.....
Success rate is 0 percent (0/5)
看R1路由表:
R1#show ip route
C 200.200.4.0/24 is directly connected, Loopback20
1.0.0.0/24 is subnetted, 6 subnets
C 1.1.1.0 is directly connected, Loopback10
C 1.1.2.0 is directly connected, Loopback1
C 1.1.3.0 is directly connected, Loopback2
C 1.1.4.0 is directly connected, Loopback3
C 1.1.11.0 is directly connected, Loopback11
C 1.1.22.0 is directly connected, Loopback12
B 200.200.5.0/24 [20/0] via 12.1.1.2, 00:27:50
B 200.200.1.0/24 [20/0] via 12.1.1.2, 00:39:12
11.0.0.0/24 is subnetted, 1 subnets
C 11.11.11.0 is directly connected, Loopback0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/1