LDP配置

2023-11-05 14:38
文章标签 配置 ldp

本文主要是介绍LDP配置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

LDP配置

  • 一、拓普
  • 二、配置接口IP及IGP
    • R1
    • R2
    • R3
    • R4
  • 三、域内LDP配置
    • R1-R4
    • 配置标签范围
  • 四、在PE设置上配置VRF
    • R1、R4
  • BGP传递VVVV4路由
    • R1
    • R4
  • 采用静态路由和RIP接入MPLS网络
    • R1、R10之间配置静态
      • R1配置
      • R10配置
    • R4、R9之间配置RIP
      • R4配置
      • R9配置
  • 采用EIGRP接入MPLS网络
    • R1
    • R3
    • R4
    • R9、R10
  • 其他可能用到的配置
  • 验证

一、拓普

在这里插入图片描述

二、配置接口IP及IGP

R1

router ospf 1router-id 1.1.1.1
interface Loopback0ip address 1.1.1.0 255.255.255.255ip ospf 1 area 0
interface Loopback1ip address 1.1.1.1 255.255.255.255
interface Loopback2ip address 1.1.1.2 255.255.255.255
interface Ethernet0/0ip address 10.1.5.1 255.255.255.0
interface Ethernet0/1ip address 10.1.3.1 255.255.255.0ip ospf 1 area 0
interface Ethernet0/2ip address 10.1.2.1 255.255.255.0ip ospf 1 area 0
interface Ethernet0/3ip address 10.1.10.1 255.255.255.0
interface Serial1/0ip address 10.1.4.1 255.255.255.0ip ospf 1 area 0serial restart-delay 0

R2

router ospf 1router-id 2.2.2.2
interface Loopback0ip address 2.2.2.0 255.255.255.255ip ospf 1 area 0
interface Loopback1ip address 2.2.2.1 255.255.255.255
interface Loopback2ip address 2.2.2.2 255.255.255.255
interface Ethernet0/0ip address 10.2.3.2 255.255.255.0ip ospf 1 area 0
interface Ethernet0/1ip address 10.2.56.2 255.255.255.0
interface Ethernet0/2ip address 10.1.2.2 255.255.255.0ip ospf 1 area 0
interface Serial1/0ip address 10.2.6.2 255.255.255.0serial restart-delay 0
interface Serial1/1ip address 10.2.4.2 255.255.255.0ip ospf 1 area 0serial restart-delay 0

R3

router ospf 1router-id 3.3.3.3
interface Loopback0ip address 3.3.3.0 255.255.255.255ip ospf 1 area 0
interface Loopback1ip address 3.3.3.1 255.255.255.255
interface Loopback2ip address 3.3.3.2 255.255.255.255
interface Ethernet0/0ip address 10.2.3.3 255.255.255.0ip ospf 1 area 0
interface Ethernet0/1ip address 10.1.3.3 255.255.255.0ip ospf 1 area 0
interface Ethernet0/2ip address 10.3.4.3 255.255.255.0ip ospf 1 area 0
interface Serial1/0ip address 10.3.8.3 255.255.255.0serial restart-delay 0

R4

router ospf 1router-id 4.4.4.4 
interface Loopback0ip address 4.4.4.0 255.255.255.255ip ospf 1 area 0
interface Loopback1ip address 4.4.4.1 255.255.255.255
interface Loopback2ip address 4.4.4.2 255.255.255.255
interface Ethernet0/0ip address 10.4.9.4 255.255.255.0
interface Ethernet0/2ip address 10.3.4.4 255.255.255.0ip ospf 1 area 0
interface Serial1/0ip address 10.1.4.4 255.255.255.0ip ospf 1 area 0serial restart-delay 0
interface Serial1/1ip address 10.2.4.4 255.255.255.0ip ospf 1 area 0serial restart-delay 0

三、域内LDP配置

R1-R4

//开启CEF,默认开启
R1(config)#ip cef  
//配置MPLS逐跳转发,默认开启
R1(config)#mpls ip 
//配置在所有接口上使用LDP为提供MPLS的标签交换。LDP是缺省值。接口下配置会覆盖全局配置。
R1(config)#mpls label protocol ldp  
//指定LDP的router-id,一般情况下此ID必需为32位主机地址,就是说必需为环回口
R1(config)#mpls ldp router-id loopback 0 force
//R1-R4互联的物理接口下启用MPLS
interface Ethernet x/xmpls ip

配置标签范围

R1 100-199
R2 200-299
R3 300-399
R4 400-499
//生产环境不需要配置
//配置后发现不会生效,重置LDP邻居关系后也不行
//全局下no mpls ip再开启后生效
R1(config)#mpls label range 100 199Label range change will cause 6 labels in the old dynamic range [16-100000] to go out of range

四、在PE设置上配置VRF

R1、R4

