配置思路:
1、所有的EBGP用物理口进行peer连接建立邻居
2、深圳分部内的IBGP用loop 0口建立BGP邻居,底层用ospf打通
3、默认深圳到北京走长沙,经过BGP选路用preferred-value 改变,走上海到北京。
R1:
interface GigabitEthernet0/0/0
ip address 12.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 13.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 15.1.1.1 255.255.255.0
ospf enable 1 area 0.0.0.0
#
interface NULL0
#
interface LoopBack0
ip address 11.1.1.1 255.255.255.0
ospf enable 1 area 0.0.0.0
#
interface LoopBack1
ip address 192.168.1.1 255.255.255.0
#
#
bgp 100
router-id 1.1.1.1
peer 12.1.1.2 as-number 200
peer 13.1.1.2 as-number 300
peer 19.1.1.1 as-number 100
peer 19.1.1.1 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 12.1.1.2 enable
peer 13.1.1.2 enable
peer 13.1.1.2 route-policy RP import
peer 19.1.1.1 enable
peer 19.1.1.1 next-hop-local
#
ospf 1
area 0.0.0.0
#
route-policy RP permit node 10
if-match ip-prefix 1
apply preferred-value 10
#
ip ip-prefix 1 index 10 permit 192.168.4.0 24
R5:
interface GigabitEthernet0/0/2
ip address 15.1.1.2 255.255.255.0
ospf enable 1 area 0.0.0.0
#
interface NULL0
#
interface LoopBack0
ip address 19.1.1.1 255.255.255.0
ospf enable 1 area 0.0.0.0
#
interface LoopBack1
ip address 192.168.5.1 255.255.255.0
#
bgp 100
peer 11.1.1.1 as-number 100
peer 11.1.1.1 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
network 192.168.5.0
peer 11.1.1.1 enable
#
ospf 1
area 0.0.0.0
R2:
interface GigabitEthernet0/0/0
ip address 12.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 24.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 192.168.1.3 255.255.255.0
#
interface NULL0
#
bgp 200
router-id 2.2.2.2
peer 12.1.1.1 as-number 100
peer 24.1.1.2 as-number 400
#
ipv4-family unicast
undo synchronization
peer 12.1.1.1 enable
peer 24.1.1.2 enable
R3:
interface GigabitEthernet0/0/1
ip address 13.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 34.1.1.1 255.255.255.0
#
interface NULL0
#
bgp 300
router-id 3.3.3.3
peer 13.1.1.1 as-number 100
peer 34.1.1.2 as-number 400
#
ipv4-family unicast
undo synchronization
peer 13.1.1.1 enable
peer 34.1.1.2 enable
R4:
interface GigabitEthernet0/0/1
ip address 24.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 34.1.1.2 255.255.255.0
#
interface NULL0
#
interface LoopBack0
ip address 192.168.4.1 255.255.255.0
#
bgp 400
router-id 4.4.4.4
peer 24.1.1.1 as-number 200
peer 34.1.1.1 as-number 300
#
ipv4-family unicast
undo synchronization
network 192.168.4.0
peer 24.1.1.1 enable
peer 34.1.1.1 enable