BGP-1 基础的配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了BGP-1 基础的配置相关的知识,希望对你有一定的参考价值。
如下图实现 AS100 100.1.1.1/24 与 AS300通信
AR1配置:
interface GigabitEthernet0/0/0
ip address 12.12.12.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 13.13.13.1 255.255.255.0
interface NULL0
interface LoopBack0
ip address 100.1.1.1 255.255.255.0
interface LoopBack100
ip address 100.1.1.1 255.255.255.0
bgp 100 //配置BGP进程 100
peer 2.2.2.2 as-number 200 配置对等体
peer 2.2.2.2 ebgp-max-hop 255 //ebgp默认为1跳,多等于2跳建立邻居
peer 2.2.2.2 connect-interface LoopBack0 //用本地回环口建立邻居
peer 3.3.3.3 as-number 200
peer 3.3.3.3 ebgp-max-hop 255
peer 3.3.3.3 connect-interface LoopBack0
group as200 internal
ipv4-family unicast
undo synchronization
network 100.1.1.0 255.255.255.0
peer 2.2.2.2 enable
peer 3.3.3.3 enable
peer as200 enable
ip route-static 2.2.2.0 255.255.255.0 12.12.12.2 实现回环口通信建立邻居
ip route-static 3.3.3.0 255.255.255.0 13.13.13.3
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
wlan ac
return
AR2配置:
interface GigabitEthernet0/0/0
ip address 12.12.12.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 24.24.24.2 255.255.255.0
interface NULL0
interface LoopBack0
ip address 2.2.2.2 255.255.255.0
bgp 200
peer 1.1.1.1 as-number 100
peer 1.1.1.1 ebgp-max-hop 255
peer 1.1.1.1 connect-interface LoopBack0
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0
peer 5.5.5.5 as-number 200
ipv4-family unicast
undo synchronization
peer 1.1.1.1 enable
peer 4.4.4.4 enable
peer 4.4.4.4 next-hop-local
peer 5.5.5.5 enable
peer 5.5.5.5 next-hop-local
ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 24.24.24.2 0.0.0.0
ip route-static 1.1.1.0 255.255.255.0 12.12.12.1
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
wlan ac
return
AR3配置:
interface GigabitEthernet0/0/0
ip address 34.34.34.3 255.255.255.0
interface GigabitEthernet0/0/1
ip address 13.13.13.3 255.255.255.0
interface NULL0
interface LoopBack0
ip address 3.3.3.3 255.255.255.0
bgp 200
peer 1.1.1.1 as-number 100
peer 1.1.1.1 ebgp-max-hop 255
peer 1.1.1.1 connect-interface LoopBack0
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0
peer 5.5.5.5 as-number 200
ipv4-family unicast
undo synchronization
peer 1.1.1.1 enable
peer 4.4.4.4 enable
peer 4.4.4.4 next-hop-local
peer 5.5.5.5 enable
peer 5.5.5.5 next-hop-local
ospf 1
area 0.0.0.0
description isthis
network 3.3.3.3 0.0.0.0
network 34.34.34.3 0.0.0.0
ip route-static 1.1.1.0 255.255.255.0 13.13.13.1
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
wlan ac
return
AR4配置:
interface GigabitEthernet0/0/0
ip address 34.34.34.4 255.255.255.0
interface GigabitEthernet0/0/1
ip address 24.24.24.4 255.255.255.0
interface GigabitEthernet1/0/0
ip address 45.45.45.3 255.255.255.0
interface NULL0
interface LoopBack0
ip address 4.4.4.4 255.255.255.0
bgp 200
peer 2.2.2.2 as-number 200
peer 2.2.2.2 connect-interface LoopBack0
peer 3.3.3.3 as-number 200
peer 3.3.3.3 connect-interface LoopBack0
peer 5.5.5.5 as-number 200
peer 5.5.5.5 connect-interface LoopBack0
group as200 internal
ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable
peer 3.3.3.3 enable
peer 5.5.5.5 enable
peer as200 enable
ospf 1
area 0.0.0.0
network 0.0.0.0 255.255.255.255
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
wlan ac
return
AR5配置:
interface GigabitEthernet0/0/0
ip address 65.65.65.5 255.255.255.0
interface GigabitEthernet0/0/1
ip address 56.56.56.5 255.255.255.0
interface GigabitEthernet1/0/0
ip address 45.45.45.5 255.255.255.0
interface NULL0
interface LoopBack0
ip address 5.5.5.5 255.255.255.0
bgp 200
peer 2.2.2.2 as-number 200
peer 2.2.2.2 connect-interface LoopBack0
peer 3.3.3.3 as-number 200
peer 3.3.3.3 connect-interface LoopBack0
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0
peer 6.6.6.6 as-number 300
peer 6.6.6.6 ebgp-max-hop 255
peer 6.6.6.6 connect-interface LoopBack0
ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable
peer 2.2.2.2 next-hop-local
peer 3.3.3.3 enable
peer 3.3.3.3 next-hop-local
peer 4.4.4.4 enable
peer 4.4.4.4 next-hop-local
peer 6.6.6.6 enable
ospf 1
area 0.0.0.0
network 5.5.5.5 0.0.0.0
network 45.45.45.5 0.0.0.0
ip route-static 6.6.6.0 255.255.255.0 56.56.56.6
ip route-static 6.6.6.0 255.255.255.0 65.65.65.6
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
wlan ac
return
AR6配置:
interface GigabitEthernet0/0/0
ip address 65.65.65.6 255.255.255.0
interface GigabitEthernet0/0/1
ip address 56.56.56.6 255.255.255.0
interface NULL0
interface LoopBack0
ip address 6.6.6.6 255.255.255.0
interface LoopBack1
ip address 60.1.1.1 255.255.255.0
interface LoopBack2
ip address 60.1.2.1 255.255.255.0
interface LoopBack3
ip address 60.1.3.1 255.255.255.0
bgp 300
peer 5.5.5.5 as-number 200
peer 5.5.5.5 ebgp-max-hop 255
peer 5.5.5.5 connect-interface LoopBack0
ipv4-family unicast
undo synchronization
network 60.1.1.0 255.255.255.0
network 60.1.2.0 255.255.255.0
network 60.1.3.0 255.255.255.0
peer 5.5.5.5 enable
ip route-static 5.5.5.0 255.255.255.0 56.56.56.5
ip route-static 5.5.5.0 255.255.255.0 65.65.65.5
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
wlan ac
return
AR1与AR6 通信
附上BGP 检查命令
<Huawei>dis bgp peer
BGP local router ID : 1.1.1.1
Local AS number : 100
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
2.2.2.2 4 200 8 9 0 00:05:06 Established 3
3.3.3.3 4 200 7 8 0 00:05:00 Established 3
<Huawei>
<Huawei>dis bgp routing-table
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 7
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 60.1.1.0/24 2.2.2.2 0 200 300i
- 3.3.3.3 0 200 300i
*> 60.1.2.0/24 2.2.2.2 0 200 300i - 3.3.3.3 0 200 300i
*> 60.1.3.0/24 2.2.2.2 0 200 300i - 3.3.3.3 0 200 300i
*> 100.1.1.0/24 0.0.0.0 0 0 i
<Huawei>
<Huawei>dis current-configuration configuration bgp
[V200R003C00]
#
bgp 100
peer 2.2.2.2 as-number 200
peer 2.2.2.2 ebgp-max-hop 255
peer 2.2.2.2 connect-interface LoopBack0
peer 3.3.3.3 as-number 200
peer 3.3.3.3 ebgp-max-hop 255
peer 3.3.3.3 connect-interface LoopBack0
group as200 internal
#
ipv4-family unicast
undo synchronization
network 100.1.1.0 255.255.255.0
peer 2.2.2.2 enable
peer 3.3.3.3 enable
peer as200 enable
#
return
<Huawei>
<Huawei>dis ip routing-table protocol bgp
Route Flags: R - relay, D - download to fib
Public routing table : BGP
Destinations : 3 Routes : 3
BGP routing table status : <Active>
Destinations : 3 Routes : 3
Destination/Mask Proto Pre Cost Flags NextHop Interface
60.1.1.0/24 EBGP 255 0 RD 2.2.2.2 GigabitEthernet0/0/0
60.1.2.0/24 EBGP 255 0 RD 2.2.2.2 GigabitEthernet0/0/0
60.1.3.0/24 EBGP 255 0 RD 2.2.2.2 GigabitEthernet0/0/0
BGP routing table status : <Inactive>
Destinations : 0 Routes : 0
<Huawei>
以上是关于BGP-1 基础的配置的主要内容,如果未能解决你的问题,请参考以下文章