//创建VRF实例
ip vrf WRTENG
//配置rd值,此数值应全局唯一rd 100:134//配置route-targetroute-target export 100:134route-target import 100:134
interface Ethernet0/0//将与CE连接的接口划分到VRF中,此命令会移除接口原有的IP地址ip vrf forwarding WRTENGip address 10.4.9.4 255.255.255.0

BGP传递VVVV4路由

R1

router bgp 100bgp log-neighbor-changesnetwork 10.1.10.0 mask 255.255.255.0neighbor 4.4.4.0 remote-as 100neighbor 4.4.4.0 update-source Loopback0!address-family vvvv4neighbor 4.4.4.0 activateneighbor 4.4.4.0 send-community extendedexit-address-family!address-family ipv4 vrf WRTENGnetwork 10.1.10.0 mask 255.255.255.0exit-address-family

R4

router bgp 100bgp log-neighbor-changesneighbor 1.1.1.0 remote-as 100neighbor 1.1.1.0 update-source Loopback0!address-family vvvv4neighbor 1.1.1.0 activateneighbor 1.1.1.0 send-community extendedexit-address-family!address-family ipv4 vrf WRTENGnetwork 10.4.9.0 mask 255.255.255.0exit-address-family

采用静态路由和RIP接入MPLS网络

R1、R10之间配置静态

R1配置

ip route vrf WRTENG 10.10.10.0 255.255.255.252 10.1.10.10
router bgp 100address-family ipv4 vrf WRTENG//将前往R10静态路由传给R1redistribute static

R10配置

interface Loopback0ip address 10.10.10.0 255.255.255.255
interface Loopback1ip address 10.10.10.1 255.255.255.255
interface Loopback2ip address 10.10.10.2 255.255.255.255
interface Ethernet0/3ip address 10.1.10.10 255.255.255.0
//配置前往R9的路由
ip route 9.9.9.0 255.255.255.252 10.1.10.1

R4、R9之间配置RIP

R4配置

router rip!address-family ipv4 vrf WRTENG//将R10的路由信息传给R9redistribute bgp 100 metric 1network 10.0.0.0no auto-summaryversion 2exit-address-familyrouter bgp 100address-family ipv4 vrf WRTENG//将R9的路由信息传给R1redistribute ripexit-address-family

R9配置

interface Loopback0ip address 9.9.9.0 255.255.255.255
interface Loopback1ip address 9.9.9.1 255.255.255.255
interface Loopback2ip address 9.9.9.2 255.255.255.255
interface Ethernet0/0ip address 10.4.9.9 255.255.255.0
interface Ethernet0/1ip address 10.8.9.9 255.255.255.0router ripversion 2network 9.0.0.0network 10.0.0.0no auto-summary

采用EIGRP接入MPLS网络

R1

router bgp 100no bgp default ipv4-unicast!address-family vvvv4neighbor 3.3.3.0 activateneighbor 3.3.3.0 send-community extendedneighbor 3.3.3.0 route-reflector-clientneighbor 4.4.4.0 activateneighbor 4.4.4.0 send-community extendedneighbor 4.4.4.0 route-reflector-clientexit-address-family!address-family ipv4 vrf WRTENGnetwork 10.1.10.0 mask 255.255.255.0redistribute connectedredistribute staticexit-address-family

R3

route-map SOO permit 10set extcommunity soo 100:89
!interface Serial1/0ip vrf forwarding WRTENGip vrf sitemap SOOip address 10.3.8.3 255.255.255.0serial restart-delay 0router eigrp 90!address-family ipv4 vrf WRTENG autonomous-system 90redistribute bgp 100 metric 100000 10 255 1 1500network 0.0.0.0exit-address-familyrouter bgp 100bgp log-neighbor-changesno bgp default ipv4-unicast!address-family vvvv4neighbor 1.1.1.0 activateneighbor 1.1.1.0 send-community extendedexit-address-family!address-family ipv4 vrf WRTENGredistribute eigrp 90exit-address-family

R4

//删除RIP
router eigrp 90!address-family ipv4 vrf WRTENG autonomous-system 90redistribute bgp 100 metric 100000 10 255 1 1500network 0.0.0.0exit-address-familyrouter bgp 100bgp log-neighbor-changesneighbor 1.1.1.0 remote-as 100neighbor 1.1.1.0 update-source Loopback0!address-family vvvv4neighbor 1.1.1.0 activateneighbor 1.1.1.0 send-community extendedexit-address-family!address-family ipv4 vrf WRTENGnetwork 10.4.9.0 mask 255.255.255.0redistribute eigrp 90exit-address-familyroute-map SOO permit 10set extcommunity soo 100:89interface Ethernet0/0ip vrf forwarding WRTENGip vrf sitemap SOOip address 10.4.9.4 255.255.255.0

R9、R10

router eigrp 90network 0.0.0.0

