预配置,图上的rip改为eigrp,当然rip也行R1上的配置enconf tno ip do loline c 0no exec-tlogg synhost R1int lo0ip add 1.1.
.
预配置,图上的rip改为eigrp,当然rip也行
R1上的配置
en
conf t
no ip do lo
line c 0
no exec-t
logg syn
host R1
int lo0
ip add 1.1.1.1 255.255.255.0
int s2/1
ip add 12.0.0.1 255.255.255.0
no sh
R2上的配置
en
conf t
no ip do lo
line c 0
no exec-t
logg syn
host R2
int lo0
ip add 2.2.2.2 255.255.255.0
int s2/1
ip add 12.0.0.2 255.255.255.0
no sh
int s2/2
ip add 23.0.0.2 255.255.255.0
no sh
R3上的配置
en
conf t
no ip do lo
line c 0
no exec-t
logg syn
host R3
int lo0
ip add 3.3.3.3 255.255.255.0
int s2/1
ip add 23.0.0.3 255.255.255.0
no sh
int s2/2
ip add 34.0.0.3 255.255.255.0
no sh
R4上的配置
en
conf t
no ip do lo
line c 0
no exec-t
logg syn
host R4
int lo0
ip add 4.4.4.4 255.255.255.0
int s2/1
ip add 34.0.0.4 255.255.255.0
no sh
int s2/2
ip add 45.0.0.4 255.255.255.0
no sh
R5上的配置
en
conf t
no ip do lo
line c 0
no exec-t
logg syn
host R5
int lo0
ip add 5.5.5.5 255.255.255.0
int s2/2
ip add 45.0.0.5 255.255.255.0
no sh
实验过程:
第一步:先让R2、R3、R4上的EIGRP跑起来
R2(config)#router ei 11
R2(config-router)#net 2.2.2.2
R2(config-router)#net 23.0.0.2
R2(config-router)#no au
R3(config)#router ei 11
R3(config-router)#net 2.2.2.2
R3(config-router)#net 23.0.0.3
R3(config-router)#net 34.0.0.3
R3(config-router)#no au
R4(config)#router ei 11
R4(config-router)#net 4.4.4.4
R4(config-router)#net 34.0.0.4
R4(config-router)#no au
第二步:再让各路由器上的BPG跑起来
R1(config)#router b 100
R1(config-router)#nei 12.0.0.2 remot 200
R2(config)#router b 200
R2(config-router)#nei 12.0.0.1 remot 100
R2(config-router)#nei 3.3.3.3 remot 200
R2(config-router)#nei 3.3.3.3 up lo0
R2(config-router)#net 2.2.2.
R4(config)#router b 200
R4(config-router)#nei 3.3.3.3 remot 200
R4(config-router)#nei 3.3.3.3 up lo0
R4(config-router)#nei 45.0.0.5 remot 500
R5(config)#router b 500
R5(config-router)#nei 45.0.0.4 remot 200
我们在R3上用一种简单的方式
R3(config-router)#router b 200
R3(config-router)#nei libo peer-group
R3(config-router)#nei libo remot 200
R3(config-router)#nei libo up lo0
R3(config-router)#nei 2.2.2.2 peer libo
R3(config-router)#nei 4.4.4.4 peer libo
R3(config-router)#end
第三步:查看邻居建立情况
R1#sh ip b s
BGP router identifier 1.1.1.1, local AS number 100
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
12.0.0.2 4 200 10 10 1 0 0 00:06:31 0
R2#sh ip b s
BGP router identifier 2.2.2.2, local AS number 200
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
3.3.3.3 4 200 5 5 1 0 0 00:01:45 0
12.0.0.1 4 100 11 11 1 0 0 00:07:39 0
R2#
R2#
R3#sh ip b s
BGP router identifier 3.3.3.3, local AS number 200
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2.2.2.2 4 200 4 4 1 0 0 00:00:40 0
4.4.4.4 4 200 4 4 1 0 0 00:00:28 0
R4#sh ip b s
BGP router identifier 4.4.4.4, local AS number 200
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
3.3.3.3 4 200 4 4 1 0 0 00:00:34 0
45.0.0.5 4 500 7 7 1 0 0 00:03:54 0
R5#sh ip b s
BGP router identifier 5.5.5.5, local AS number 500
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
45.0.0.4 4 200 7 7 1 0 0 00:03:57 0
//从上面可以看出邻居关系是没有问题的
第四步:宣告出路由表中没有的路由
第四步分以下几步
第一步:先在R1上宣告自己的回环接口1.1.1.1并在R2上查看
R1(config-router)#net 1.1.1.0 mask 255.255.255.0
R2#sh ip b
BGP table version is 2, 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.1.0/24 12.0.0.1 0 0 100 i
第二步:再R5上做相同的配置
R5(config-router)#net 5.5.5.0 mask 255.255.255.0
第三步:查看R3上的bgp表
R3#sh ip b
BGP table version is 1, 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
- i1.1.1.0/24 12.0.0.1 0 100 0 100 i
- i5.5.5.0/24 45.0.0.5 0 100 0 500 i
//我们在这时可以看到上面的黑色字体,对R3来说是没有办法可以到达的,我们只有在R2和R4上指定下一跳为自己。因为对于R3来说,12.0.0.1和45.0.0.5在哪里,不知道。
R2(config-router)#nei 3.3.3.3 next-hop-self
R4(config-router)#nei 3.3.3.3 next-hop-self
指定后我们再来看看R3上的bgp表
R3#sh ip b
BGP table version is 3, 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
>i1.1.1.0/24 2.2.2.2 0 100 0 100 i
*>i5.5.5.0/24 4.4.4.4 0 100 0 500 i
//我们在这里看到的是正常的情况,也非常符合逻辑,思考一下,2.2.2.2和4.4.4.4是谁告诉给R3的?如果看到这里能回答出这个问题,说明bgp入门了。
第四步:在R2—R4上分别宣告自己的回环接口
R2(config-router)#net 2.2.2.0 mask 255.255.255.0
R3(config-router)#net 3.3.3.0 mask 255.255.255.0
R4(config-router)#net 4.4.4.0 mask 255.255.255.0
//但是我们在R1、R2上看到不到R4和R5的路由,相同的是我们在R4、R5上同样也看不到R1和R2上的路由,这就是我们遇到的路由黑洞,我们先用常用的路由反射的方法来解决这个问题(欢迎来到接着的第五步:)本实验的重点内容:
第五步:在R3上配置路由反射器
R3(config-router)#nei libo route-reflector-client
//由于我们使用的是peer-group组,所以只能像这样定义了
第六步:相邻的路由器上宣告自己的网段
R1(config-router)#net 12.0.0.0 mask 255.255.255.0
R3(config-router)#net 23.0.0.0 mask 255.255.255.0
R3(config-router)#net 34.0.0.0 mask 255.255.255.0
R5(config-router)#net 45.0.0.0 mask 255.255.255.0
//这里注意的是不要重复,也就是R2上不用宣告12.0.0.0了。
第七步:调试并排错
遇到的问题是R1和R2上的路由表不稳定,时有时无
开始想R3上肯定有问题,经查检R3无问题,在经查检R4上的水平分割未关闭
//上图显示水平分割未关闭
R4(config)#router ei 11
R4(config-router)#no au
//在R4上关闭水平分割
第八步:小小测试
R5#tclsh
R5(tcl)#foreach ip {
+>(tcl)#1.1.1.1
+>(tcl)#2.2.2.2
+>(tcl)#3.3.3.3
+>(tcl)#4.4.4.4
+>(tcl)#5.5.5.5
+>(tcl)#12.0.0.1
+>(tcl)#12.0.0.2
+>(tcl)#23.0.0.2
+>(tcl)#23.0.0.3
+>(tcl)#34.0.0.3
+>(tcl)#45.0.0.4
+>(tcl)#45.0.0.5
+>(tcl)#34.0.0.4
+>(tcl)#} {ping $ip}
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/132/288 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/88/136 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/61/100 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/41/88 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 44/76/116 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/94/136 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/96/192 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.0.0.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 56/84/104 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 34.0.0.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/66/92 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 45.0.0.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/48/108 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 45.0.0.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/72/116 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 34.0.0.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/43/56 ms