HCIE 实验LAB1
1.1 链路聚合
1.2 链路类型
S1/S2/S3/S4 互联接口的链路类型是 Trunk,允许除 VLAN1 以外的所有 VLAN 通过。
SW1/2 配置如下命令:
Port-group group-member gi0/0/1 gi0/0/12 eth-trunk 12
Port link-type trunk
Port trunk allow-pass vlan all
Undo port trunk allow-pass vlan 1
Quit
SW3/4 配置如下命令:
Port-group group-member gi0/0/1 gi0/0/2
Port link-type trunk
Port trunk allow-pass vlan all
Undo port trunk allow-pass vlan 1
Quit
CE1、CE2 的 VRRP 虚拟 IP 地址为 10.3.1.254,为 PC1 的网关。CE1 会周期性的发送源 IP 地址为 10.3.1.254、源 MAC 为 00-00-5E-00-01-01 的免费 ARP。PC-1 与网关之间的数据 包封装在 VLAN10 中(PC-1 收发的数据是没有标签的帧)。 (说明CE1 为VLAN10 的主网关,vrid为1)
CE1、CE2 的 VRRP 虚拟 IP 地址为 10.3.2.254,为 Server1 的网关。CE2 会周期性的发送 源 IP 地址为 10.3.2.254、源 MAC 为 00-00-5E-00-01-02 的免费 ARP。Server-1 与网关之间 的数据包封装在 VLAN20 中(Server1 收发的数据是没有标签的帧)。(说明CE2 为VLAN20 的主网关,vrid为2)
@在 SW1/2/3/4 上,创建 VLAN 10/20:
Vlan batch 10 20
@将终端设备加入到特定的 vlan
SW3:
Interface eth0/0/1
Port link-type access
Port default vlan 10
Quit
SW4:
Interface eth0/0/1
Port link-type access
Port default vlan 20
Quit
@将 CE1/2 连接到交换机上:
SW1:(将与 CE1 互联的接口配置为 trunk)
Interface gi0/0/2
Port link-type trunk
Port trunk allow-pass vlan all
Quit
SW2:(将与 CE2 互联的接口配置为 trunk)
Interface gi0/0/2
Port link-type trunk
Port trunk allow-pass vlan all
Quit
CE1:(配置每个 vlan 的子接口) ,配置 VRRP - VLAN 10 。
Interface gi0/0/2.10
dot1q termination vid 10
arp broadcast enable
ip address 10.3.1.1 255.255.255.0
Quit
Interface gi0/0/2.20
dot1q termination vid 20
arp broadcast enable
ip address 10.3.2.1 255.255.255.0
Quit
CE1 的配置(VLAN10 的主网关)
interface GigabitEthernet0/0/2.10
vrrp vrid 1 virtual-ip 10.3.1.254
vrrp vrid 1 priority 120
Quit
CE1 的配置(VLAN20 的备份网关)
interface GigabitEthernet0/0/2.20
vrrp vrid 2 virtual-ip 10.3.2.254
quit
CE2:(配置每个 vlan 的子接口) ,配置 VRRP - VLAN 20 。
Interface gi0/0/2.10
dot1q termination vid 10
arp broadcast enable
ip address 10.3.1.2 255.255.255.0
Quit
Interface gi0/0/2.20
dot1q termination vid 20
arp broadcast enable
ip address 10.3.2.2 255.255.255.0
Quit
CE2 的配置(VLAN20 的主网关)
interface GigabitEthernet0/0/2.20
vrrp vrid 2 virtual-ip 10.3.2.254
Vrrp vrid 2 priority 120
quit
CE2 的配置(VLAN10 的备份网关)
interface GigabitEthernet0/0/2.10
vrrp vrid 1 virtual-ip 10.3.1.254
quit
@验证命令: Display vrrp brief
VRRP 的 master 设备重启时,Gi0/0/2 变为 UP 状态 1 分钟后,才能重新成为 master。
在 CE1 的配置命令:
Interface gi0/0/2.10
vrrp vrid 1 preempt-mode timer delay 60
Quit
在 CE2 的配置命令: I
Interface gi0/0/2.20
vrrp vrid 2 preempt-mode timer delay 60
quit
1.3MSTP(多生成树协议)
S1/S2/S3/S4 都运行 MSTP。VLAN10 在 instance 10 中,S1 作为 Primary Root,S2 作为 Secondary Root。VLAN20 在 instance 20 中,S2 作为 Primary Root,S1 作为 Secondary Root。 MSTP 的 Region name 是 HUAWEI,Revision-level 为 12。
SW1/2/3/4 配置命令:
Stp mode mstp
stp region-configuration
region-name HUAWEI
revision-level 12
instance 10 vlan 10
instance 20 vlan 20
active region-configuration
Quit
SW1 配置 VLAN10 的根/备份根交换机:
Stp instance 10 root primary
Stp instance 20 root secondary
SW2 配置 VLAN20 的根/备份根交换机:
Stp instance 20 root primary
Stp instance 10 root secondary
除了交换机互联的接口,其他接口要确保不参与 MSTP 计算,由 disabled 状态直接转 到 Forwarding 状态.
SW1/2/3/4 的配置命令:
stp edged-port default -> 将每个设备的所有接口都开启“边缘端口”特性
接下来,需要将 SW 之间的互联接口,关闭掉边缘端口特性:
SW1/2:(SW 之间的互联接口)
Port-group group-member gi0/0/1 gi0/0/12 eth-trunk 12
undo stp edged-port
SW3/4:(SW 之间的互联接口)
Port-group group-member gi0/0/1 gi0/0/2
undo stp edged-port
1.4WAN(广域网)
PE1-RR1 之间的互联接口为 serial 接口,绑定为一个逻辑接口,成员链路采用的是 HDLC 协议。逻辑接口的 IPv4 地址和 IPv6 地址,请按照图 1、图 5 配置。(除了PE1-RR1之外都已经预配完成)
PE1 的配置命令:
Interface serial 0/0/0
Link-protocol hdlc
Y
Quit
Interface serial 0/0/1
Link-protocol hdlc
Y
Quit
Interface ip-trunk 13
Trunkport serial 0/0/0
Trunkport serial 0/0/1
Ip address 10.1.13.1 30
Quit
RR1 的配置命令:
Interface serial 0/0/0
Link-protocol hdlc
Y
Quit
Interface serial 0/0/1
Link-protocol hdlc
Y
Quit
Interface ip-trunk 13
Trunkport serial 0/0/0
Trunkport serial 0/0/1
Ip address 10.1.13.2 30
Quit
2. PE3-CE3 之间的互联接口是 POS 接口,绑定为一个逻辑接口,成员链路采用的是 PPP 协议。逻辑接口的 IPv4 地址,请按照图 1 配置。(除了PE3-CE3之外都已经预配完成)
在 PE3 上配置命令:
Interface mp-group 0/0/1
Ip address 10.2.33.2 30
Quit
Interface pos 4/0/0
Link-protocol ppp
Ppp mp mp-group 0/0/1
Quit
Interface pos 6/0/0
Link-protocol ppp
Ppp mp mp-group 0/0/1
Quit
在 CE3 上配置命令:
Interface mp-group 0/0/1
Ip address 10.2.33.1 30
Quit
Interface pos 4/0/0
Link-protocol ppp
Ppp mp mp-group 0/0/1
Quit
Interface pos 6/0/0
Link-protocol ppp
Ppp mp mp-group 0/0/1
Quit
验证命令: Display ppp mp Ping x.x.x.x (10.2.33.1 10.2.33.2)
2.1 基本配置 1. 所有设备的接口 IPv4 地址,按照图 1 配置。(除 PE1-RR1 的逻辑接口外,该地址已预配) 2. Router-id 与Loopback0 的 IPv4 地址相同。MPLS 域中各设备的Loopback0为 172.16.0.0/32 的主机地址(已预配置)。未来扩展的 MPLS 域个设备的 Loopback0,从 172.16.0.0/16 中 取可用的主机地址。比如 172.16.1.21/32 可能在 AS100,也可能在 AS200。
2.2OSPF
现在解决的是:数据转发的次优路径问题。
RR2:
Route-policy P150 permit node 10
If-match tag 200
Apply preference 150
Quit
Ospf 1
Preference ase 10 route-policy P150
P2:
Route-policy P150 permit node 10
If-match tag 300
Apply preference 150
Quit
Ospf 1
Preference ase 10 route-policy P150
q
CE1、CE2 为 VPN1 的 Hub-CE,PE1、PE2 为 Hub-PE;CE3、CE4 为 VPN1 的 Spoke 站点; PE3、PE4 为 Spoke-PE。
CE4 为 Multi-VPN-instance CE,CE4 的 VPN 实例 VPN1,通过 Gi0/0/1 【考试时,用的是子接口,一定要记得开启 ARP 广播功能与后面 CE1-PE1相似】 连接 PE4。
CE4 的配置命令: (考试时候,PE4-CE4 之间使用的是子接口,到时注意开启 ARP 广播)
Ip -instance VPN1
Route-distinguisher 100:14
Quit
Interface gi0/0/1
Ip binding -instance VPN1
Ip address 10.2.41.1 30
Quit
Interface loopback 0
Ip binding -instance VPN1
Ip address 172.17.1.4 32
Quit
Interface loopback 1
Ip binding -instance VPN1
Ip address 10.3.3.34 32
Quit
合理配置 VPN1 参数,使得 Spoke 站点互访的流量必须经过 Hub-CE 设备。当 CE1-PE1 链 路断开的情况下,PE1 仍然可以学习到 CE1 的业务路由。( PE3 上的 VPN1 的 RD 为 100:13, Export RT 为 100:1,Import RT 为 200:1)。
解析:
整个网路中的 VPN 的实例的名字,都是叫做 VPN1,并且只有 PE3 上面明确规定了 RD 和 RT ,通过对这个 VPN1 的理解,可以推导出 PE1/2/4 上面的 RT,但是 RD 在每个设 备上都是随意设置的。(只有 PE3 明确规定了,但是不建议大家随意修改,都按照解法来)
接下来,在 PE1/2 上面分别创建两个 VPN 实例:VPN1_IN 和 VPN1_OUT,在 PE1/2 上 面分别用于接收 分支站点 CE3/4 发送过来的路由,以及用于将总部的路由发送给 CE3/CE4。(import 接收 export 发出)
PE1 的配置命令:
Ip -instance VPN1_IN
Route-distinguisher 100:10
Vpn-target 100:1 import-extcommunity
Vpn-target 300:1 import-extcommunity
Quit
Ip -instance VPN1_OUT
Route-distinguisher 100:12
Vpn-target 200:1 export-extcommunity
Vpn-target 400:1 import-extcommunity
Quit
PE2 的配置命令:
Ip -instance VPN1_IN
Route-distinguisher 100:11
Vpn-target 100:1 import-extcommunity
Vpn-target 300:1 export-extcommunity
Quit
Ip -instance VPN1_OUT
Route-distinguisher 100:15
Vpn-target 200:1 export-extcommunity
Vpn-target 400:1 export-extcommunity
Quit
PE3 的配置命令:
Ip -instance VPN1
Route-distinguisher 100:13
Vpn-target 100:1 export-extcommunity
Vpn-target 200:1 import-extcommunity
Quit
interface Mp-group0/0/1
ip binding -instance VPN1
ip address 10.2.33.2 255.255.255.252
Quit
PE4 的配置命令:
Ip -instance VPN1
Route-distinguisher 100:14
Vpn-target 100:1 export-extcommunity
Vpn-target 200:1 import-extcommunity
Quit
Interface gi0/0/1
Ip binding -instance VPN1
Ip address 10.2.41.2 30
Quit
如图 4,CE1 通过 Gi0/0/1.1 和 Gi0/0/1.2 建立直连 EBGP 邻居,接入 PE1。CE1 通过 Gi0/0/1.2 向 PE1 通告的 BGP update 中,某些路由的 as-path 中有 200。在 CE1 上将 OSPF 路由导入 BGP。
解析:
经过题意的分析,我们知道 CE1 通过 gi0/0/1.2 接口向 PE1 发送 BGP 路由,通过 gi0/0/1.1 接口从 PE1 接收其他 分支站点的路由。所以,在 PE1 上面,gi0/0/1.1 接口应该 属于 VPN1_IN ,gi0/0/1.2 接口应该属于 VPN1_OUT。
PE1 的配置命令:
Interface gi0/0/1.1
Ip binding -instance VPN1_IN
Ip address 10.2.11.2 30
Arp broadcast enable
Quit
Interface gi0/0/1.2
Ip binding -instance VPN1_OUT
Ip address 10.2.11.6 30
Arp broadcast enable
Quit
Bgp 100
Ipv4-family -instance VPN1_IN
Peer 10.2.11.1 as-number 65000
Quit
Ipv4-family -instance VPN1_OUT
Peer 10.2.11.5 as-number 65000
Peer 10.2.11.5 allow-as-loop
Quit
CE1 的配置命令:
Interface gi0/0/1.1
Arp broadcast enable
Quit
Interface gi0/0/1.2
Arp broadcast enable
Quit
Bgp 65000
Peer 10.2.11.2 as-number 100
Peer 10.2.11.6 as-number 100
Import-route ospf 1 med 0
q
CE2 通过 Gi0/0/1.1 和 Gi0/0/1.2 建立直连 EBGP 邻居,接入 PE2。CE2 通过 Gi0/0/1.2 向 PE2 通告的 BGP update 中,某些路由的 as-path 中有 200。在 CE2 上,将 OSPF 路由导入 BGP。
PE2 的配置命令:
Interface gi0/0/1.1
Ip binding -instance VPN1_IN
Ip address 10.2.22.2 30
Arp broadcast enable
Quit
Interface gi0/0/1.2
Ip binding -instance VPN1_OUT
Ip address 10.2.22.6 30
Arp broadcast enable
Quit
Bgp 100
Ipv4-family -instance VPN1_IN
Peer 10.2.22.1 as-number 65000
Quit
Ipv4-family -instance VPN1_OUT
Peer 10.2.22.5 as-number 65000
Peer 10.2.22.5 allow-as-loop
Quit
CE2 的配置命令:
Interface gi0/0/1.1
Arp broadcast enable
Quit
Interface gi0/0/1.2
Arp broadcast enable
Quit
Bgp 65000
Peer 10.2.22.2 as-number 100
Peer 10.2.22.6 as-number 100
Import-route ospf 1 med 0
q
CE3 通过 OSPF 区域 1 接入 PE3,通过 PE3–CE3 的逻辑接口互通,宣告 CE3 的各回环口; CE4 通过 OSPF 区域 0 接入 PE4,通过 PE4-CE4 的 Gi0/0/1 的接口互通,通过 CE4 的各接口。
PE3 的 VPN1 启用 OSPF 协议:
Ospf 2 -instance VPN1
Area 1
Network 10.2.33.2 0.0.0.0
Quit
Quit
CE3 的 OSPF 协议:
Ospf 2
Area 1
Network 10.2.33.1 0.0.0.0
Network 172.17.1.3 0.0.0.0
Network 10.3.3.3 0.0.0.0
Quit
Quit
PE4 的 VPN1 的配置,并启用 OSPF 协议:
Ip -instance VPN1
Route-distinguisher 100:14
Vpn-target 100:1 export-extcommunity
Vpn-target 200:1 import-extcommunity
Quit
Interface gi0/0/1
Ip binding -instance VPN1
Ip address 10.2.41.2 30
Quit
Ospf 2 -instance VPN1
Area 0
Network 10.2.41.2 0.0.0.0
Quit
CE4 的 OSPF 协议:
Ospf 2 -instance VPN1
Vpn-instance-capability simple
Area 0
Network 10.2.41.1 0.0.0.0
Network 10.3.3.4 0.0.0.0
Network 172.17.1.4 0.0.0.0
Quit
如图 4,在 AS 100、AS 200 内建立 IBGP IPv4 邻居关系:RR1 是 PE1/PE2/P1/ASBR1/ASBR2 的反射器;RR2 是 PE3/PE4/P2/ASBR3/ASBR4 的反射器;ASBR1–ASBR3、ASBR2–ASBR4 建立 EBGP IPv4 邻居关系。(已预配)
解析:
注意,在考试过程中,AS 100 和 AS 200 内部的,以及 AS 之间的 IPv4 的 BGP 邻居关系, 都已经配置完成了,并且没有错误。我们需要做的,仅仅是需要“查看一下每个 BGP 邻居 是否正常建立。一般都是正常“建立”的状态”。
在 ASBR 上,将 ISIS 的 Loopback0 路由引入 BGP。
解析:
注意,我们做完这个需求的主要目的是为让 RR1 和 RR2,能够互相学习到对方的 Loopback 0 的路由条目,为的就是可以在 RR1 和 RR2 之间建立 VPNv4 的 EBGP 邻居关系。
AS100 的回环口路由进入到 AS200:( ASBR1–>ASBR3)
ASBR1 上面的配置:
Ip ip-prefix 32 permit 172.16.1.1 32
Ip ip-prefix 32 permit 172.16.1.3 32
Ip ip-prefix 32 permit 172.16.1.4 32
Ip ip-prefix 32 permit 172.16.1.5 32
Ip ip-prefix 32 permit 172.16.1.6 32
Ip ip-prefix 32 permit 172.16.1.20 32
Route-policy ISIS-BGP permit node 10
If-match ip-prefix 32
Quit
Bgp 100
Import-route isis 1 route-policy ISIS-BGP
q
AS100 的回环口路由进入到 AS200:( ASBR2–>ASBR4)
ASBR2 上面的配置:
Ip ip-prefix 32 permit 172.16.1.1 32
Ip ip-prefix 32 permit 172.16.1.3 32
Ip ip-prefix 32 permit 172.16.1.4 32
Ip ip-prefix 32 permit 172.16.1.5 32
Ip ip-prefix 32 permit 172.16.1.6 32
Ip ip-prefix 32 permit 172.16.1.20 32
Route-policy ISIS-BGP permit node 10
If-match ip-prefix 32
Quit
Bgp 100
Import-route isis 1 route-policy ISIS-BGP
Quit
AS200 的回环口路由进入到 AS100:( ASBR3–>ASBR1)
ASBR3 上面的配置:
Ip ip-prefix 32 permit 172.16.1.7 32
Ip ip-prefix 32 permit 172.16.1.8 32
Ip ip-prefix 32 permit 172.16.1.9 32
Ip ip-prefix 32 permit 172.16.1.10 32
Ip ip-prefix 32 permit 172.16.1.11 32
Ip ip-prefix 32 permit 172.16.1.2 32
Route-policy ISIS-BGP permit node 10
If-match ip-prefix 32
Quit
Bgp 200
Import-route isis 1 route-policy ISIS-BGP
Quit
AS200 的回环口路由进入到 AS100:( ASBR4–>ASBR2)
ASBR4 上面的配置:
Ip ip-prefix 32 permit 172.16.1.7 32
Ip ip-prefix 32 permit 172.16.1.8 32
Ip ip-prefix 32 permit 172.16.1.9 32
Ip ip-prefix 32 permit 172.16.1.10 32
Ip ip-prefix 32 permit 172.16.1.11 32
Ip ip-prefix 32 permit 172.16.1.2 32
Route-policy ISIS-BGP permit node 10
If-match ip-prefix 32
Quit
Bgp 200
Import-route isis 1 route-policy ISIS-BGP
Quit
注意!
即使现在的两个回环接口可以互相访问,但是在 RR1 和 RR2 之间的 MP-EBGP 邻居关 系,依然存在问题:MP-EBGP 邻居可以建立,但是 VPNv4 路由是不会互相传递的。
原因: 因为 VPNv4 路由的下一跳都是对端的 Loopback 0 接口 IP 地址,而这些地址在本地设 备上都是 BGP 路由,但是这些 BGP 路由是没有标签的。所以导致已经建立好的 RR1-RR2 之间的 MP-EBGP 邻居关系是不会进行 VPNv4 路由传递的。
所以,接下来需要在 AS100 和 AS200 的 ASBR 之间进行传递 IPv4 路由的时候,配置 MPLS-Lable 。( label-route-capability 用来使能发送标签路由能力)
AS100 - AS 200 : (ASBR1—ASBR3)
ASBR1:
Route-policy ASBR1-ASBR3 permit node 10
Apply mpls-label
Quit
Bgp 100
Peer 10.1.57.2 route-policy ASBR1-ASBR3 export
Peer 10.1.57.2 label-route-capability
Quit
ASBR3:
Route-policy ASBR3-RR2 permit node 10
If-match mpls-label
Apply mpls-label
Quit
Bgp 200
Peer 172.16.1.9 route-policy ASBR3-RR2 export
Peer 172.16.1.9 label-route-capability
RR2:
Bgp 200
Peer 172.16.1.7 label-route-capability
q
AS100 - AS 200 : (ASBR2—ASBR4)
ASBR2:
Route-policy ASBR2-ASBR4 permit node 10
Apply mpls-label
Quit
Bgp 100
Peer 10.1.68.2 route-policy ASBR2-ASBR4 export
Peer 10.1.68.2 label-route-capability
Quit
ASBR4:
Route-policy ASBR4-RR2 permit node 10
If-match mpls-label
Apply mpls-label
Quit
Bgp 200
Peer 172.16.1.9 route-policy ASBR4-RR2 export
Peer 172.16.1.9 label-route-capability
RR2:
Bgp 200
Peer 172.16.1.8 label-route-capability
q
AS200 - AS 100 : (ASBR3—ASBR1)
ASBR3:
Route-policy ASBR3-ASBR1 permit node 10
Apply mpls-label
Quit
Bgp 200
Peer 10.1.57.1 route-policy ASBR3-ASBR1 export
Peer 10.1.57.1 label-route-capability
Quit
ASBR1:
Route-policy ASBR1-RR1 permit node 10
If-match mpls-label
Apply mpls-label
Quit
Bgp 100
Peer 172.16.1.3 route-policy ASBR1-RR1 export
Peer 172.16.1.3 label-route-capability
RR1:
Bgp 100
Peer 172.16.1.5 label-route-capability
q
AS200 - AS 100 : (ASBR4—ASBR2)
ASBR4:
Route-policy ASBR4-ASBR2 permit node 10
Apply mpls-label
Quit
Bgp 200
Peer 10.1.68.1 route-policy ASBR4-ASBR2 export
Peer 10.1.68.1 label-route-capability
Quit
ASBR2:
Route-policy ASBR2-RR1 permit node 10
If-match mpls-label
Apply mpls-label
Quit
Bgp 100
Peer 172.16.1.3 route-policy ASBR2-RR1 export
Peer 172.16.1.3 label-route-capability
RR1:
Bgp 100
Peer 172.16.1.6 label-route-capability
q
同时,我们需要在 RR1 和 RR2 上,对其他的客户端也要配置 label-route-capability
RR1:
Bgp 100
Peer 172.16.1.1 label-route-capability
Peer 172.16.1.20 label-route-capability
Peer 172.16.1.4 label-route-capability
PE1/PE2/P1:
Bgp 100
Peer 172.16.1.3 label-route-capability
RR2:
Bgp 200
Peer 172.16.1.10 label-route-capability
Peer 172.16.1.11 label-route-capability
Peer 172.16.1.2 label-route-capability
PE3/PE4/P2:
Bgp 200
Peer 172.16.1.9 label-route-capability
另外,我们需要在 ASBR 之间的链路上启用 MPLS : ASBR1/2/3/4:
Interface gi0/0/2
Mpls
Q
到此时为止,RR1 和 RR2 之间的回环口应该是可以互相访问的 【ping -a 172.16.1.3 172.16.1.9,测试应该是通的】
如图 3,AS 100、AS 200 内各网元配置 MPLS LSR-ID,全局使能 MPLS,MPLS LDP(预配)。 AS100、AS200 内各直连链路建立 LDP 邻居(除 PE1-RR1 之间的链路外,其他已预先配置)。
解析:
注意,关于每个 AS 内部的 MPLS 和 MPLS-LDP 都已经配置完成了。我们需要做的仅仅配 置 AS 100 内的 PE1–RR1 之间的虚拟链路:
PE1/RR1:
Interface ip-trunk 13
Mpls
Mpls ldp
Quit
如图 4,各站点通过 MPLS BGP VPN 跨域 Option C 方案 1,能够互相学习路由。MPLS 域 不能出现次优路径。
解析:
首先,我们需要在 RR1 和 RR2 之间建立 VPNv4 BGP 邻居(不需要 IPv4 BGP 邻居)难点 (Undo policy -target 关闭RT的过滤功能) 建立v4邻居关系一定要关闭ipv4的!
RR1 的配置:
Bgp 100
Peer 172.16.1.9 as-number 200
Peer 172.16.1.9 connect-interface loopback 0
Peer 172.16.1.9 ebgp-max-hop
Ipv4-family v4
Peer 172.16.1.9 enable
Undo policy -target
Quit
Ipv4-family unicast
Undo peer 172.16.1.9 enable
Quit
RR2 的配置:
Bgp 200
Peer 172.16.1.3 as-number 100
Peer 172.16.1.3 connect-interface loopback 0
Peer 172.16.1.3 ebgp-max-hop
Ipv4-family v4
Peer 172.16.1.3 enable
Peer 172.16.1.3 allow-as-loop
Undo policy -target
Quit
Ipv4-family unicast
Undo peer 172.16.1.3 enable
Quit
其次,需要在 RR 和 PE 之间建立 VPNv4 BGP 邻居关系(reflect-client 指定自己的反射客户端)
RR1 的配置:
Bgp 100
Ipv4-family v4
Peer 172.16.1.1 enable
Peer 172.16.1.1 reflect-client
Peer 172.16.1.20 enable
Peer 172.16.1.20 reflect-client
Peer 172.16.1.4 enable
Peer 172.16.1.4 reflect-client
Peer 172.16.1.5 enable
Peer 172.16.1.5 reflect-client
Peer 172.16.1.6 enable
Peer 172.16.1.6 reflect-client
Quit
PE1/PE2/P1/ASBR1/ASBR2:
Bgp 100
Ipv4-family v4
Peer 172.16.1.3 enable
RR2 的配置:
Bgp 200
Ipv4-family v4
Peer 172.16.1.11 enable
Peer 172.16.1.11 reflect-client
Peer 172.16.1.2 enable
Peer 172.16.1.2 reflect-client
Peer 172.16.1.7 enable
Peer 172.16.1.7 reflect-client
Peer 172.16.1.8 enable
Peer 172.16.1.8 reflect-client
Peer 172.16.1.10 enable
Peer 172.16.1.10 reflect-client
Quit
PE3/PE4/P2/ASBR3/ASBR4:
Bgp 200
Ipv4-family v4
Peer 172.16.1.9 enable
再次,在 PE 上将从 CE 学习过来的路由,导入到 MP-BGP 协议
PE3 的配置:
Bgp 200
Ipv4-family -instance VPN1
Import-route ospf 2
Quit
PE4 的配置:
Bgp 200
Ipv4-family -instance VPN1
Import-route ospf 2
Quit
最后,将从总部 PE 学习过来的路由,导入到分部的 PE-CE 之间的 OSPF 协议中
PE3 的配置:
Ospf 2
Import-route bgp
PE4 的配置:
Ospf 2
Import-route bgp
CE4 的配置:
Ospf 2
Vpn-instance-capability simple
Quit
验证:用CE3 ping -a 172.17.1.3 172.17.1.4 display ip routing-table -instance VPN1(CE4上查
看路由)
注意:
关于总部的 PE-CE 之间的路由传递是不需要手动导入的,因为总部的 PE-CE 之间的路由协议是 BGP 协议,PE 会将从总部 CE 学习过来的 BGP 路由,自动的导入到总部 连接的 PE 中。
为了让分部与总部之间的数据,在 MPLS 域内转发的时候没有转发的次优路径, 我们需要确保 MPLS-VPN 路由,在传递过程中,是不能更改下一跳 IP 地址的。 所以我们需要在所有的 MPLS-VPN 邻居关系之间配置: 下一跳 IP 地址不变 的特性。
AS100:
RR1:
BGP 100
ipv4-family v4
Peer 172.16.1.1 next-hop-invariable
Peer 172.16.1.4 next-hop-invariable
Peer 172.16.1.5 next-hop-invariable
Peer 172.16.1.6 next-hop-invariable
Peer 172.16.1.20 next-hop-invariable
Peer 172.16.1.9 next-hop-invariable
AS200:
RR2:
BGP 200
ipv4-family v4
Peer 172.16.1.7 next-hop-invariable
Peer 172.16.1.8 next-hop-invariable
Peer 172.16.1.10 next-hop-invariable
Peer 172.16.1.11 next-hop-invariable
Peer 172.16.1.2 next-hop-invariable
Peer 172.16.1.3 next-hop-invariable
验证:CE3 tracert -a 172.17.1.3 172.17.1.4
解决问题 2:
次优路径 在 CE1/2 的 BGP 进程下,将 EBGP 路由的优先级修改为小于 OSPF 外部路由的优先级;
我们建议选择修改为 120 (默认是 255) 命令如下:
CE1/2
Bgp 65000
Preference 120 255 255
Quit
13. 在 PE3/PE4 上修改 BGP Local-preference 属性,实现 CE3/CE4 访问非直连的 10.3.x.0/24 网段时,如果 X 为奇数,PE3/PE4 优选的下一跳为 PE1;如果 X 为偶数,PE3/PE4 优选的下 一跳为 PE2。不用考虑来回的路径是否一致。
配置思路: (首先明确:在 PE3/PE4 的策略配置是相同)
首先,抓取基数路由和偶数路由;
其次,抓取路由器的下一跳 IP 地址
再次,修改上述路由的优先级(3000)
PE3/4:
Acl 2000 // 匹配的是偶数路由
Rule 10 permit source 10.3.0.0 0.0.254.0
Acl 2001 // 匹配的是基数路由
Rule 10 permit source 10.3.1.0 0.0.254.0
Ip ip-prefix PE1 permit 172.16.1.1 32 匹配下一跳 IP 地址 172.16.1.1;
Ip ip-prefix PE2 permit 172.16.1.20 32 匹配下一跳 IP 地址 172.16.1.20;
Route-policy LOCAL permit node 10 // 抓取下一跳为 PE1 的基数路由,设置属性
If-match acl 2001
If-match ip next-hop ip-prefix PE1
Apply local-preference 3000
Quit
Route-policy LOCAL permit node 20 // 抓取下一跳为 PE2 的偶数路由,设置属性
If-match acl 2000
If-match ip next-hop ip-prefix PE2
Apply local-preference 3000
Quit
Route-policy LOCAL permit node 100 // 允许其他所有路由
Bgp 200
Ipv4-family v4
Peer 172.16.1.9 route-policy LOCAL import
4.1HA(高可用性)
4.3QOS 1. 在 CE1 的 Gi2/0/1、CE2 的 Gi2/0/2 的出方向,周一至周五的 8:00—18:00,对 TCP 目标 端口号为 6881 — 6999 的流量,承诺的平均速率为 1Mbps。
解析:
在 CE1/CE2 的 Gi2/0/1 /Gi2/0/2的接口上配置 流量监控
time-range work 08:00 to 18:00 working-day // 创建时间列表
acl number 3000
rule 5 permit tcp destination-port range 6881 6999 time-range work
quit
interface gi2/0/1
qos car outbound acl 3000 cir 1024
quit
在 CE2 的 Gi2/0/2 的接口上配置 流量监控(与 CE1 上面的配置完全相同)
2. CE4-PE4 的 QOS 规划如下所示
在 CE4 的 Gi0/0/1 的出方向对流量进行 802.1p 标记。在 PE4 的 Gi0/0/1 入方向,继承 CE4 的 802.1p 值,并将 802.1p 映射为 DSCP。
解析:
在 CE4 的 Gi0/0/1 的出方向 对流量进行 802.1P 标记。(先用ACL抓住数据包)(Traffic classifie调用ACL)(traffic behavior 行为 打 802.1P的标记)
acl name office advance
rule 5 permit ip destination 10.3.4.0 0.0.0.255
quit
acl name monitor advance
rule 5 permit ip destination 10.3.3.0 0.0.0.255
quit
acl name signal advance
rule 5 permit ip destination 10.3.2.0 0.0.0.255
quit
acl name realtime advance
rule 5 permit ip destination 10.3.1.0 0.0.0.255
quit
Traffic classifier Office
if-match acl office
quit
traffic classifier Monitor
if-match acl monitor
quit
traffic classifier Signal
if-match acl signal
quit
traffic classifier RealTime
if-match acl realtime
quit
traffic behavior Office
remark 8021p 2
quit
traffic behavior Monitor
remark 8021p 3
quit
traffic behavior Signal
remark 8021p 4
quit
traffic behavior RealTime
remark 8021p 5
quit
traffic behavior Other
remark 8021p 0
quit
traffic policy Remark
classifier Signal behavior Signal
classifier Office behavior Office
classifier Monitor behavior Monitor
classifier RealTime behavior RealTime
classifier default-class behavior Other ---->不要忘记!
quit
CE4: 调用 Traffic Policy
interface gi0/0/1
traffic-policy Remark outbound
quit
在 PE4 的 gi0/0/1 的入方向,继承 CE4 的 802.1p 值,并将其转化 为 DSCP 。
qos map-table dot1p-dscp
input 5 output 46
input 4 output 32
input 3 output 24
input 2 output 16
input 0 output 0
interface gi0/0/1
trust 8021p override
3. PE4 的 Gi0/0/0 和 Gi0/0/2 匹配 DSCP 值,根据表-1(上述表格)配置拥塞管理和拥塞避 免。
解析:
在 PE4 上配置 WRED 丢弃模板。
drop-profile cs4
wred dscp
dscp cs4 low-limit 70 high-limit 100 discard-percentage 50
quit
drop-profile cs3
wred dscp
dscp cs3 low-limit 50 high-limit 90 discard-percentage 50
quit
drop-profile cs2
wred dscp
dscp cs2 low-limit 50 high-limit 80 discard-percentage 50
quit
drop-profile default
wred dscp
dscp default low-limit 50 high-limit 80 discard-percentage 50
q
配置队列权重 和 套用 WRED 模板
qos queue-profile test
queue 0 weight 1
queue 2 weight 9
queue 3 weight 21
queue 4 weight 63
schedule wfq 0 to 4 pq 5
queue 0 drop-profile default
queue 2 drop-profile cs2
queue 3 drop-profile cs3
queue 4 drop-profile cs4
quit
interface gi0/0/0
qos queue-profile test
quit
解法:在 PE1 上 配置 ISIS 协议, 并配置链路开销。
isis 1
ipv6 enable topology ipv6
quit
interface loopback 0
isis ipv6 enable 1
quit
interface gi0/0/0
isis ipv6 enable 1
isis ipv6 cost 20
quit
interface ip-trunk 13
isis ipv6 enable 1
isis ipv6 cost 1550
quit
在 PE2 上配置 ISIS 协议, 并配置链路开销。
isis 1
ipv6 enable topology ipv6
quit
interface loopback 0
isis ipv6 enable 1
quit
interface gi0/0/0
isis ipv6 enable 1
isis ipv6 cost 20
quit
interface gi0/0/2
isis ipv6 enable 1
isis ipv6 cost 1550
quit
在 RR1 上配置 ISIS 协议, 并配置链路开销
isis 1
ipv6 enable topology ipv6
quit
interface loopback 0
isis ipv6 enable 1
quit
interface gi0/0/0
isis ipv6 enable 1
isis ipv6 cost 80
quit
interface gi0/0/1
isis ipv6 enable 1
isis ipv6 cost 860
quit
interface ip-trunk 13
isis ipv6 enable 1
isis ipv6 cost 1550
quit
在 P1 上配置 ISIS 协议, 并配置链路开销
isis 1
ipv6 enable topology ipv6
quit
interface loopback 0
isis ipv6 enable 1
quit
interface gi0/0/0
isis ipv6 enable 1
isis ipv6 cost 80
quit
interface gi0/0/1
isis ipv6 enable 1
isis ipv6 cost 1000
quit
interface gi0/0/2
isis ipv6 enable 1
isis ipv6 cost 1550
quit
在 ASBR1 上配置 ISIS ,并配置链路开销 (仅仅是 AS 100 的内部链路以及 loopback 启用 ISIS IPv6 ,AS 之间不需要启用)
isis 1
ipv6 enable topology ipv6
quit
interface loopback 0
isis ipv6 enable 1
quit
interface gi0/0/0
isis ipv6 enable 1
isis ipv6 cost 100
quit
interface gi0/0/1
isis ipv6 enable 1
isis ipv6 cost 860
quit
在 ASBR 2 上配置 ISIS 协议, 并配置链路开销
isis 1
ipv6 enable topology ipv6
quit
interface loopback 0
isis ipv6 enable 1
quit
interface gi0/0/0
isis ipv6 enable 1
isis ipv6 cost 100
quit
interface gi0/0/1
isis ipv6 enable 1
isis ipv6 cost 1000
quit
为了防止 IPv6 的 ISIS 路由的次优路径,在 RR1 上配置路由泄露,不泄露的 话,也会导致 IPv6 BGP 路由下一跳不可达,后续要求无法实现。
isis 1
ipv6 import-route isis level-2 into level-1
为了防止 IPv6 的 ISIS 路由的次优路径,在 P1 上配置路由泄露,不泄露的话, 也会导致 IPv6 BGP 路由下一跳不可达,后续要求无法实现。
isis 1
ipv6 import-route isis level-2 into level-1
5.3BGP(IPv6)