其他可能用到的配置

//更改传输端口(传输端口于用建立LDP邻居,默认情况下使用Route-id)
//指定e0/0端口作为LDP的传输端口
R1(config)#int e0/0
R1(config-if)#mpls ldp discovery transport-address interface 
//关闭TTL繁衍
R1(config)#no mpls ip propagate-ttl forwarded //所有PE设备

验证

R4#traceroute 2.2.2.0                             
Type escape sequence to abort.
Tracing the route to 2.2.2.0
VRF info: (vrf in name/id, vrf out name/id)// [MPLS: Label 17 Exp 0]1 10.3.4.3 [MPLS: Label 17 Exp 0] 0 msec 1 msec 0 msec2 10.2.3.2 0 msec *  1 msecR4#traceroute mpls ipv4 2.2.2.0/32 source 4.4.4.0 
Tracing MPLS Label Switched Path to 2.2.2.0/32, timeout is 2 secondsCodes: '!' - success, 'Q' - request not sent, '.' - timeout,'L' - labeled output interface, 'B' - unlabeled output interface, 'D' - DS Map mismatch, 'F' - no FEC mapping, 'f' - FEC mismatch,'M' - malformed request, 'm' - unsupported tlvs, 'N' - no label entry, 'P' - no rx intf label prot, 'p' - premature termination of LSP, 'R' - transit router, 'I' - unknown upstream index,'X' - unknown return code, 'x' - return code 0Type escape sequence to abort.0 10.3.4.4 MRU 1500 [Labels: 301 Exp: 0]
L 1 10.3.4.3 MRU 1504 [Labels: implicit-null Exp: 0] 41 ms
! 2 10.2.3.2 17 ms//验证接口已配置为使用LDP或TDP。
R4#show mpls interfaces 
Interface              IP            Tunnel   BGP Static Operational
Ethernet0/2            Yes (ldp)     No       No  No     Yes        
Serial1/0              Yes (ldp)     No       No  No     Yes        
Serial1/1              Yes (ldp)     No       No  No     Yes   //验证接口是否已启动并且正在发送发现Hello消息。
R4#show mpls ldp discovery Local LDP Identifier:4.4.4.0:0Discovery Sources:Interfaces:Ethernet0/2 (ldp): xmit/recvLDP Id: 3.3.3.0:0Serial1/0 (ldp): xmit/recvLDP Id: 1.1.1.0:0Serial1/1 (ldp): xmit/recvLDP Id: 2.2.2.0:0//验证LDP邻居状态
R4#show mpls ldp neighbor Peer LDP Ident: 3.3.3.0:0; Local LDP Ident 4.4.4.0:0TCP connection: 3.3.3.0.646 - 4.4.4.0.43213State: Oper; Msgs sent/rcvd: 30/30; DownstreamUp time: 00:12:33LDP discovery sources:Ethernet0/2, Src IP addr: 10.3.4.3Addresses bound to peer LDP Ident:10.2.3.3        10.1.3.3        10.3.4.3        10.3.8.3        3.3.3.0         3.3.3.1         3.3.3.2         Peer LDP Ident: 1.1.1.0:0; Local LDP Ident 4.4.4.0:0TCP connection: 1.1.1.0.646 - 4.4.4.0.39048State: Oper; Msgs sent/rcvd: 30/30; DownstreamUp time: 00:12:33LDP discovery sources:Serial1/0, Src IP addr: 10.1.4.1Addresses bound to peer LDP Ident:10.1.5.1        10.1.3.1        10.1.2.1        10.1.10.1       10.1.4.1        1.1.1.0         1.1.1.1         1.1.1.2         Peer LDP Ident: 2.2.2.0:0; Local LDP Ident 4.4.4.0:0TCP connection: 2.2.2.0.646 - 4.4.4.0.28984State: Oper; Msgs sent/rcvd: 30/31; DownstreamUp time: 00:12:33LDP discovery sources:Serial1/1, Src IP addr: 10.2.4.2Addresses bound to peer LDP Ident:10.2.3.2        10.2.56.2       10.1.2.2        10.2.6.2        10.2.4.2        2.2.2.0         2.2.2.1         2.2.2.2 R2#sho ip cef 4.4.4.0 detail 
4.4.4.0/32, epoch 0local label info: global/202nexthop 10.2.3.3 Ethernet0/0 label 302//查看已经发现的LDP邻居
R1#show mpls ldp discovery Local LDP Identifier:1.1.1.0:0Discovery Sources:Interfaces:Ethernet0/1 (ldp): xmit/recvLDP Id: 3.3.3.0:0Ethernet0/2 (ldp): xmit/recvLDP Id: 2.2.2.0:0Serial1/0 (ldp): xmit/recvLDP Id: 4.4.4.0:0//查看VRF
R4#show ip vrf brief Name                             Default RD            InterfacesWRTENG                           100:134               Et0/0
R4#show ip vrf detail 
VRF WRTENG (VRF Id = 1); default RD 100:134; default vvvID <not set>Old CLI format, supports IPv4 onlyFlags: 0xCInterfaces:Et0/0                   
Address family ipv4 unicast (Table ID = 0x1):Flags: 0x0Export vvv route-target communitiesRT:100:134              Import vvv route-target communitiesRT:100:134              No import route-mapNo global export route-mapNo export route-mapVRF label distribution protocol: not configuredVRF label allocation mode: per-prefix

