华为MPLS单域实验配置

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

目录

配置AS内的MPLS LDP协议

配置PE-PE之间的MP-BGP协议

在PE上配置VPN实例

在CE侧配置PE-CE的路由协议

在PE侧配置PE-CE的路由协议

在PE侧将CE的路由重发布进MP-BGP中

在CE侧将MP-BGP的路由重发布进CE中


MPLS隧道——单域基础理论讲解_静下心来敲木鱼的博客-CSDN博客https://blog.csdn.net/m0_49864110/article/details/127409932?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522167379205816800211545341%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=167379205816800211545341&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~rank_v31_ecpm-3-127409932-null-null.blog_rank_default&utm_term=mpls&spm=1018.2226.3001.4450

基础配置以AR1为例

配置接口IP地址

int g0/0/1

 ip add 100.0.17.1 24

int g0/0/0

 ip add 100.1.13.1 24

int g0/0/2

 ip add 100.0.16.1 24

int loop 0

 ip add 1.1.1.1 32

配置ISIS路由协议

isis 1

 net 49.0001.0000.0001.00

int g0/0/0

 isis enable 1

int loop 0

 isis enable 1

配置AS内的MPLS LDP协议

PE1

mpls lsr-id 1.1.1.1    配置本节点LSR ID

mpls                         使能全局MPLS

mpls ldp                   使能全局MPLS LDP

int g0/0/0

 mpls                         接口开启MPLS

 mpls ldp                   接口开启MPLS LDP

mpls

 lsp-trigger all            表示为所有路由建立LSP默认只为环回口建立

                                  此命令为非必选命令根据需要来选择配置

PE2

mpls lsr-id 2.2.2.2

mpls

mpls ldp

int g0/0/0

 mpls

 mpls ldp

P3

mpls lsr-id 3.3.3.3

mpls

mpls ldp

int g0/0/0

 mpls

 mpls ldp

int g0/0/1

 mpls

 mpls ldp

int g1/0/0

 mpls

 mpls ldp

PE4

mpls lsr-id 4.4.4.4

mpls

mpls ldp

int g0/0/0

 mpls

 mpls ldp

dis mpls ldp session  查看LDP会话信息

dis mpls lsp  查看LSP信息

配置PE-PE之间的MP-BGP协议

PE1

bgp 100

router-id 1.1.1.1

 peer 2.2.2.2 as 100

 peer 2.2.2.2 connect-interface Loop 0

 peer 4.4.4.4 as 100

 peer 4.4.4.4 connect-interface Loop 0

 ipv4-family unicast            关闭BGP IPv4单播邻居

  undo peer 2.2.2.2 enable

  undo peer 4.4.4.4 enable

 ipv4-family vpnv4               建立IPv4 MP-BGP邻居

  peer 2.2.2.2 enable

  peer 4.4.4.4 enable

PE2

bgp 100

router-id 2.2.2.2

 peer 1.1.1.1 as 100

 peer 1.1.1.1 connect-interface Loop 0

 peer 4.4.4.4 as 100

 peer 4.4.4.4 connect-interface Loop 0

 ipv4-family unicast

  undo peer 1.1.1.1 enable

  undo peer 4.4.4.4 enable

 ipv4-family vpnv4

  peer 1.1.1.1 enable

  peer 4.4.4.4 enable

PE4

bgp 100

router-id 4.4.4.4

 peer 1.1.1.1 as 100

 peer 1.1.1.1 connect-interface Loop 0

 peer 2.2.2.2 as 100

 peer 2.2.2.2 connect-interface Loop 0

 ipv4-family unicast

  undo peer 1.1.1.1 enable

  undo peer 2.2.2.2 enable

 ipv4-family vpnv4

  peer 1.1.1.1 enable

  peer 2.2.2.2 enable

dis bgp vpnv4 all peer 查看MP-BGP邻居建立状态

在PE上配置VPN实例

根据题目需求定义以下实例实现172互访、192互访、172与192不互访172和192与10互访

PE1

ip vpn-instance CE7                  定义实例CE7

 ipv4-family

  route-distinguisher 17:1           RD值为17:1

  vpn-target 100:1 300:1 im        接收RT值为100:1、300:1的路由

  vpn-target 100:1 ex                  发布的路由RT值为100:1

int g0/0/1

 ip bind vpn-instance CE7         在接口绑定VPN实例

 ip add 100.0.17.1 24                接口绑定实例后IP地址会消除需重新配置

