【实验要求】
按照下图配置设备,保证204.12.1.0/24 的网络能够与155.1.5.0/24 的网络互通,通过在R1与R2之间配置 GRE tunnel 完成此实验
.
【实验拓扑】
【实验分析】
此实验的目的是验证:AS2能够将从AS3学习到的BGP路由通告给AS1,同样能够将从AS1学习到的BGP路由通告给AS3。
此类实验在于考察BGP的同步,bgp的同步规定,ibgp不把从bgp学习到的路由通告给其他AS;如果要进行通告,需要把同步关闭。
但是在非BGP路由器是不传输BGP路由的,我们上一节的实验是通过将BGP重定向到IGP实现的,本实验的方法是,在iBGP路由器之间建立隧道,这样就和非BGP路由器(R3)没有关系了。
【实验配置】
R1:
interface Tunnel0
ip address 155.1.12.1 255.255.255.0
tunnel source 155.1.13.1
此处也可以用tunnel source s0/0 来代替
tunnel destination 155.1.23.2
!
interface FastEthernet0/0
ip address 155.1.146.1 255.255.255.0
!
interface Serial0/0
ip address 155.1.13.1 255.255.255.0
!
router eigrp 2
network 155.1.13.1 0.0.0.0
no auto-summary
!
router bgp 2
neighbor 155.1.12.2 remote-as 2
neighbor 155.1.12.2 next-hop-self
neighbor 155.1.146.4 remote-as 3
R2:
interface Tunnel0
ip address 155.1.12.2 255.255.255.0
tunnel source 155.1.23.2
此处也可以用tunnel source s0/0 来代替
tunnel destination 155.1.13.1
!
interface FastEthernet0/0
ip address 192.10.1.2 255.255.255.0
!
interface Serial0/1
ip address 155.1.0.2 255.255.255.0
encapsulation frame-relay
clock rate 2000000
frame-relay map ip 155.1.0.5 205 broadcast
no frame-relay inverse-arp
!
interface Serial0/0
ip address 155.1.23.2 255.255.255.0
!
router eigrp 2
network 155.1.23.2 0.0.0.0
no auto-summary
!
router bgp 2
neighbor 155.1.0.5 remote-as 1
neighbor 155.1.12.1 remote-as 2
neighbor 155.1.12.1 next-hop-self
R3:
interface Serial0/0
ip address 155.1.13.3 255.255.255.0
clockrate 64000
!
interface Serial0/1
ip address 155.1.23.3 255.255.255.0
clockrate 64000
!
router eigrp 2
network 155.1.13.3 0.0.0.0
network 155.1.23.3 0.0.0.0
no auto-summary
R4#
interface Loopback0
ip address 204.12.1.4 255.255.255.0
interface FastEthernet0/0
ip address 155.1.146.4 255.255.255.0
!
router bgp 3
network 204.12.1.0
neighbor 155.1.146.1 remote-as 2
R5#
interface Serial0/0
ip address 155.1.0.5 255.255.255.0
encapsulation frame-relay
frame-relay map ip 155.1.0.2 502 broadcast
!
interface Loopback0
ip address 155.1.5.5 255.255.255.0
!
router bgp 1
network 155.1.5.0 mask 255.255.255.0
neighbor 155.1.0.2 remote-as 2
【实验验证】
上面为什么没有配置同步?因为bgp同步默认是关闭的,所以不需要配置
R4#ping 155.1.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 155.1.5.5, timeout is 2 seconds:
.....
R4直接pingR5的155.1.5.5 地址不通,为什么?
Success rate is 0 percent (0/5)
R4#ping 155.1.5.5 source 204.12.1.4 通过指定source再ping就能通,为什么?
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 155.1.5.5, timeout is 2 seconds:
Packet sent with a source address of 204.12.1.4
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/56/88 ms
R4#traceroute 155.1.5.5 source 204.12.1.4
Type escape sequence to abort.
Tracing the route to 155.1.5.5
1 155.1.146.1 40 msec 36 msec 56 msec
2 155.1.12.2 36 msec 56 msec 44 msec
3 155.1.0.5 44 msec 124 msec *
R4#show ip bgp
BGP table version is 3, local router ID is 204.12.1.1
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
*> 155.1.5.0/24 155.1.146.1 0 2 1 i
*> 204.12.1.0 0.0.0.0 0 32768 i
R4#show ip route
C 204.12.1.0/24 is directly connected, Loopback0
155.1.0.0/24 is subnetted, 2 subnets
C 155.1.146.0 is directly connected, FastEthernet0/0
B 155.1.5.0 [20/0] via 155.1.146.1, 01:06:59
R1#show ip route
B 204.12.1.0/24 [20/0] via 155.1.146.4, 01:06:58
155.1.0.0/24 is subnetted, 5 subnets
C 155.1.146.0 is directly connected, FastEthernet0/0
D 155.1.23.0 [90/2681856] via 155.1.13.3, 01:25:05, Serial0/0
C 155.1.12.0 is directly connected, Tunnel1
C 155.1.13.0 is directly connected, Serial0/0
B 155.1.5.0 [200/0] via 155.1.12.2, 01:05:23
R1#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*>i155.1.5.0/24 155.1.12.2 0 100 0 1 i
*> 204.12.1.0 155.1.146.4 0 0 3 i
R2#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 155.1.5.0/24 155.1.0.5 0 0 1 i
*>i204.12.1.0 155.1.12.1 0 100 0 3 i
R3#show ip route
155.1.0.0/24 is subnetted, 2 subnets
C 155.1.23.0 is directly connected, Serial0/1
C 155.1.13.0 is directly connected, Serial0/0
【知识点】
注意在R1与R2上配置了neighbor *.*.*.* next-hop-self ,如果不配置这条路由R4与R5之间是不通的。
原因是:
当EBGP路由器把路由传给EBGP邻居时,这个路由的下一跳会改成自己的更新源。
但是把路由传给ibgp邻居,不会改变路由的下一跳。
EBGP iBGP
A—-----------—B—-------------—C(A和B是EBGP邻居关系,B和C是IBGP邻居关系,)
当B从A收到一条路由传给C的时候,如果不加上next-hop-self ,那么这条路由的更新源任然是A,就会造成不可达,
所以在默认的时候,把EBGP接收到的路由传给自己的IBGP邻居,往往会出现下一跳不可达。
因此要对自己的ibgp邻居做 Neighbor a.b.c.d next-hop-self 命令。
配置的方法
第一步配置tunnel编号
interface tunnel Tunnel_number
第二步:配置source
tunnel source 本地IP地址或者本地接口
第三步:配置destination
tunnel destination 对端IP地址
例如:下图需要搭建R1到R2之间tunnel
配置方法:
R1:
interface tunnel 1
ip add 3.3.3.1 255.255.255.0
tunnel source f0/0
tunnel destination 2.2.2.2
R2:
interface tunnel 1
ip add 3.3.3.2 255.255.255.0
tunnel source 2.2.2.2
tunnel destination 1.1.1.1