这篇关于LDP配置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/350514

相关文章

SpringBoot3.4配置校验新特性的用法详解

《SpringBoot3.4配置校验新特性的用法详解》SpringBoot3.4对配置校验支持进行了全面升级,这篇文章为大家详细介绍了一下它们的具体使用,文中的示例代码讲解详细,感兴趣的小伙伴可以参考... 目录基本用法示例定义配置类配置 application.yml注入使用嵌套对象与集合元素深度校验开发

IntelliJ IDEA 中配置 Spring MVC 环境的详细步骤及问题解决

《IntelliJIDEA中配置SpringMVC环境的详细步骤及问题解决》:本文主要介绍IntelliJIDEA中配置SpringMVC环境的详细步骤及问题解决,本文分步骤结合实例给大... 目录步骤 1:创建 Maven Web 项目步骤 2:添加 Spring MVC 依赖1、保存后执行2、将新的依赖

SpringBoot基于配置实现短信服务策略的动态切换

《SpringBoot基于配置实现短信服务策略的动态切换》这篇文章主要为大家详细介绍了SpringBoot在接入多个短信服务商(如阿里云、腾讯云、华为云)后,如何根据配置或环境切换使用不同的服务商,需... 目录目标功能示例配置(application.yml)配置类绑定短信发送策略接口示例:阿里云 & 腾

如何为Yarn配置国内源的详细教程

《如何为Yarn配置国内源的详细教程》在使用Yarn进行项目开发时,由于网络原因,直接使用官方源可能会导致下载速度慢或连接失败,配置国内源可以显著提高包的下载速度和稳定性,本文将详细介绍如何为Yarn... 目录一、查询当前使用的镜像源二、设置国内源1. 设置为淘宝镜像源2. 设置为其他国内源三、还原为官方

CentOS7更改默认SSH端口与配置指南

《CentOS7更改默认SSH端口与配置指南》SSH是Linux服务器远程管理的核心工具,其默认监听端口为22,由于端口22众所周知,这也使得服务器容易受到自动化扫描和暴力破解攻击,本文将系统性地介绍... 目录引言为什么要更改 SSH 默认端口?步骤详解:如何更改 Centos 7 的 SSH 默认端口1

Maven的使用和配置国内源的保姆级教程

《Maven的使用和配置国内源的保姆级教程》Maven是⼀个项目管理工具,基于POM(ProjectObjectModel,项目对象模型)的概念,Maven可以通过一小段描述信息来管理项目的构建,报告... 目录1. 什么是Maven?2.创建⼀个Maven项目3.Maven 核心功能4.使用Maven H

SpringBoot多数据源配置完整指南

《SpringBoot多数据源配置完整指南》在复杂的企业应用中,经常需要连接多个数据库,SpringBoot提供了灵活的多数据源配置方式,以下是详细的实现方案,需要的朋友可以参考下... 目录一、基础多数据源配置1. 添加依赖2. 配置多个数据源3. 配置数据源Bean二、JPA多数据源配置1. 配置主数据

Spring 基于XML配置 bean管理 Bean-IOC的方法

《Spring基于XML配置bean管理Bean-IOC的方法》:本文主要介绍Spring基于XML配置bean管理Bean-IOC的方法,本文给大家介绍的非常详细,对大家的学习或工作具有一... 目录一. spring学习的核心内容二. 基于 XML 配置 bean1. 通过类型来获取 bean2. 通过

如何使用Nginx配置将80端口重定向到443端口

《如何使用Nginx配置将80端口重定向到443端口》这篇文章主要为大家详细介绍了如何将Nginx配置为将HTTP(80端口)请求重定向到HTTPS(443端口),文中的示例代码讲解详细,有需要的小伙... 目录1. 创建或编辑Nginx配置文件2. 配置HTTP重定向到HTTPS3. 配置HTTPS服务器

SpringBoot中配置Redis连接池的完整指南

《SpringBoot中配置Redis连接池的完整指南》这篇文章主要为大家详细介绍了SpringBoot中配置Redis连接池的完整指南,文中的示例代码讲解详细,具有一定的借鉴价值,感兴趣的小伙伴可以... 目录一、添加依赖二、配置 Redis 连接池三、测试 Redis 操作四、完整示例代码(一)pom.