天天看点

使用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完成实验

继续阅读