配置BGP
router bgp 100 (AS号)
neighbor{ip-address|peer-group-name} remote-as autonomous-system
network network-number{mask network-mask} {route-map map-tag}
no syschronization 关闭同步(默认)
syschronization 开启同步
bgp router-id x.x.x.x
router bgp 123
neighbor 3.3.3.3 remote-as 123
neighbor 3.3.3.3 updtae lo0
router bgp 123
neighbor 1.1.1.1 remote-as 123
neighbor 1.1.1.1 updtae lo0
router bgp 400
neighbor 4.4.4.4 remote-as 123
###############
BGP案例1: ##
###############
R1
conf ter
int s 0/0
ip add 10.1.12.1 255.255.255.0
no sh
exit
int lo0
ip add 1.1.1.1 255.255.255.0
no sh
exit
router bgp 123
neighbor 10.1.12.2 remote-as 123
no router bgp 123
router ospf 1
network 10.1.12.1 0.0.0.0 a 0
network 1.1.1.1 0.0.0.0 a 0
router bgp 123
neighbor 3.3.3.3 remote-as 123
neighbor 3.3.3.3 update-source loopback 0
ip route 10.1.34.0 255.255.255.0 s 0/0
no ip route 10.1.34.0 255.255.255.0 s 0/0
clear ip bgp * soft
router bgp 123
neighbor 2.2.2.2 remote-as 123
neighbor 2.2.2.2 update-source loopback 0
#######################################
R2
conf ter
int s 0/0
ip add 10.1.12.2 255.255.255.0
no sh
exit
int s 0/1
ip add 10.1.23.2 255.255.255.0
no sh
exit
int lo0
ip add 2.2.2.2 255.255.255.0
no sh
exit
router bgp 123
neighbor 10.1.12.1 remote-as 123
neighbor 10.1.23.3 remote-as 123
no router bgp 123
router ospf 1
network 10.1.12.2 0.0.0.0 a 0
network 10.1.23.2 0.0.0.0 a 0
network 2.2.2.2 0.0.0.0 a 0
router bgp 123
neighbor 1.1.1.1 remote-as 123
neighbor 1.1.1.1 update-source loopback 0
neighbor 3.3.3.3 remote-as 123
neighbor 3.3.3.3 update-source loopback 0
##########################################
R3
conf ter
int s 0/0
ip add 10.1.23.3 255.255.255.0
no sh
exit
int s 0/1
ip add 10.1.34.3 255.255.255.0
no sh
exit
int lo0
ip add 3.3.3.3 255.255.255.0
no sh
exit
router bgp 123
neighbor 10.1.23.2 remote-as 123
neighbor 10.1.34.4 remote-as 400
no router bgp 123
router ospf 1
network 10.1.23.3 0.0.0.0 a 0
network 3.3.3.3 0.0.0.0 a 0
router bgp 123
neighbor 1.1.1.1 remote-as 123
neighbor 1.1.1.1 update-source loopback 0
router bgp 123
neighbor 10.1.34.4 remote-as 400
neighbor 1.1.1.1 next-hop-self
router bgp 123
no neighbor 10.1.34.4
neighbor 4.4.4.4 remote-as 400
neighbor 4.4.4.4 update-source lo0
ip route 4.4.4.0 255.255.255.0 s 0/1
neighbor 4.4.4.4 ebgp-multihop 2
ip route 4.4.4.4 255.255.255.255 s 0/1
router bgp 123
neighbor 2.2.2.2 remote-as 123
neighbor 2.2.2.2 update-source loopback 0
neighbor 2.2.2.2 next-hop-self
###########################################
R4
conf ter
int s 0/0
ip add 10.1.34.4 255.255.255.0
no sh
exit
int lo0
ip add 4.4.4.4 255.255.255.0
no sh
exit
router bgp 400
neighbor 10.1.34.3 remote-as 123
network 4.4.4.0 mask 255.255.255.0
no neighbor 10.1.34.3
neighbor 3.3.3.3 remote-as 123
neighbor 3.3.3.3 update-source lo0
ip route 0.0.0.0 0.0.0.0 s 10.1.34.3
neighbor 3.3.3.3 ebgp-multihop 2