ip vpn-instance CE6

 ipv4-family

  route-distinguisher 16:1

  vpn-target 200:1 300:1 im

  vpn-target 200:1 ex

int g0/0/2

 ip bind vpn-instance CE6

 ip add 100.0.16.1 24

PE2

ip vpn-instance CE8

 ipv4-family

  route-distinguisher 28:1

  vpn-target 100:1 200:1 im

  vpn-target 300:1 ex

int g0/0/1

 ip bind vpn-instance CE8

 ip add 100.0.28.2 24

PE4通过子接口实现

ip vpn-instance CE9-1

 ipv4-family

  route-distinguisher 49:1

  vpn-target 100:1 300:1 im

  vpn-target 100:1 ex

int g0/0/1.10

 ip bind vpn-instance CE9-1

 ip add 100.1.49.4 24

ip vpn-instance CE9-2

 ipv4-family

  route-distinguisher 49:2

  vpn-target 200:1 300:1 im

  vpn-target 200:1 ex

int g0/0/1.20

 ip bind vpn-instance CE9-2

 ip add 100.2.49.4 24

dis ip vpn-instance verbose  查看配置实例的详细信息

在CE侧配置PE-CE的路由协议

CE6

ospf 1

 area 0

  net 100.0.16.6 0.0.0.0

  net 192.168.1.0 0.0.0.255

CE7

ospf 1

 area 0

  net 100.0.17.7 0.0.0.0

  net 172.16.1.0 0.0.0.255

CE8

ip route-static 0.0.0.0 0 100.0.28.2

CE9

bgp 200

 peer 100.1.49.4 as 100

 peer 100.2.49.4 as 100

 network 172.16.3.0 24

 network 192.168.3.0 24

在PE侧配置PE-CE的路由协议

PE1

ospf 1 vpn-instance CE7                建立基于实例的OSPF邻居

 area 0

  net 100.0.17.1 0.0.0.0

ospf 2 vpn-instance CE6

 area 0

  net 100.0.16.1 0.0.0.0

PE2

ip route-static vpn-instance CE8 10.0.0.1 24 100.0.28.8

PE4

bgp 100

 ipv4-family vpn-instance CE9-1    建立基于实例的BGP邻居

  peer 100.1.49.9 as-number 200

 ipv4-family vpn-instance CE9-2

  peer 100.2.49.9 as-number 200

dis ip routing-table vpn-instance CE6  查看实例路由

此时发现在PE的实例中已经存在CE的路由了

在PE侧将CE的路由重发布进MP-BGP中

PE1

bgp 100

 ipv4-family vpn-instance CE7   在相应的实例中引入相应的路由

  import ospf 1

 ipv4-family vpn-instance CE6

  import ospf 2

PE2

bgp 100

 ipv4-family vpn-instance CE8

  import static

PE4

由于PE4与CE之间运行的时BGP协议所以不需要再做额外的操作

不过此处为了满足总部和分部的172、192网段不能互访的要求需要在此处做过滤路由的操作在172所在实例过滤192路由在192所在实例过滤172路由

CE9的路由传入CE9-1实例时只接收172网段的路由

定义ACL匹配172

acl number 2000

 rule 5 permit source 172.16.3.0 0.0.0.255

 rule 10 deny

通过路由策略绑定ACL

route-policy CE9-1 permit node 10

 if-match acl 2000

在BGP对指定邻居使用路由策略入方向

bgp 100

 ipv4-family vpn-instance CE9-1

  peer 100.1.49.9 route-policy CE9-1 import

CE9的路由传入CE9-2实例时只接收192网段的路由

定义ACL匹配192

acl number 2001

 rule 5 permit source 192.168.3.0 0.0.0.255

 rule 10 deny

通过路由策略绑定ACL

route-policy CE9-2 permit node 10

 if-match acl 2001

在BGP对指定邻居使用路由策略入方向

bgp 100

 ipv4-family vpn-instance CE9-2

  peer 100.2.49.9 as-number 200

  peer 100.2.49.9 route-policy CE9-2 import

dis bgp vpnv4 all routing-table 查看VPNV4路由

此时已经获取到其它站点的路由

在CE侧将MP-BGP的路由重发布进CE中

PE1

ospf 1

 import bgp

ospf 2

 import bgp

PE2为静态路由不需要引入CE8通过缺省就可以访问

PE4与CE9为BGP邻居也不需要做额外操作

dis ip routing-table 在CE上查看路由表

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6