MPLS advertise-labels
![](https://assets.st-note.com/img/1694430672512-a9LcX9unr7.png?width=1200)
概要
・MPLSのコアで物理I/Fにラベルつける必要ないじゃん
→LDPのrouter-idはLoopback
→MP-BGPピアもupdate-sourceがLoopback
Before
show mpls ldp bindings
iosv-1#sh mpls ldp bind
lib entry: 1.0.0.0/8, rev 2
local binding: label: imp-null
remote binding: lsr: 3.3.3.3:0, label: 300
lib entry: 3.0.0.0/8, rev 18
local binding: label: 104
remote binding: lsr: 3.3.3.3:0, label: imp-null
lib entry: 4.4.4.4/32, rev 10
local binding: label: 100
remote binding: lsr: 3.3.3.3:0, label: 301
lib entry: 5.0.0.0/8, rev 16
local binding: label: 103
remote binding: lsr: 3.3.3.3:0, label: 303
lib entry: 12.1.1.0/24, rev 4
local binding: label: imp-null
lib entry: 13.1.1.0/24, rev 6
local binding: label: imp-null
remote binding: lsr: 3.3.3.3:0, label: imp-null
lib entry: 34.1.1.0/24, rev 22
local binding: label: 106
remote binding: lsr: 3.3.3.3:0, label: imp-null
lib entry: 45.1.1.0/24, rev 20
local binding: label: 105
remote binding: lsr: 3.3.3.3:0, label: 304
lib entry: 46.1.1.0/24, rev 14
local binding: label: 102
remote binding: lsr: 3.3.3.3:0, label: 302
lib entry: 130.1.1.0/24, rev 12
local binding: label: 101
remote binding: lsr: 3.3.3.3:0, label: imp-null
lib entry: 192.168.1.0/24, rev 8
local binding: label: imp-null
iosv-5#sh mpls ldp bind
lib entry: 1.0.0.0/8, rev 17
local binding: label: 504
remote binding: lsr: 4.4.4.4:0, label: 403
lib entry: 3.0.0.0/8, rev 16
local binding: label: 503
remote binding: lsr: 4.4.4.4:0, label: 402
lib entry: 4.0.0.0/8, rev 9
remote binding: lsr: 4.4.4.4:0, label: imp-null
lib entry: 4.4.4.4/32, rev 6
local binding: label: 500
lib entry: 5.0.0.0/8, rev 2
local binding: label: imp-null
remote binding: lsr: 4.4.4.4:0, label: 401
lib entry: 13.1.1.0/24, rev 18
local binding: label: 505
remote binding: lsr: 4.4.4.4:0, label: 404
lib entry: 34.1.1.0/24, rev 19
local binding: label: 506
remote binding: lsr: 4.4.4.4:0, label: imp-null
lib entry: 45.1.1.0/24, rev 4
local binding: label: imp-null
remote binding: lsr: 4.4.4.4:0, label: imp-null
lib entry: 46.1.1.0/24, rev 8
local binding: label: 501
remote binding: lsr: 4.4.4.4:0, label: imp-null
lib entry: 130.1.1.0/24, rev 15
local binding: label: 502
remote binding: lsr: 4.4.4.4:0, label: 400
show mpls forwarding-table
iosv-1#sh mpls for
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
100 301 4.4.4.4/32 0 Gi0/3 13.1.1.3
101 Pop Label 130.1.1.0/24 0 Gi0/3 13.1.1.3
102 302 46.1.1.0/24 0 Gi0/3 13.1.1.3
103 303 5.0.0.0/8 0 Gi0/3 13.1.1.3
104 Pop Label 3.0.0.0/8 0 Gi0/3 13.1.1.3
105 304 45.1.1.0/24 0 Gi0/3 13.1.1.3
106 Pop Label 34.1.1.0/24 0 Gi0/3 13.1.1.3
107 No Label 2.0.0.0/8[V] 0 Gi0/0 12.1.1.2
108 No Label 12.1.1.0/24[V] 0 aggregate/aaa
109 No Label 26.1.1.0/24[V] 0 Gi0/0 12.1.1.2
110 No Label 192.168.2.0/24[V] \
0 Gi0/0 12.1.1.2
iosv-5#sh mpls for
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
500 No Label 4.4.4.4/32 0 Gi0/4 45.1.1.4
501 Pop Label 46.1.1.0/24 0 Gi0/4 45.1.1.4
502 400 130.1.1.0/24 0 Gi0/4 45.1.1.4
503 402 3.0.0.0/8 0 Gi0/4 45.1.1.4
504 403 1.0.0.0/8 0 Gi0/4 45.1.1.4
505 404 13.1.1.0/24 0 Gi0/4 45.1.1.4
506 Pop Label 34.1.1.0/24 0 Gi0/4 45.1.1.4
507 No Label 57.1.1.0/24[V] 0 aggregate/aaa
508 No Label 192.168.3.0/24[V] \
0 Gi0/7 57.1.1.7
設定1
iosv-3(config)#no mpls ldp advertise-labels
iosv-4(config)#no mpls ldp advertise-labels
確認: show mpls ldp bindings
iosv-1#sh mpls ldp bind
lib entry: 1.0.0.0/8, rev 2
local binding: label: imp-null
lib entry: 3.0.0.0/8, rev 18
local binding: label: 104
lib entry: 4.4.4.4/32, rev 10
local binding: label: 100
lib entry: 5.0.0.0/8, rev 16
local binding: label: 103
lib entry: 12.1.1.0/24, rev 4
local binding: label: imp-null
lib entry: 13.1.1.0/24, rev 6
local binding: label: imp-null
lib entry: 34.1.1.0/24, rev 22
local binding: label: 106
lib entry: 45.1.1.0/24, rev 20
local binding: label: 105
lib entry: 46.1.1.0/24, rev 14
local binding: label: 102
lib entry: 130.1.1.0/24, rev 12
local binding: label: 101
lib entry: 192.168.1.0/24, rev 8
local binding: label: imp-null
iosv-5#sh mpls ldp bind
lib entry: 1.0.0.0/8, rev 17
local binding: label: 504
lib entry: 3.0.0.0/8, rev 16
local binding: label: 503
lib entry: 4.4.4.4/32, rev 6
local binding: label: 500
lib entry: 5.0.0.0/8, rev 2
local binding: label: imp-null
lib entry: 13.1.1.0/24, rev 18
local binding: label: 505
lib entry: 34.1.1.0/24, rev 19
local binding: label: 506
lib entry: 45.1.1.0/24, rev 4
local binding: label: imp-null
lib entry: 46.1.1.0/24, rev 8
local binding: label: 501
lib entry: 130.1.1.0/24, rev 15
local binding: label: 502
remote labelが消滅する。
CLRモードでもこうはならない。
確認: show mpls forwarding-table
iosv-1#sh mpls for
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
100 No Label 4.4.4.4/32 0 Gi0/3 13.1.1.3
101 No Label 130.1.1.0/24 0 Gi0/3 13.1.1.3
102 No Label 46.1.1.0/24 0 Gi0/3 13.1.1.3
103 No Label 5.0.0.0/8 0 Gi0/3 13.1.1.3
104 No Label 3.0.0.0/8 0 Gi0/3 13.1.1.3
105 No Label 45.1.1.0/24 0 Gi0/3 13.1.1.3
106 No Label 34.1.1.0/24 0 Gi0/3 13.1.1.3
107 No Label 2.0.0.0/8[V] 0 Gi0/0 12.1.1.2
108 No Label 12.1.1.0/24[V] 0 aggregate/aaa
109 No Label 26.1.1.0/24[V] 0 Gi0/0 12.1.1.2
110 No Label 192.168.2.0/24[V] \
0 Gi0/0 12.1.1.2
iosv-5#sh mpls for
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
500 No Label 4.4.4.4/32 0 Gi0/4 45.1.1.4
501 No Label 46.1.1.0/24 0 Gi0/4 45.1.1.4
502 No Label 130.1.1.0/24 0 Gi0/4 45.1.1.4
503 No Label 3.0.0.0/8 0 Gi0/4 45.1.1.4
504 No Label 1.0.0.0/8 0 Gi0/4 45.1.1.4
505 No Label 13.1.1.0/24 0 Gi0/4 45.1.1.4
506 No Label 34.1.1.0/24 0 Gi0/4 45.1.1.4
507 No Label 57.1.1.0/24[V] 0 aggregate/aaa
508 No Label 192.168.3.0/24[V] \
0 Gi0/7 57.1.1.7
全てNo Labelになっている。
ping check
![](https://assets.st-note.com/img/1694430954190-YEvMZn2zjO.png)
設定2
iosv-3(config)#ip access-list standard LABEL
iosv-3(config-std-nacl)#deny 13.1.1.0 0.0.0.255
iosv-3(config-std-nacl)#deny 34.1.1.0 0.0.0.255
iosv-3(config-std-nacl)#deny 45.1.1.0 0.0.0.255
iosv-3(config-std-nacl)#permit any
iosv-3(config-std-nacl)#exit
iosv-3(config)#mpls ldp advertise-label for LABEL
iosv-4(config)#ip access-list standard LABEL
iosv-4(config-std-nacl)#deny 34.1.1.0 0.0.0.255
iosv-4(config-std-nacl)#deny 45.1.1.0 0.0.0.255
iosv-4(config-std-nacl)#deny 13.1.1.0 0.0.0.255
iosv-4(config-std-nacl)#permit any
iosv-4(config-std-nacl)#exit
iosv-4(config)#mpls ldp advertise-labels for LABEL
確認: show mpls ldp bindings
iosv-1#sh mpls ldp bind
lib entry: 1.0.0.0/8, rev 2
local binding: label: imp-null
remote binding: lsr: 3.3.3.3:0, label: 300
lib entry: 3.0.0.0/8, rev 18
local binding: label: 104
remote binding: lsr: 3.3.3.3:0, label: imp-null
lib entry: 4.4.4.4/32, rev 10
local binding: label: 100
remote binding: lsr: 3.3.3.3:0, label: 301
lib entry: 5.0.0.0/8, rev 16
local binding: label: 103
remote binding: lsr: 3.3.3.3:0, label: 303
lib entry: 12.1.1.0/24, rev 4
local binding: label: imp-null
lib entry: 13.1.1.0/24, rev 6
local binding: label: imp-null
lib entry: 34.1.1.0/24, rev 22
local binding: label: 106
lib entry: 45.1.1.0/24, rev 20
local binding: label: 105
lib entry: 46.1.1.0/24, rev 14
local binding: label: 102
remote binding: lsr: 3.3.3.3:0, label: 302
lib entry: 130.1.1.0/24, rev 12
local binding: label: 101
remote binding: lsr: 3.3.3.3:0, label: imp-null
lib entry: 192.168.1.0/24, rev 8
local binding: label: imp-null
iosv-5#sh mpls ldp bind
lib entry: 1.0.0.0/8, rev 17
local binding: label: 504
remote binding: lsr: 4.4.4.4:0, label: 403
lib entry: 3.0.0.0/8, rev 16
local binding: label: 503
remote binding: lsr: 4.4.4.4:0, label: 402
lib entry: 4.0.0.0/8, rev 23
remote binding: lsr: 4.4.4.4:0, label: imp-null
lib entry: 4.4.4.4/32, rev 6
local binding: label: 500
lib entry: 5.0.0.0/8, rev 2
local binding: label: imp-null
remote binding: lsr: 4.4.4.4:0, label: 401
lib entry: 13.1.1.0/24, rev 18
local binding: label: 505
remote binding: lsr: 4.4.4.4:0, label: 404
lib entry: 34.1.1.0/24, rev 19
local binding: label: 506
remote binding: lsr: 4.4.4.4:0, label: imp-null
lib entry: 45.1.1.0/24, rev 4
local binding: label: imp-null
remote binding: lsr: 4.4.4.4:0, label: imp-null
lib entry: 46.1.1.0/24, rev 8
local binding: label: 501
remote binding: lsr: 4.4.4.4:0, label: imp-null
lib entry: 130.1.1.0/24, rev 15
local binding: label: 502
remote binding: lsr: 4.4.4.4:0, label: 400
denyで拒否したアドレスではremote labelを受け取っていない。(変化がわかるようにdenyを入れただけなので、効率を求めるならもっと厳密に定義すべきことがわかる)
確認: show mpls ldp forwarding-table
iosv-1#sh mpls for
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
100 301 4.4.4.4/32 0 Gi0/3 13.1.1.3
101 Pop Label 130.1.1.0/24 0 Gi0/3 13.1.1.3
102 302 46.1.1.0/24 0 Gi0/3 13.1.1.3
103 303 5.0.0.0/8 0 Gi0/3 13.1.1.3
104 Pop Label 3.0.0.0/8 0 Gi0/3 13.1.1.3
105 No Label 45.1.1.0/24 0 Gi0/3 13.1.1.3
106 No Label 34.1.1.0/24 0 Gi0/3 13.1.1.3
107 No Label 2.0.0.0/8[V] 0 Gi0/0 12.1.1.2
108 No Label 12.1.1.0/24[V] 0 aggregate/aaa
109 No Label 26.1.1.0/24[V] 0 Gi0/0 12.1.1.2
110 No Label 192.168.2.0/24[V] \
0 Gi0/0 12.1.1.2
iosv-5#sh mpls for
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
500 No Label 4.4.4.4/32 0 Gi0/4 45.1.1.4
501 Pop Label 46.1.1.0/24 0 Gi0/4 45.1.1.4
502 400 130.1.1.0/24 0 Gi0/4 45.1.1.4
503 402 3.0.0.0/8 0 Gi0/4 45.1.1.4
504 403 1.0.0.0/8 0 Gi0/4 45.1.1.4
505 No Label 13.1.1.0/24 0 Gi0/4 45.1.1.4
506 No Label 34.1.1.0/24 0 Gi0/4 45.1.1.4
507 No Label 57.1.1.0/24[V] 0 aggregate/aaa
508 No Label 192.168.3.0/24[V] \
0 Gi0/7 57.1.1.7
MP-BGPやLDPのピアで必要なLoopbackアドレスにはラベルを付けている。それ以外の物理アドレスはNo Label。
ping check
![](https://assets.st-note.com/img/1694432419779-X6TIiL25Y4.png?width=1200)
こういう制御は組んでてとっても楽しい。