LDP配置

一、拓普

在这里插入图片描述

二、配置接口IP及IGP

R1

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

R2

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

R3

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

R4

router ospf 1
 router-id 4.4.4.4 
interface Loopback0
 ip address 4.4.4.0 255.255.255.255
 ip ospf 1 area 0
interface Loopback1
 ip address 4.4.4.1 255.255.255.255
interface Loopback2
 ip address 4.4.4.2 255.255.255.255
interface Ethernet0/0
 ip address 10.4.9.4 255.255.255.0
interface Ethernet0/2
 ip address 10.3.4.4 255.255.255.0
 ip ospf 1 area 0
interface Serial1/0
 ip address 10.1.4.4 255.255.255.0
 ip ospf 1 area 0
 serial restart-delay 0
interface Serial1/1
 ip address 10.2.4.4 255.255.255.0
 ip ospf 1 area 0
 serial 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/x
 mpls ip

配置标签范围

R1 100-199
R2 200-299
R3 300-399
R4 400-499
//生产环境不需要配置
//配置后发现不会生效,重置LDP邻居关系后也不行
//全局下no mpls ip再开启后生效
R1(config)#mpls label range 100 199
 Label 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-target
 route-target export 100:134
 route-target import 100:134
interface Ethernet0/0
 //将与CE连接的接口划分到VRF中,此命令会移除接口原有的IP地址
 ip vrf forwarding WRTENG
 ip address 10.4.9.4 255.255.255.0

BGP传递VVVV4路由

R1

router bgp 100
 bgp log-neighbor-changes
 network 10.1.10.0 mask 255.255.255.0
 neighbor 4.4.4.0 remote-as 100
 neighbor 4.4.4.0 update-source Loopback0
 !
 address-family vvvv4
  neighbor 4.4.4.0 activate
  neighbor 4.4.4.0 send-community extended
 exit-address-family
 !
 address-family ipv4 vrf WRTENG
  network 10.1.10.0 mask 255.255.255.0
 exit-address-family

R4

router bgp 100
 bgp log-neighbor-changes
 neighbor 1.1.1.0 remote-as 100
 neighbor 1.1.1.0 update-source Loopback0
 !
 address-family vvvv4
  neighbor 1.1.1.0 activate
  neighbor 1.1.1.0 send-community extended
 exit-address-family
 !
 address-family ipv4 vrf WRTENG
  network 10.4.9.0 mask 255.255.255.0
 exit-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 100
 address-family ipv4 vrf WRTENG
 //将前往R10静态路由传给R1
  redistribute static

R10配置

interface Loopback0
 ip address 10.10.10.0 255.255.255.255
interface Loopback1
 ip address 10.10.10.1 255.255.255.255
interface Loopback2
 ip address 10.10.10.2 255.255.255.255
interface Ethernet0/3
 ip 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的路由信息传给R9
  redistribute bgp 100 metric 1
  network 10.0.0.0
  no auto-summary
  version 2
 exit-address-family
 
router bgp 100
 address-family ipv4 vrf WRTENG
 //将R9的路由信息传给R1
  redistribute rip
 exit-address-family

R9配置

interface Loopback0
 ip address 9.9.9.0 255.255.255.255
interface Loopback1
 ip address 9.9.9.1 255.255.255.255
interface Loopback2
 ip address 9.9.9.2 255.255.255.255
interface Ethernet0/0
 ip address 10.4.9.9 255.255.255.0
interface Ethernet0/1
 ip address 10.8.9.9 255.255.255.0
 
router rip
 version 2
 network 9.0.0.0
 network 10.0.0.0
 no auto-summary

采用EIGRP接入MPLS网络

R1

router bgp 100
 no bgp default ipv4-unicast
 !
 address-family vvvv4
  neighbor 3.3.3.0 activate
  neighbor 3.3.3.0 send-community extended
  neighbor 3.3.3.0 route-reflector-client
  neighbor 4.4.4.0 activate
  neighbor 4.4.4.0 send-community extended
  neighbor 4.4.4.0 route-reflector-client
 exit-address-family
 !
 address-family ipv4 vrf WRTENG
  network 10.1.10.0 mask 255.255.255.0
  redistribute connected
  redistribute static
 exit-address-family

