<b></b>
<b>實驗一:MPLS配置</b>
<b>實驗環境:三台路由器</b><b>Ethernet</b><b>接口相連,接口配置如圖</b>
<b>要求:在三台路由器相連的接口分别啟用</b><b>MPLS,</b><b>檢視相應的結果,在啟用前使其在</b><b>OSPF</b><b>下互通。</b>
<b> </b>
<b>步驟一:接口配置連通性,啟用</b><b>OSPF</b><b>路由協定</b>
<b>R1(config-if)#int e0/1</b>
<b>R1(config-if)#ip add 10.1.1.1 255.255.255.0</b>
<b>R1(config-if)#no shutdown</b>
<b>R1(config)#int e0/0</b>
<b>R1(config-if)#ip add 20.1.1.1 255.255.255.0</b>
<b>R1(config-if)#no sh</b>
<b>R1(config)#router ospf 100 </b><b>à</b><b>啟用路由協定,釋出接口</b>
<b>R1(config-router)#net 10.1.1.0 0.0.0.255 area 0</b>
<b>R1(config-router)#net 20.1.1.0 0.0.0.255 area 0</b>
<b>R2(config)#int e0/1</b>
<b>R2(config-if)#ip add 20.1.1.2 255.255.255.0</b>
<b>R2(config-if)#no sh</b>
<b>R2(config-if)#int e0/0</b>
<b>R2(config-if)#ip add 30.1.1.1 255.255.255.0</b>
<b>R2(config)#router ospf 100</b>
<b>R2(config-router)#net 20.1.1.0 0.0.0.255 area 0</b>
<b>R2(config-router)#net 30.1.1.0 0.0.0.255 area 0</b>
<b>R3(config)#int e0/1</b>
<b>R3(config-if)#ip add 30.1.1.2 255.255.255.0</b>
<b>R3(config-if)#no sh</b>
<b>R3(config-if)#int e0/0</b>
<b>R3(config-if)#ip add 40.1.1.1 255.255.255.0</b>
<b>R3(config-if)#exit</b>
<b>R3(config)#router ospf 100</b>
<b>R3(config-router)#net 30.1.1.0 0.0.0.255 area 0</b>
<b>步驟二:檢視路由,并測試連通性</b>
<b>R1#show ip route </b><b>à</b><b>檢視路由表</b>
<b> 20.0.0.0/24 is subnetted, 1 subnets</b>
<b>C 20.1.1.0 is directly connected, Ethernet0/0</b>
<b> 40.0.0.0/24 is subnetted, 1 subnets</b>
<b>O 40.1.1.0 [110/30] via 20.1.1.2, 00:00:15, Ethernet0/0</b>
<b> 10.0.0.0/24 is subnetted, 1 subnets</b>
<b>C 10.1.1.0 is directly connected, Ethernet0/1</b>
<b> 30.0.0.0/24 is subnetted, 1 subnets</b>
<b>O 30.1.1.0 [110/20] via 20.1.1.2, 00:00:15, Ethernet0/0</b>
<b>R2#show ip route</b>
<b>C 20.1.1.0 is directly connected, Ethernet0/1</b>
<b>O 40.1.1.0 [110/20] via 30.1.1.2, 00:00:23, Ethernet0/0</b>
<b>O 10.1.1.0 [110/20] via 20.1.1.1, 00:00:23, Ethernet0/1</b>
<b>C 30.1.1.0 is directly connected, Ethernet0/0</b>
<b>R3#show ip route </b><b>à</b><b>檢視路由表,都也學到相關路由</b>
<b>O 20.1.1.0 [110/20] via 30.1.1.1, 00:00:06, Ethernet0/1</b>
<b>C 40.1.1.0 is directly connected, Ethernet0/0</b>
<b>O 10.1.1.0 [110/30] via 30.1.1.1, 00:00:06, Ethernet0/1</b>
<b>C 30.1.1.0 is directly connected, Ethernet0/1</b>
<b>R1#ping 40.1.1.1 </b><b>à</b><b>測試連通性</b>
<b>Type escape sequence to abort.</b>
<b>Sending 5, 100-byte ICMP Echos to 40.1.1.1, timeout is 2 seconds:</b>
<b>!!!!!</b>
<b>Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms</b>
<b>R3#ping 10.1.1.1</b>
<b>Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:</b>
<b>步驟三:啟用相關接口的</b><b>MPLS,</b><b>及快速轉發功能</b>
<b>R1(config)#ip cef </b><b>à</b><b>啟用快速轉發功能</b>
<b>R1(config-if)#mpls ip </b><b>à</b><b>接口啟用</b><b>MPLS</b>
<b>R2(config)#ip cef</b>
<b>R2(config-if)#mpls ip</b>
<b>R3(config)#ip cef</b>
<b>R3(config-if)#mpls ip</b>
<b>步驟四:檢視</b><b>MPLS</b><b>狀态</b>
<b>R1#show mpls forwarding-table </b><b>à</b><b>檢視</b><b>MPLS</b><b>轉發表</b>
<b>Local Outgoing Prefix Bytes tag Outgoing Next Hop</b>
<b>tag tag or VC or Tunnel Id switched interface</b>
<b>16 16 </b><b> 40.1.1.0/24 0 Et0/0 20.1.1.2</b>
<b>17</b><b> Pop tag 30.1.1.0/24 0 Et0/0 20.1.1.2</b>
<b>R2#show mpls forwarding-table</b>
<b>16 Pop tag 40.1.1.0/24 </b><b> 0 Et0/0 30.1.1.2</b>
<b>17 Pop tag 10.1.1.0/24</b><b> 0 Et0/1 20.1.1.1</b>
<b>R3#show mpls forwarding-table</b>
<b>16 Pop tag 20.1.1.0/24 </b><b> 0 Et0/1 30.1.1.1</b>
<b>17 17 10.1.1.0/24</b><b> 0 Et0/1 30.1.1.1</b>
<b>R1#show ip cef summary </b><b>à</b><b>檢視</b><b>CEF</b><b>轉發彙總資訊及标記資訊</b>
<b>IP CEF with switching (Table Version 16), flags=0x0</b>
<b> 16 routes, 0 reresolve, 0 unresolved (0 old, 0 new), peak 0</b>
<b> 16 leaves, 18 nodes, 20896 bytes, 21 inserts, 5 invalidations</b>
<b> 0 load sharing elements, 0 bytes, 0 references</b>
<b> universal per-destination load sharing algorithm, id 86C8F0BF</b>
<b> 3(0) CEF resets, 0 revisions of existing leaves</b>
<b> Resolution Timer: Exponential (currently 1s, peak 1s)</b>
<b> 0 in-place/0 aborted modifications</b>
<b> refcounts: 4877 leaf, 4864 node</b>
<b> Table epoch: 0 (16 entries at this epoch)</b>
<b>Adjacency Table has 2 adjacencies</b>
<b>R2#show ip cef summary</b>
<b>IP CEF with switching (Table Version 17), flags=0x0</b>
<b> 17 routes, 0 reresolve, 0 unresolved (0 old, 0 new), peak 0</b>
<b> 17 leaves, 18 nodes, 21032 bytes, 22 inserts, 5 invalidations</b>
<b> universal per-destination load sharing algorithm, id FCD3DE86</b>
<b> refcounts: 4879 leaf, 4864 node</b>
<b> Table epoch: 0 (17 entries at this epoch)</b>
<b>Adjacency Table has 4 adjacencies</b>
<b>R3#show ip cef summary</b>
<b> universal per-destination load sharing algorithm, id 86B9347C</b>
<b>注:也可用</b><b>show ip cef detail</b><b>這條指令來檢視詳細資訊</b>
<b>步驟五:顯示目前配置資訊</b>
<b>R1#show run</b>
<b>hostname R1</b>
<b>ip cef</b>
<b>!</b>
<b>interface Ethernet0/0</b>
<b> ip address 20.1.1.1 255.255.255.0</b>
<b> half-duplex</b>
<b> tag-switching ip</b>
<b>interface Ethernet0/1</b>
<b> ip address 10.1.1.1 255.255.255.0</b>
<b>router ospf 100</b>
<b> network 10.1.1.0 0.0.0.255 area 0</b>
<b> network 20.1.1.0 0.0.0.255 area 0</b>
<b>end</b>
<b>R2#show run</b>
<b>hostname R2</b>
<b> ip address 30.1.1.1 255.255.255.0</b>
<b> ip address 20.1.1.2 255.255.255.0</b>
<b> network 30.1.1.0 0.0.0.255 area 0</b>
<b>R3#show run</b>
<b>hostname R3</b>
<b> ip address 40.1.1.1 255.255.255.0</b>
<b> ip address 30.1.1.2 255.255.255.0</b>
<b> network 40.1.1.0 0.0.0.255 area 0</b>
<b> 本文轉自hexianguo 51CTO部落格,原文連結:</b><b>http://blog.51cto.com/xghe110/98411</b><b>,如需轉載請自行聯系原作者</b>