实验拓扑
![[Pasted image 20251113104726.png]]
任务列表
公司的网络采用了BGP接入了两个服务运营商。公司自己采用了私有AS号64512,ISP1的AS号为100, 公司共有2条链路接入ISP1。 ISP2的AS号为200,公司租用了一条线路接入ISP2。现在Internet上 部分用户反应访问公司网站的速度较慢,通过改变BGP的各种属性调整路由。 1、完成基础配置,配置IGP。 2、在R1、R4、S1上配置BGP,要求使用各自Loopback0接口建立对等体连接,默认情况下,BGP负载分担是关闭。 在所有路由器上打开负载分担,设置最大同时使用4条等价路径。 3、配置EBGP,EBGP全部使用物理接口地址建立对等体关系。 4、在S1上创建Loopback1,使用network命令发布到BGP中。在R2上观察BGP路由表,可看出这时10.1.11.0/24路由是依据AS-Path属性来选择下一跳。现在希望R2能由AS100来访问10.1.11.0/24。这里通过AS-Path来影响选路。在R1上创建路由策 略as_path,针对10.1.11.0/24这条路由增加2个重复AS号。 5、观察R3路由表,到达10.1.11.0/24下一跳是R1,希望R3通过R5访问AS 64512,将R1对R3通告该路由修改为incomplete。 6、现在希望到达网络10.1.5.0/24的流量从R4发送到目标,到达网络10.1.3.0/24的流量从R1发送到目标。 在R4上创建路由策略Pref4,匹配路由10.1.5.0/24,将其本地优先属性修改为110。R1上创建路由策略Pref1, 匹配路由10.1.3.0/24,将其本地优先属性修改为110,然后将策略应用。
任务1-任务3
AR1
bgp 64512
peer 10.0.11.11 as-number 64512
peer 10.0.11.11 next-hop-local
peer 10.0.11.11 connect-int lo 0
peer 10.0.4.4 as-number 64512
peer 10.0.4.4 next-hop-local
peer 10.0.4.4.11 connect-int lo 0
peer 10.0.12.2 as-number 200
peer 10.0.13.3 as-number 100
maximum load-balancing 4AR2
bgp 200
peer 10.0.12.1 as-number 64512
peer 10.0.23.3 as-number 100
maximum load-balancing 4AR3
bgp 100
peer 10.0.23.2 as-number 200
peer 10.0.35.5 as-number 100
peer 10.0.13.1 as-number 64512
maximum load-balancing 4AR4
bgp 64512
peer 10.0.45.5 as-number 100
peer 10.0.1.1 as-number 64512
peer 10.0.1.1 next-hop-local
peer 10.0.1.1 connect-int lo 0
peer 10.0.11.11 as-number 64512
peer 10.0.11.11 next-hop-local
peer 10.0.11.11 connect-int lo 0
maximum load-balancing 4AR5
bgp 100
peer 10.0.45.4 as-number 64512
peer 10.0.35.3 as-number 100
maximum load-balancing 4S1
bgp 64512
peer 10.0.1.1 as-number 64512
peer 10.0.1.1 connect-int lo 0
peer 10.0.4.4 as-number 64512
peer 10.0.4.4 connect-int lo 0
maximum load-balancing 4任务4
在AR2上查看路由 ![[Pasted image 20251113105352.png]] 添加AS-Path长度
[R1]acl 2001
[R1-acl-basic-2001]rule permit source 10.1.11.0 0.0.0.255
[R1-acl-basic-2001]quit
[R1]route-policy as-path permit node 10
[R1-route-policy]if-match acl 2001
[R1-route-policy]apply as-path 300 300 additive
[R1-route-policy]quit
[R1]route-policy as-path permit node 20
[R1-route-policy]quit
[R1]bgp 64512
[R1-bgp]peer 10.0.12.2 route-policy as-path exportx`添加长度后查看路由表 ![[Pasted image 20251113105412.png]]
任务5
观察R3路由表,到达10.1.11.0/24下一跳是R1 ![[Pasted image 20251113105525.png]] 希望R3通过R5访问AS 64512,将R1对R3通告该路由修改为incomplete(修改Origin属性) 这里选择在R1实现
[R1]route-policy origin permit node 10
[R1-route-policy]if-match acl 2001
[R1-route-policy]apply origin incomplete
[R1-route-policy]quit
[R1]route-policy origin permit node 20
[R1-route-policy]quit
[R1]bgp 64512
[R1-bgp]peer 10.0.13.3 route-policy origin export查看R3路由表 ![[Pasted image 20251113110442.png]]
任务6
在AR3和AR5发布路由 在S1上查看路由 ![[Pasted image 20251113111816.png]] R1
[R1]acl 2002
[R1-acl-basic-2002]rule permit source 10.1.3.0 0.0.0.255
[R1-acl-basic-2002]quit
[R1]route-policy pref permit node 10
[R1-route-policy]if-match acl 2002
[R1-route-policy]apply local-preference 300
[R1-route-policy]quit
[R1]route-policy pref permit node 20
[R1-route-policy]quit
[R1]bgp 64512
[R1-bgp]peer 10.0.11.11 route-policy pref exportR4
[R4]acl 2002
[R4-acl-basic-2002]rule permit source 10.1.5.0 0.0.0.255
[R4-acl-basic-2002]quit
[R4]route-policy pref permit node 10
[R4-route-policy]if-match acl 2002
[R4-route-policy]apply local-preference 300
[R4-route-policy]quit
[R4]route-policy pref permit node 20
[R4-route-policy]quit
[R4]bgp 64512
[R4-bgp]peer 10.0.11.11 route-policy pref export查看路由表 ![[Pasted image 20251113113740.png]]