----LO1----R1---S1/1-----S1/0----R2----S1/1----S1/0---R3--S1/2---S1/2--R7--S1/4-----S1/2---R5------S1/1--------S1/0----R6----LO1
配置:
R1:CE
enable
config t
hostname R1
int s1/1
ip address 192.168.12.1 255.255.255.0
no shutdown
exit
int lo1
ip add 192.168.1.1 255.255.255.0
no shutdown
exit
router rip
version 2
net 192.168.1.0
net 192.168.12.0
end
R2:PE
enable
config t
hostname R2
int s1/0
ip add 192.168.12.2 255.255.255.0
no shutdown
exit
int s1/1
ip add 192.168.23.1 255.255.255.0
no shutdown
exit
router rip
version 2
network 192.168.12.0
network 192.168.23.0
exit
ip cef
int s1/1
mpls label protocol ldp
tag-switching ip
end
R3:P
enable
config t
hostname R3
int s1/0
ip add 192.168.23.2 255.255.255.0
no shutdown
exit
int s1/2
ip add 192.168.37.1 255.255.255.0
no shutdown
exit
router rip
version 2
network 192.168.23.0
network 192.168.37.0
exit
ip cef
int s1/0
mpls label protocol ldp
tag-switching ip
exit
int s1/2
mpls label protocol ldp
tag-switching ip
exit
end
R7:P
enable
config t
hostname R7
int s1/2
ip add 192.168.37.2 255.255.255.0
no shutdown
exit
int s1/4
ip add 192.168.75.1 255.255.255.0
no shutdown
exit
router rip
version 2
network 192.168.37.0
network 192.168.75.0
exit
ip cef
int s1/2
mpls label protocol ldp
tag-switching ip
exit
int s1/4
mpls label protocol ldp
tag-switching ip
exit
end
R5:PE
enable
config t
hostname R5
int s1/2
ip add 192.168.75.2 255.255.255.0
no shutdown
exit
int s1/1
ip add 192.168.56.1 255.255.255.0
no shutdown
exit
router rip
version 2
network 192.168.56.0
network 192.168.75.0
exit
ip cef
int s1/2
mpls label protocol ldp
tag-switching ip
exit
end
R6:CE
enable
config t
hostname R6
int s1/0
ip address 192.168.56.2 255.255.255.0
no shutdown
exit
int lo1
ip add 192.168.6.1 255.255.255.0
no shutdown
exit
router rip
version 2
network 192.168.56.0
network 192.168.6.0
end
--------------------------------------------------------------------------------------------------
R2#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
16 Untagged 192.168.1.0/24 0 Se1/0 point2point
17 18 192.168.6.0/24 0 Se1/1 point2point
18 Pop tag 192.168.37.0/24 0 Se1/1 point2point
19 19 192.168.56.0/24 0 Se1/1 point2point
20 20 192.168.75.0/24 0 Se1/1 point2point
R2#
R3#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
16 16 192.168.1.0/24 0 Se1/0 point2point
17 Pop tag 192.168.12.0/24 0 Se1/0 point2point
18 17 192.168.6.0/24 0 Se1/2 point2point
19 16 192.168.56.0/24 0 Se1/2 point2point
20 Pop tag 192.168.75.0/24 0 Se1/2 point2point
R7#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
16 Pop tag 192.168.56.0/24 0 Se1/4 point2point
17 17 192.168.6.0/24 0 Se1/4 point2point
18 16 192.168.1.0/24 0 Se1/2 point2point
19 17 192.168.12.0/24 0 Se1/2 point2point
20 Pop tag 192.168.23.0/24 0 Se1/2 point2point
R7#
R5#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
16 Pop tag 192.168.37.0/24 0 Se1/2 point2point
17 Untagged 192.168.6.0/24 0 Se1/1 point2point
18 18 192.168.1.0/24 0 Se1/2 point2point
19 19 192.168.12.0/24 0 Se1/2 point2point
20 20 192.168.23.0/24 0 Se1/2 point2point
R5#
MPLS 网络中的LSR路由器,使用标签来标记学习到的每一条路由条目;这个标签只具有本地性(LSR路由器本身和它的邻居相互识别)那么标签如何产生呢,MPLS 使用LDP协议来在LSR路由器上产生标签;使用每5秒发送hello 包学习邻居,15秒为hold time 时间(发送hello用UDP 646,目的地为224.0.0.2,hello时间和保持时间分别是5秒15秒。这个hello包是不能跨网段传递的,而这个hello包被称为LDP Link Hello。),学习到邻居之后,使用LDP会话,来实现LSR路由器自己的标签和邻居的标签交换(学习,是双方能识别对放的标签)(使用的是TCP连接。而这个会话也只能和直连邻居建立,这样会话被称为LDP sessions。LDP会话的hello和超时分别是60秒和180秒。如果LDP邻居关系丢失,那么LDP会话也会断开)
标签标记的是路由条目(非直连),标签号码只有本地性,自己和邻居都可以识别;号码可以在不同的路由器上重复现。
Untagged :一般出现在MPLS 的边界上。入站LSR,或者出站LSR,对非MPLS网络的标识。
Pop tag :一般是指LSR的下一跳,就是目的地址,会移除标签