天天看點

使用GNS3實驗MPLS協定1. 配置IP和路由協定2. 配置PE路由器和骨幹路由器P3. PE上配置BGP4. 激活MP-BGP協定5. 配置VRF,實質是配置RT和RD6. 配置vrf與接口的關聯性7. 配置PE和CE之間的路由選擇協定和MP-BGP與RIP之間的路由重分發

實驗目的:使R1和R6互相利用私網網段進行通信。

實驗内容:配置了RIP OSPF BGP MPLS VRF,資訊量很大,值得試驗。

使用GNS3實驗MPLS協定1. 配置IP和路由協定2. 配置PE路由器和骨幹路由器P3. PE上配置BGP4. 激活MP-BGP協定5. 配置VRF,實質是配置RT和RD6. 配置vrf與接口的關聯性7. 配置PE和CE之間的路由選擇協定和MP-BGP與RIP之間的路由重分發

1. 配置IP和路由協定

R1

conf t
 int E1/0
  ip addr 192.168.1.1 255.255.255.0
  no sh
           

R2

conf t
 int E1/0
  ip addr 192.168.1.2 255.255.255.0
  no sh
 int F0/0
  ip addr 10.1.10.1 255.255.255.0
  no sh

 interface Loopback0
  ip addr 10.1.1.2 255.255.255.255
 router ospf 100
  router-id 10.1.1.2
  passive-interface Loopback0
  network 10.0.0.0 0.255.255.255 area 0
           

R3

conf t
 int F0/0
  ip addr 10.1.10.2 255.255.255.0
  no sh
 int F0/1
  ip addr 10.1.20.1 255.255.255.0
  no sh

 interface Loopback0
  ip addr 10.1.1.3 255.255.255.255
 router ospf 100
  router-id 10.1.1.3
  passive-interface Loopback0
  network 10.0.0.0 0.255.255.255 area 0
           

R4

conf t
 int F0/0
  ip addr 10.1.20.2 255.255.255.0
  no sh
 int F0/1
  ip addr 10.1.30.1 255.255.255.0
  no sh

 interface Loopback0
  ip addr 10.1.1.4 255.255.255.255
 router ospf 100
  router-id 10.1.1.4
  passive-interface Loopback0
  network 10.0.0.0 0.255.255.255 area 0
           

R5

conf t
 int F0/1
  ip addr 10.1.30.2 255.255.255.0
  no sh
 int E1/0
  ip addr 192.168.4.1 255.255.255.0
  no sh

 interface Loopback0
  ip addr 10.1.1.5 255.255.255.255
 router ospf 100
  router-id 10.1.1.5
  passive-interface Loopback0
  network 10.0.0.0 0.255.255.255 area 0
           

R6

conf t
 int E1/0
  ip addr 192.168.4.2 255.255.255.0
  no sh
           

檢視路由是否正常工作

R2#show ip route ospf
     10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
O       10.1.1.3/32 [110/2] via 10.1.10.2, 00:00:23, FastEthernet0/0
O       10.1.1.4/32 [110/3] via 10.1.10.2, 00:00:23, FastEthernet0/0
O       10.1.1.5/32 [110/4] via 10.1.10.2, 00:00:23, FastEthernet0/0
O       10.1.30.0/24 [110/3] via 10.1.10.2, 00:00:23, FastEthernet0/0
O       10.1.20.0/24 [110/2] via 10.1.10.2, 00:00:23, FastEthernet0/0
           

2. 配置PE路由器和骨幹路由器P

R2

ip cef //啟用CEF
 mpls label protocol ldp //選擇LDP标簽
 mpls ldp router-id Loopback0 force //選擇LSR的router-id

interface F0/0
 mpls ip
 tag-switching ip
           

R5

ip cef
 mpls label protocol ldp
 mpls ldp router-id Loopback0 force

interface F0/1
 mpls ip
 tag-switching ip
           

R3 、R4

ip cef
 mpls label protocol ldp
 mpls ldp router-id Loopback0 force

interface F0/0
 mpls ip
 tag-switching ip
interface F0/1
 mpls ip
 tag-switching ip
           

在PE或P上檢視标簽轉發表FLIB

R2#show mpls forwarding-table
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop
tag    tag or VC   or Tunnel Id      switched   interface
16     Pop tag     10.1.1.3/32       0          Fa0/0      10.1.10.2
17     17          10.1.1.4/32       0          Fa0/0      10.1.10.2
18     18          10.1.1.5/32       0          Fa0/0      10.1.10.2
19     19          10.1.30.0/24      0          Fa0/0      10.1.10.2
20     Pop tag     10.1.20.0/24      0          Fa0/0      10.1.10.2
           

3. PE上配置BGP

配置BGP是為了啟用MP-BGP,隻配置R2和R5就行了

64512-65535是私有AS号

