第一步:基础配置
AR1:
sy
sysname AR1
interface e0/0/0
ip address 12.0.0.2 24
interface g0/0/0
ip address 13.0.0.2 24
interface g0/0/1
ip address 15.0.0.1 24
interface loopback 1
ip address 1.1.1.1 32
quit
ospf 1 router-id 1.1.1.1
area 0
network 12.0.0.0 0.0.0.255
network 13.0.0.0 0.0.0.255
network 1.1.1.1 0.0.0.0
quit
bgp 123
router-id 1.1.1.1
peer 15.0.0.2 as-number 5
peer 2.2.2.2 as-number 123
peer 2.2.2.2 connect-interface LoopBack 1
peer 2.2.2.2 next-hop-local
peer 3.3.3.3 as-number 123
peer 3.3.3.3 connect-interface LoopBack 1
peer 3.3.3.3 next-hop-local
AR2:
sy
sysname AR2
interface g0/0/0
ip address 24.0.0.2 24
interface e0/0/0
ip address 12.0.0.1 24
interface loopback 1
ip address 2.2.2.2 32
quit
ospf 1 router-id 2.2.2.2
area 0
network 12.0.0.0 0.0.0.255
network 2.2.2.2 0.0.0.0
quit
bgp 123
router-id 2.2.2.2
peer 24.0.0.1 as-number 4
peer 1.1.1.1 as-number 123
peer 1.1.1.1 connect-interface LoopBack1
peer 1.1.1.1 next-hop-local
AR3:
sy
sysname AR3
interface g0/0/0
ip address 34.0.0.2 24
interface g0/0/1
ip address 13.0.0.1 24
interface loopback 1
ip address 3.3.3.3 32
quit
ospf 1 router-id 3.3.3.3
area 0
network 13.0.0.0 0.0.0.255
network 3.3.3.3 0.0.0.0
quit
bgp 123
router-id 3.3.3.3
peer 34.0.0.1 as-number 4
peer 1.1.1.1 as-number 123
peer 1.1.1.1 connect-interface LoopBack 1
peer 1.1.1.1 next-hop-local
AR4:
sy
sysname AR4
interface g0/0/0
ip address 24.0.0.1 24
interface g0/0/1
ip address 34.0.0.1 24
interface loopback 1
ip address 4.4.4.4 32
interface loopback 2
ip address 8.8.8.8 32
interface loopback 3
ip address 7.7.7.7 32
quit
acl 2000
rule 5 permit source 4.4.4.4 0.0.0.0
rule 10 permit source 7.7.7.7 0.0.0.0
rule 15 permit source 8.8.8.8 0.0.0.0
quit
route-policy dyc permit node 10
if-match acl 2000
route-policy dyc permit node 20
bgp 4
import-route direct route-policy dyc
peer 24.0.0.2 as-number 123
peer 34.0.0.2 as-number 123
AR5:
sy
sysname AR5
interface g0/0/0
ip address 15.0.0.2 24
interface loopback 1
ip address 5.5.5.5 32
interface loopback 2
ip address 6.6.6.6 32
interface loopback 3
ip address 9.9.9.9 32
quit
acl 2000
rule 5 permit source 6.6.6.6 0.0.0.0
rule 10 permit source 9.9.9.9 0.0.0.0
rule 15 permit source 5.5.5.5 0.0.0.0
quit
route-policy dyc permit node 10
if-match acl 2000
route-policy dyc permit node 20
quit
bgp 5
import-route direct route-policy dyc
peer 15.0.0.1 as-number 123
第二步:开始按照题目要求做
1.在R4上配置preval策略,确保R4通过R3到达5.5.5.5(preferred_value)。
AR4:
route-policy ji permit node 10
if-match acl 2001
apply preferred-value 100
qu
route-policy ji permit node 20
quit
acl 2001
rule permit source 5.5.5.5 0.0.0.0
quit
bgp 4
peer 34.0.0.2 route-policy ji import
做完后
2.在R4上配置as_path策略,确保R4通过R3到达9.9.9.9。
AR4:
route-policy ojh permit node 10
if-match acl 2002
apply as-path 123 123 123 additive
qu
route-policy ojh permit node 11
acl number 2002
rule 5 permit source 9.9.9.9 0
bgp 4
peer 24.0.0.2 route-policy ojh import
3.在R2和R3上配置med策略,确保R4通过R3到达6.6.6.6。
AR2:
route-policy zbc permit node 10
if-match ip-prefix zbc
apply cost 20
quit
route-policy zbc permit node 20
quit
ip ip-prefix zbc permit 6.6.6.6 32
bgp 123
peer 24.0.0.1 route-policy zbc export
AR3:
route-policy zhu permit node 10
if-match ip-prefix zhu
apply cost 10
qu
route-policy zhu permit node 20
quit
ip ip-prefix zhu permit 6.6.6.6 32
bgp 123
peer 34.0.0.1 route-policy zhu export
4.在R2上配置local pre策略,确保R1通过R2到达4.4.4.4(local_preference)。
AR2:
route-policy sdm permit node 10
if-match acl 2004
apply local-preference 200
qu
route-policy sdm permit node 11
quit
acl number 2004
rule 5 permit source 4.4.4.4 0
quit
bgp 123
peer 1.1.1.1 route-policy sdm export
5.在R1上配置local pre策略,确保R1通过R2到达8.8.8.8(local_preference)。
AR1:
route-policy sdm permit node 10
if-match acl 2004
apply local-preference 200
quit
route-policy sdm permit node 11
quit
acl number 2004
rule 5 permit source 8.8.8.8 0
quit
bgp 123
peer 2.2.2.2 route-policy sdm import
6.在R4上配置community策略,确保7.7.7.7的路由不会宣告到AS 5。
AR4:
route-policy com permit node 10
if-match ip-prefix com
apply community no-export
quit
route-policy com permit node 11
quit
ip ip-prefix com permit 7.7.7.7 32
bgp 4
peer 24.0.0.2 advertise-community
peer 34.0.0.2 advertise-community
peer 24.0.0.2 route-policy com export
peer 34.0.0.2 route-policy com export
AR2:
bgp 123
peer 1.1.1.1 advertise-community
AR3:
bgp 123
peer 1.1.1.1 advertise-community
第三步:查验结果
1.display bgp routing-table
tracert 5.5.5.5
2.display bgp routing-table
tracert 9.9.9.9
3.display bgp routing-table
tracert 9.9.9.9
4.dis bgp routing-table
5.dis bgp routing-table
6.[AR5]dis bgp routing-table