1、做基本配置

enabl 
conf t

hostname r5
no ip domain-lookup
ip subnet-zero


line con  0 
password 123
logg sy
exec-t 0 0
exit

line vty 0 4
password 123
login
exit

 

2、做接口。。。

en
config t
int s1/0
ip add 35.1.1.1 255.255.255.0
no shutdown
exit

int s2/0
ip add 35.1.1.2 255.255.255.0
no shutdown
exit

int loopback 0
ip add 3.3.3.3 255.255.255.0
no shutdown
exit


3 做通
show ip int bri


 ping连接自己的端口
 


4、在AS65245 中, 启动OSPF协议, 目的,实现BGP底层的可达。。


------------------------------------------------------------------------------
r4

router os 10
router-id  4.4.4.4
network  24.1.1.0 0.0.0.255 area  0
network  45.1.1.0 0.0.0.255 area  0
network  4.4.4.4 0.0.0.0 area  0


r2

router os 10
router-id  2.2.2.2
network  24.1.1.0 0.0.0.255 area 0
network  12.1.1.0 0.0.0.255 area  0
network  2.2.2.2 0.0.0.0 area  0
passive-interface  s2/0

r5

router ospf  10
router-id  5.5.5.5
network  45.1.1.2 0.0.0.0 area  0
network  35.1.1.1 0.0.0.0 area  0
network  5.5.5.5 0.0.0.0 area  0
passive-interface  s1/0


-----------------------------------------------------------------------------------

R4(config)#router os 10
R4(config-router)#router-id  4.4.4.4
R4(config-router)#network  24.1.1.0 0.0.0.255 area  0
R4(config-router)#network  45.1.1.0 0.0.0.255 area  0
R4(config-router)#network  4.4.4.4 0.0.0.0 area  0

R2(config)#router os 10
R2(config-router)#router-id  2.2.2.2
R2(config-router)#network  24.1.1.0 0.0.0.255 area 0
R2(config-router)#network  12.1.1.0 0.0.0.255 area  0
R2(config-router)#network  2.2.2.2 0.0.0.0 area  0
R2(config-router)#passive-interface  s2/0


R5(config)#router ospf  10
R5(config-router)#router-id  5.5.5.5
R5(config-router)#network  45.1.1.2 0.0.0.0 area  0
R5(config-router)#network  35.1.1.1 0.0.0.0 area  0
R5(config-router)#network  5.5.5.5 0.0.0.0 area  0
R5(config-router)#passive-interface  s1/0

5、验证OSPF的启动。。


r2loopback ping r5loopback
r2ping 5.5.5.5
r5#ping 2.2.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 24.1.1.1, timeout is 2 seconds:
!!!!!

r2#ping 45.1.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 45.1.1.2, timeout is 2 seconds:
!!!!


6、启动BGP

------------------------------------------------------------------------------------
r1

 

 

 


----------------------------------------------------------------------------------------


R1(config)#router bgp 65001
R1(config-router)#bgp router-id   1.1.1.1
R1(config-router)#neighbor  12.1.1.2 remote-as  65245
R1(config-router)#network 1.1.1.0 mask  255.255.255.0


R2(config)#router bgp 65245
R2(config-router)#bgp router-id  2.2.2.2 
R2(config-router)#neighbor  12.1.1.1 remote-as  65001

R2(config-router)#exit

 

R2#show ip bgp summary  查看邻居


R2#show ip bgp summary 
BGP router identifier 2.2.2.2, local AS number 65245
BGP table version is 2, main routing table version 2
1 network entries using 101 bytes of memory
1 path entries using 48 bytes of memory
1 BGP path attribute entries using 60 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 233 total bytes of memory
BGP activity 1/0 prefixes, 1/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.1.1.1        4 65001       5       4        2    0    0 00:00:40        1
R2#

 


R2(config-router)#neighbor  5.5.5.5 remote-as  65245
R2(config-router)#neighbor  5.5.5.5 update-source loopback 0


R5(config)#router bgp  65245
R5(config-router)#bgp router-id  5.5.5.5
R5(config-router)#neighbor  2.2.2.2 remote-as  65245
R5(config-router)#neighbor  2.2.2.2 update-source loopback 0


show  ip  bgp  summary

 

R5(config)#router bgp  65245
R5(config-router)#neighbor  35.1.1.2 remote-as  65003

R3(config)#router bgp 65003
R3(config-router)#bgp router-id  3.3.3.3
R3(config-router)#neighbor  35.1.1.1 remote-as  65245
R3(config-router)#network  3.3.3.0 mask  255.255.255.0

 

show ip  bgp summary


R3#show ip bgp ------查看BGP表
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
*> 1.1.1.0/24       35.1.1.5                               0 65245 65001 i
*> 3.3.3.0/24       0.0.0.0                  0         32768 i


 


解决方案:
1、全互联的IBGP
2、RR(路由器反射器)
3、联邦
4、MPLS
5、连线
6、Trunnel
7、静态路由
8、重发布