# Mpls Çalışma

<figure><img src="https://2292156749-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDfDBccroFkvJ25uVFqYX%2Fuploads%2FDUa5X5ZpBk39qma54ZSd%2Fimage.png?alt=media&#x26;token=69e956fb-9a0b-4bb9-bce2-473ac499962b" alt=""><figcaption></figcaption></figure>

Routerlar birbirleriyle ospf ile haberleşiyorlar.&#x20;

<figure><img src="https://2292156749-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDfDBccroFkvJ25uVFqYX%2Fuploads%2FvQQh2XirvBjYeRkf6muE%2Fimage.png?alt=media&#x26;token=680021e5-a6ad-4b10-a0ac-50061be7d6ed" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2292156749-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDfDBccroFkvJ25uVFqYX%2Fuploads%2F5xjsZOeWLBff9V6RfKVg%2Fimage.png?alt=media&#x26;token=d762e0af-7530-47bd-8fa6-cb0688cbbe34" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2292156749-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDfDBccroFkvJ25uVFqYX%2Fuploads%2FSfGm6Wov2e05AuFhpVYp%2Fimage.png?alt=media&#x26;token=3afeac3c-e67d-4a5c-994b-a0d9295f2767" alt=""><figcaption></figcaption></figure>

```
R1(config)#mpls label protocol ?
  ldp  Use LDP (default)
  tdp  Use TDP
R1(config)#mpls label protocol ldp

R1(config)#mpls ldp router-id loopback 0 // Çünkü loopback adresi advertise ediyoruz

R1(config)#interface serial 5/1
R1(config-if)#mpls ip
R1(config)#mpls label range 100 199
  <100-1048575>  Maximum label value for dynamic label range

R1#sh mpls interfaces
Interface              IP            Tunnel   BGP Static Operational
Serial5/1              Yes (ldp)     No       No  No     Yes
R1#


R2(config)#mpls label range 200 299
R2(config)#mpls label protocol ldp
R2(config)#mpls ldp router-id loopback 0
R2(config)#interface serial 5/0
R2(config-if)#mpls ip
*Dec 31 14:54:16.179: %LDP-5-NBRCHG: LDP Neighbor 11.0.0.1:0 (1) is UP
R2(config)#interface serial 5/1
R2(config-if)#mpls ip


R3(config)#mpls label range 300 399
R3(config)#mpls label protocol ldp
R3(config)#interface serial 5/0
R3(config-if)#mpls ip
*Dec 31 14:57:07.679: %LDP-5-NBRCHG: LDP Neighbor 12.0.0.1:0 (1) is UP
R3(config)#interface serial 5/1
R3(config-if)#mpl
R3(config-if)#mpls ip
R3(config)#mpls ldp router-id loopback 0

R3#sh mpls interfaces
Interface              IP            Tunnel   BGP Static Operational
Serial5/0              Yes (ldp)     No       No  No     Yes
Serial5/1              Yes (ldp)     No       No  No     Yes
R3#


R4(config)#mpls label range 400 499
R4(config)#mpls label protocol ldp
R4(config)#interface serial 5/0
R4(config-if)#mpls ip
*Dec 31 14:59:40.663: %LDP-5-NBRCHG: LDP Neighbor 13.0.0.1:0 (1) is UP
R4(config-if)#
R4(config)#mpls ldp router-id loopback 0


R2#sh mpls ldp neighbor
    Peer LDP Ident: 11.0.0.1:0; Local LDP Ident 12.0.0.1:0
        TCP connection: 11.0.0.1.646 - 12.0.0.1.54691
        State: Oper; Msgs sent/rcvd: 20/20; Downstream
        Up time: 00:08:53
        LDP discovery sources:
          Serial5/0, Src IP addr: 1.1.1.1
        Addresses bound to peer LDP Ident:
          1.1.1.1         11.0.0.1
    Peer LDP Ident: 13.0.0.1:0; Local LDP Ident 12.0.0.1:0
        TCP connection: 13.0.0.1.36364 - 12.0.0.1.646
        State: Oper; Msgs sent/rcvd: 16/17; Downstream
        Up time: 00:06:01
        LDP discovery sources:
          Serial5/1, Src IP addr: 2.2.2.2
        Addresses bound to peer LDP Ident:
          2.2.2.2         3.3.3.1         13.0.0.1
          
R3#sh mpls ldp neighbor
    Peer LDP Ident: 12.0.0.1:0; Local LDP Ident 13.0.0.1:0
        TCP connection: 12.0.0.1.646 - 13.0.0.1.36364
        State: Oper; Msgs sent/rcvd: 18/18; Downstream
        Up time: 00:07:36
        LDP discovery sources:
          Serial5/0, Src IP addr: 2.2.2.1
        Addresses bound to peer LDP Ident:
          1.1.1.2         2.2.2.1         12.0.0.1
    Peer LDP Ident: 14.0.0.1:0; Local LDP Ident 13.0.0.1:0
        TCP connection: 14.0.0.1.20981 - 13.0.0.1.646
        State: Oper; Msgs sent/rcvd: 15/15; Downstream
        Up time: 00:05:03
        LDP discovery sources:
          Serial5/1, Src IP addr: 3.3.3.2
        Addresses bound to peer LDP Ident:
          3.3.3.2         14.0.0.1



R4#sh mpls ldp bindings
  lib entry: 1.0.0.0/8, rev 14
        local binding:  label: 404
        remote binding: lsr: 13.0.0.1:0, label: 305
  lib entry: 2.0.0.0/8, rev 12
        local binding:  label: 403
        remote binding: lsr: 13.0.0.1:0, label: imp-null
  lib entry: 3.0.0.0/8, rev 2
        local binding:  label: imp-null
        remote binding: lsr: 13.0.0.1:0, label: imp-null
  lib entry: 11.0.0.1/32, rev 10
        local binding:  label: 402
        remote binding: lsr: 13.0.0.1:0, label: 304
  lib entry: 12.0.0.1/32, rev 8
        local binding:  label: 401
        remote binding: lsr: 13.0.0.1:0, label: 303
  lib entry: 13.0.0.0/24, rev 15
        remote binding: lsr: 13.0.0.1:0, label: imp-null
  lib entry: 13.0.0.1/32, rev 6
        local binding:  label: 400
  lib entry: 14.0.0.0/24, rev 4
        local binding:  label: imp-null
  lib entry: 14.0.0.1/32, rev 16
        remote binding: lsr: 13.0.0.1:0, label: 302


R4#sh mpls forwarding-table
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
400        No Label   13.0.0.1/32      0             Se5/0      point2point
401        303        12.0.0.1/32      0             Se5/0      point2point
402        304        11.0.0.1/32      0             Se5/0      point2point
403        Pop Label  2.0.0.0/8        0             Se5/0      point2point
404        305        1.0.0.0/8        0             Se5/0      point2point



R4#sh mpls ldp bindings 14.0.0.0 24
  lib entry: 14.0.0.0/24, rev 4
        local binding:  label: imp-null  // Direclty connected ise implicit nulldır
        

Lib==label information base 
lfib == label forwarding information base



R1#sh mpls forwarding-table
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
101        205        14.0.0.1/32      0             Se5/1      point2point
102        202        13.0.0.1/32      0             Se5/1      point2point
103        No Label   12.0.0.1/32      0             Se5/1      point2point
104        204        3.0.0.0/8        0             Se5/1      point2point
105        Pop Label  2.0.0.0/8        0             Se5/1      point2point
R1#


R1#trace 14.0.0.1 source 11.0.0.1
Type escape sequence to abort.
Tracing the route to 14.0.0.1
VRF info: (vrf in name/id, vrf out name/id)
  1 1.1.1.2 [MPLS: Label 205 Exp 0] 52 msec 104 msec 120 msec
  2 2.2.2.2 [MPLS: Label 302 Exp 0] 132 msec 20 msec 32 msec
  3 3.3.3.2 52 msec 60 msec 24 msec



R4(config)#mpls ldp explicit-null
R4(config)#exit
R4#sh mpls forwarding-table
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
400        No Label   13.0.0.1/32      0             Se5/0      point2point
401        303        12.0.0.1/32      0             Se5/0      point2point
402        304        11.0.0.1/32      0             Se5/0      point2point
403        Pop Label  2.0.0.0/8        0             Se5/0      point2point
404        305        1.0.0.0/8        0             Se5/0      point2point


Show commands
================

sh mpls interfaces
sh mpls ldp neigh
sh run int .....
sh run | inc mpls



```