R2

router bgp 64512
 neighbor 10.1.1.5 remote-as 64512
 neighbor 10.1.1.5 update-source Loopback 0
 no synchronization
 no auto-summary
           

R5

router bgp 64512
 neighbor 10.1.1.2 remote-as 64512
 neighbor 10.1.1.2 update-source Loopback 0
 no synchronization
 no auto-summary
           

檢視BGP鄰居

R2#show ip bgp summary
BGP router identifier 10.1.1.2, local AS number 64512
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.1.1.5        4 64512       2       2        0    0    0 00:00:07        0
           

4. 激活MP-BGP協定

要啟用MP-BGP協定,必須在VNV4的位址簇下激活

R2

router bgp 64512
 address-family vxxv4
  neighbor 10.1.1.5 activate
  neighbor 10.1.1.5 send-community extended //啟用BGP擴充共用體交換,為了MP-BGP攜帶RD和起源場點屬性
  no auto-summary
           

R5

router bgp 64512
 address-family vxxv4
  neighbor 10.1.1.2 activate
  neighbor 10.1.1.5 send-community extended
  no auto-summary
           

5. 配置VRF,實質是配置RT和RD

R2 R5

ip vrf microsoft_vxx
 rd 64512:100
 route-target export 64512:100
 route-target import 64512:100
           

6. 配置vrf與接口的關聯性

配置vrf後,需要重新設定IP

R2

interface E1/0
 ip vrf forwarding microsoft_vxx
 ip addr 192.168.1.2 255.255.255.0
           

R5

interface E1/0
 ip vrf forwarding microsoft_vxx
 ip addr 192.168.4.1 255.255.255.0
           

檢視vrf詳細資訊

R2#show ip vrf
  Name                             Default RD          Interfaces
  microsoft_vxx                    64512:100           Et1/0
           

7. 配置PE和CE之間的路由選擇協定和MP-BGP與RIP之間的路由重分發

R1

router rip
  version 2
  redistribute static
  network 192.168.1.0
  network 192.168.2.0
  network 192.168.3.0
ip route 192.168.2.0 255.255.255.0 Null0
ip route 192.168.3.0 255.255.255.0 Null0
           

R6

router rip
  version 2
  redistribute static
  network 192.168.4.0
  network 192.168.5.0
  network 192.168.6.0
ip route 192.168.5.0 255.255.255.0 Null0
ip route 192.168.6.0 255.255.255.0 Null0
           

R2

router rip
  version 2
  address-family ipv4 vrf microsoft_vxx
   version 2
   redistribute bgp 64512 metric transparent
   network 192.168.1.0
   no auto-summary
router bgp 64512
 address-family ipv4 vrf microsoft_vxx
  redistribute rip
  no auto-summary
  no synchronization
  exit
           

R5

router rip
  version 2
  address-family ipv4 vrf microsoft_vxx
   version 2
   redistribute bgp 64512 metric transparent
   network 192.168.4.0
   no auto-summary
router bgp 64512
 address-family ipv4 vrf microsoft_vxx
  redistribute rip
  no auto-summary
  no synchronization
  exit
           

檢視R1/R6路由表

R6#show ip route rip
R    192.168.1.0/24 [120/1] via 192.168.4.1, 00:00:01, Ethernet1/0
R    192.168.2.0/24 [120/2] via 192.168.4.1, 00:00:01, Ethernet1/0
R    192.168.3.0/24 [120/2] via 192.168.4.1, 00:00:01, Ethernet1/0
           

R1和R6已經可以ping通了

R6#ping 192.168.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
           

在R2和R3中間抓包,可以看到MPLS标簽頭

使用GNS3實驗MPLS協定1. 配置IP和路由協定2. 配置PE路由器和骨幹路由器P3. PE上配置BGP4. 激活MP-BGP協定5. 配置VRF,實質是配置RT和RD6. 配置vrf與接口的關聯性7. 配置PE和CE之間的路由選擇協定和MP-BGP與RIP之間的路由重分發

可對照MPLS轉發表看

Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop
tag    tag or VC   or Tunnel Id      switched   interface
16     16          10.1.10.0/24      0          Fa0/1      10.1.30.1
17     17          10.1.1.2/32       0          Fa0/1      10.1.30.1
18     18          10.1.1.3/32       0          Fa0/1      10.1.30.1
19     Pop tag     10.1.1.4/32       0          Fa0/1      10.1.30.1
20     Pop tag     10.1.20.0/24      0          Fa0/1      10.1.30.1
21     Aggregate   192.168.4.0/24[V] 3120
22     Untagged    192.168.5.0/24[V] 0          Et1/0      192.168.4.2
23     Untagged    192.168.6.0/24[V] 0          Et1/0      192.168.4.2
           

#參考

[1] MPLS GNS3完成實驗

繼續閱讀