BGP实验
一.实验拓扑
二.实验要求
1.AS1存在两个环回,一个地址为192.168.1.0/24该地址不能再任何协议中宣告
AS3中存在两个环回,一个地址为192.168.2.0/24该地址不能在任何协议中宣告,最终要求这两个环回可以互相通讯
AS1的另一个环回为10.0.0.0/24,AS3的另一个环回为11.0.0.0/24
2.整个AS2的IP地址为172.16.0.0/16,请合理划分
3.AS间的骨干链路IP地址随意定制
4.使用BGP协议让整个网络所有设备的环回可以互相访问
5.减少路由条目数量,避免环路出现
三.路由器配置及网段划分
1.网段划分
172.16.0.0/16
172.16.0.0/24----R2-R7建立IBGP环回
172.16.0.1/32---R2
172.16.0.2/32---R3
172.16.0.3/32---R4
172.16.0.4/32---R5
172.16.0.5/32---R6
172.16.0.6/32---R7
172.16.1.0/24----AS2
172.16.1.0/30---R2-R3
172.16.1.4/30---R3-R4
172.16.1.8/30---R5-R6
172.16.1.12/30---R6-R7
172.16.1.16/30---R2-R5
172.16.1.20/30---R4-R7
172.16.2.0/24----R2用户环回
172.16.3.0/24----R3用户环回
172.16.4.0/24----R4用户环回
172.16.5.0/24----R5用户环回
172.16.6.0/24----R6用户环回
172.16.7.0/24----R7用户环回
2.路由器配置
R1:
[V200R003C00]
#
sysname R1
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load flash:/portalpage.zip
#
drop illegal-mac alarm
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 12.0.0.1 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 192.168.1.1 255.255.255.0
#
interface LoopBack1
ip address 10.0.0.1 255.255.255.0
#
interface Tunnel0/0/0
ip address 18.0.0.1 255.255.255.0
tunnel-protocol gre
source 10.0.0.1
destination 11.0.0.1
#
bgp 1
router-id 1.1.1.1
peer 12.0.0.2 as-number 2
#
ipv4-family unicast
undo synchronization
network 10.0.0.0 255.255.255.0
peer 12.0.0.2 enable
#
ip route-static 192.168.2.0 255.255.255.0 18.0.0.2
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
R2:
[V200R003C00]
#
sysname R2
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load flash:/portalpage.zip
#
drop illegal-mac alarm
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 12.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 172.16.1.1 255.255.255.252
#
interface GigabitEthernet0/0/2
ip address 172.16.1.17 255.255.255.252
#
interface NULL0
#
interface LoopBack0
ip address 172.16.2.1 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 172.16.0.1 255.255.255.255
#
bgp 64512
router-id 2.2.2.2
confederation id 2
confederation peer-as 64513
peer 12.0.0.1 as-number 1
peer 172.16.0.2 as-number 64512
peer 172.16.0.2 connect-interface LoopBack1
peer 172.16.0.4 as-number 64513
peer 172.16.0.4 ebgp-max-hop 255
peer 172.16.0.4 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
network 172.16.0.0 255.255.248.0
peer 12.0.0.1 enable
peer 172.16.0.2 enable
peer 172.16.0.2 next-hop-local
peer 172.16.0.4 enable
peer 172.16.0.4 next-hop-local
#
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 172.16.0.0 0.0.255.255
network 172.16.0.1 0.0.0.0
network 172.16.1.0 0.0.0.3
network 172.16.1.16 0.0.0.3
#
ip route-static 172.16.0.0 255.255.248.0 NULL0
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
R3:
[V200R003C00]
#
sysname R3
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load flash:/portalpage.zip
#
drop illegal-mac alarm
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 172.16.1.2 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.1.5 255.255.255.252
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 172.16.3.1 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 172.16.0.2 255.255.255.255
#
bgp 64512
router-id 3.3.3.3
confederation id 2
peer 172.16.0.1 as-number 64512
peer 172.16.0.1 connect-interface LoopBack1
peer 172.16.0.3 as-number 64512
peer 172.16.0.3 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
peer 172.16.0.1 enable
peer 172.16.0.3 enable
peer 172.16.0.3 reflect-client
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 172.16.0.0 0.0.255.255
network 172.16.0.2 0.0.0.0
network 172.16.1.0 0.0.0.3
network 172.16.1.4 0.0.0.3
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
R4:
[V200R003C00]
#
sysname R4
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load flash:/portalpage.zip
#
drop illegal-mac alarm
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 172.16.1.6 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.1.21 255.255.255.252
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 172.16.4.1 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 172.16.0.3 255.255.255.255
#
bgp 64512
router-id 4.4.4.4
confederation id 2
confederation peer-as 64513
peer 172.16.0.2 as-number 64512
peer 172.16.0.2 connect-interface LoopBack1
peer 172.16.0.6 as-number 64513
peer 172.16.0.6 ebgp-max-hop 255
peer 172.16.0.6 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
peer 172.16.0.2 enable
peer 172.16.0.6 enable
#
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 172.16.0.0 0.0.255.255
network 172.16.0.3 0.0.0.0
network 172.16.1.4 0.0.0.3
network 172.16.1.20 0.0.0.3
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
R5:
[V200R003C00]
#
sysname R5
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load flash:/portalpage.zip
#
drop illegal-mac alarm
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 172.16.1.18 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.1.9 255.255.255.252
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 172.16.5.1 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 172.16.0.4 255.255.255.255
#
bgp 64513
router-id 5.5.5.5
confederation id 2
confederation peer-as 64512
peer 172.16.0.1 as-number 64512
peer 172.16.0.1 ebgp-max-hop 255
peer 172.16.0.1 connect-interface LoopBack1
peer 172.16.0.5 as-number 64513
peer 172.16.0.5 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
peer 172.16.0.1 enable
peer 172.16.0.5 enable
#
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 172.16.0.0 0.0.255.255
network 172.16.0.4 0.0.0.0
network 172.16.1.8 0.0.0.3
network 172.16.1.16 0.0.0.3
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
R6:
[V200R003C00]
#
sysname R6
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load flash:/portalpage.zip
#
drop illegal-mac alarm
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 172.16.1.10 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.1.13 255.255.255.252
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 172.16.6.1 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 172.16.0.5 255.255.255.255
#
bgp 64513
router-id 6.6.6.6
confederation id 2
peer 172.16.0.4 as-number 64513
peer 172.16.0.4 connect-interface LoopBack1
peer 172.16.0.6 as-number 64513
peer 172.16.0.6 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
peer 172.16.0.4 enable
peer 172.16.0.6 enable
peer 172.16.0.6 reflect-client
#
ospf 1 router-id 6.6.6.6
area 0.0.0.0
network 172.16.0.0 0.0.255.255
network 172.16.0.5 0.0.0.0
network 172.16.1.8 0.0.0.3
network 172.16.1.12 0.0.0.3
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
R7:
[V200R003C00]
#
sysname R7
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load flash:/portalpage.zip
#
drop illegal-mac alarm
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 172.16.1.14 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.1.22 255.255.255.252
#
interface GigabitEthernet0/0/2
ip address 78.0.0.2 255.255.255.0
#
interface NULL0
#
interface LoopBack0
ip address 172.16.7.1 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 172.16.0.6 255.255.255.255
#
bgp 64513
router-id 7.7.7.7
confederation id 2
confederation peer-as 64512
peer 78.0.0.1 as-number 3
peer 78.0.0.1 ebgp-max-hop 255
peer 172.16.0.3 as-number 64512
peer 172.16.0.3 ebgp-max-hop 255
peer 172.16.0.3 connect-interface LoopBack1
peer 172.16.0.5 as-number 64513
peer 172.16.0.5 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
network 172.16.0.0 255.255.248.0
peer 78.0.0.1 enable
peer 172.16.0.3 enable
peer 172.16.0.3 next-hop-local
peer 172.16.0.5 enable
peer 172.16.0.5 next-hop-local
#
ospf 1 router-id 7.7.7.7
area 0.0.0.0
network 172.16.0.0 0.0.255.255
network 172.16.0.6 0.0.0.0
network 172.16.1.12 0.0.0.3
network 172.16.1.20 0.0.0.3
#
ip route-static 172.16.0.0 255.255.248.0 NULL0
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
R8:
[V200R003C00]
#
sysname R8
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load flash:/portalpage.zip
#
drop illegal-mac alarm
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 78.0.0.1 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 192.168.2.1 255.255.255.0
#
interface LoopBack1
ip address 11.0.0.1 255.255.255.0
#
interface Tunnel0/0/0
ip address 18.0.0.2 255.255.255.0
tunnel-protocol gre
source 11.0.0.1
destination 10.0.0.1
#
bgp 3
router-id 8.8.8.8
peer 78.0.0.2 as-number 2
#
ipv4-family unicast
undo synchronization
network 11.0.0.0 255.255.255.0
peer 78.0.0.2 enable
#
ip route-static 192.168.1.0 255.255.255.0 18.0.0.1
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
四.实验结果
1.IP配置
2.因为BGP基于IGP之上,给AS 2内配置ospf‘,使AS 2内通。
3.配置BGP:R1,R2和R7,R8之间EBGP用直连建邻,AS 2中IBGP用环回建邻,且采用联邦策略进行防环,R2,R3,R4和R5,R6,R7分别为一组,在联邦内进一步通过路由反射器.设置R3和R7为RR,R2和R7分别为其客户。
4.宣告R1,R8中的10.0.0.0/24和11.0.0.0/24环回,分别传到R2,R7的时候是优的,传到R3,R5和R4,R6就不优了,因为在同一AS内属性不变,所以在R2,R7上需要修改下一条为自己,因为我们在R3,R6上做了路由反射器,因此,业务网段可以正常传到其对端。
5.因为需要所有业务网段都能通讯,故需要宣告AS 2内的业务网段。AS 2内的业务网段可以汇总,所以只需要在R2,R7上做一个汇总网段的空接口,然后宣告汇总网段即可。
6.需要使R1,R8两个不能宣告的环回正常通讯,故使用VPN隧道技术。