R3

route-map SOO permit 10
 set extcommunity soo 100:89
!

interface Serial1/0
 ip vrf forwarding WRTENG
 ip vrf sitemap SOO
 ip address 10.3.8.3 255.255.255.0
 serial restart-delay 0
 
router eigrp 90
 !
 address-family ipv4 vrf WRTENG autonomous-system 90
  redistribute bgp 100 metric 100000 10 255 1 1500
  network 0.0.0.0
 exit-address-family
 
router bgp 100
 bgp log-neighbor-changes
 no bgp default ipv4-unicast
 !
 address-family vvvv4
  neighbor 1.1.1.0 activate
  neighbor 1.1.1.0 send-community extended
 exit-address-family
 !
 address-family ipv4 vrf WRTENG
  redistribute eigrp 90
 exit-address-family

R4

//删除RIP
router eigrp 90
 !
 address-family ipv4 vrf WRTENG autonomous-system 90
  redistribute bgp 100 metric 100000 10 255 1 1500
  network 0.0.0.0
 exit-address-family

router bgp 100
 bgp log-neighbor-changes
 neighbor 1.1.1.0 remote-as 100
 neighbor 1.1.1.0 update-source Loopback0
 !
 address-family vvvv4
  neighbor 1.1.1.0 activate
  neighbor 1.1.1.0 send-community extended
 exit-address-family
 !
 address-family ipv4 vrf WRTENG
  network 10.4.9.0 mask 255.255.255.0
  redistribute eigrp 90
 exit-address-family

route-map SOO permit 10
 set extcommunity soo 100:89

interface Ethernet0/0
 ip vrf forwarding WRTENG
 ip vrf sitemap SOO
 ip address 10.4.9.4 255.255.255.0

R9、R10

router eigrp 90
 network 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 msec
  2 10.2.3.2 0 msec *  1 msec

R4#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 seconds

Codes: '!' - 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 0

Type 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:0
    Discovery Sources:
    Interfaces:
        Ethernet0/2 (ldp): xmit/recv
            LDP Id: 3.3.3.0:0
        Serial1/0 (ldp): xmit/recv
            LDP Id: 1.1.1.0:0
        Serial1/1 (ldp): xmit/recv
            LDP 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:0
        TCP connection: 3.3.3.0.646 - 4.4.4.0.43213
        State: Oper; Msgs sent/rcvd: 30/30; Downstream
        Up time: 00:12:33
        LDP discovery sources:
          Ethernet0/2, Src IP addr: 10.3.4.3
        Addresses 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:0
        TCP connection: 1.1.1.0.646 - 4.4.4.0.39048
        State: Oper; Msgs sent/rcvd: 30/30; Downstream
        Up time: 00:12:33
        LDP discovery sources:
          Serial1/0, Src IP addr: 10.1.4.1
        Addresses 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:0
        TCP connection: 2.2.2.0.646 - 4.4.4.0.28984
        State: Oper; Msgs sent/rcvd: 30/31; Downstream
        Up time: 00:12:33
        LDP discovery sources:
          Serial1/1, Src IP addr: 10.2.4.2
        Addresses 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 0
  local label info: global/202
  nexthop 10.2.3.3 Ethernet0/0 label 302

//查看已经发现的LDP邻居
R1#show mpls ldp discovery 
 Local LDP Identifier:
    1.1.1.0:0
    Discovery Sources:
    Interfaces:
        Ethernet0/1 (ldp): xmit/recv
            LDP Id: 3.3.3.0:0
        Ethernet0/2 (ldp): xmit/recv
            LDP Id: 2.2.2.0:0
        Serial1/0 (ldp): xmit/recv
            LDP Id: 4.4.4.0:0

//查看VRF
R4#show ip vrf brief 
  Name                             Default RD            Interfaces
  WRTENG                           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 only
  Flags: 0xC
  Interfaces:
    Et0/0                   
Address family ipv4 unicast (Table ID = 0x1):
  Flags: 0x0
  Export vvv route-target communities
    RT:100:134              
  Import vvv route-target communities
    RT:100:134              
  No import route-map
  No global export route-map
  No export route-map
  VRF label distribution protocol: not configured
  VRF label allocation mode: per-prefix
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值