**VRF(Virtual Routing And Forwarding)**

Vrf provides a way for you to configure multiple routing instances on your router.\
Keep customer traffic and routing separate utilize the same hardware\
Without VRF we need to use ACL filtering to keep traffic segregated.

<figure><img src="https://2292156749-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDfDBccroFkvJ25uVFqYX%2Fuploads%2F8akGw9ObrHTEGDmPTqSP%2Fimage.png?alt=media&#x26;token=30eeb9d3-d6dd-4f66-9685-46ed0bc5fb2a" alt=""><figcaption></figcaption></figure>

```
VRF Configuration
7000 Serisi Cisco Router
Router(config)#vrf definition ABC
Router(config-vrf)#rd 500:1
Router(config)#address-family ipv4
Router(config-vrf-af)#route-target export 500:1
Router(config-vrf-af)#route-target import 500:1
Router(config-vrf-af)#exit

Router(config-vrf)#address-family ipv6
Router(config-vrf-af)#route-target export 500:1
Router(config-vrf-af)#route-target import 500:1
Router(config-vrf-af)#exit

3600/3700 Serisi
Router(config)#ip vrf vrf-name
Router(config-vrf)#rd route-distinguisher
Router(config-vrf)#route-target export RT
Router(config-vrf)#route-target import RT

R1#sh ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
4.4.4.1           0   FULL/  -        00:00:37    4.4.4.1         Serial5/1
2.2.2.1           0   FULL/  -        00:00:38    1.1.1.2         Serial5/0

R1#sh ip route ospf
Gateway of last resort is not set

O     2.0.0.0/8 [110/128] via 1.1.1.2, 00:43:45, Serial5/0
O     3.0.0.0/8 [110/128] via 4.4.4.1, 00:41:06, Serial5/1
      172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
O        172.16.36.0/24 [110/129] via 4.4.4.1, 00:41:06, Serial5/1
                        [110/129] via 1.1.1.2, 00:41:57, Serial5/0
R1#





```

<figure><img src="https://2292156749-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDfDBccroFkvJ25uVFqYX%2Fuploads%2FXHY4OQSShahnM4jamg0G%2Fimage.png?alt=media&#x26;token=e6507c39-8dc3-4c76-8052-e14dd9e874e5" alt=""><figcaption></figcaption></figure>

```
R1#sh mpls ldp neighbor
R1#  // hiçbir şey göremedik çünkü loopback adresi ospf de tanıtmadık




```









