MPLS实验

在这里插入图片描述

配置ip

r1
GigabitEthernet0/0/0              192.168.2.1/24       up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         192.168.1.1/24       up         up(s)

r2
GigabitEthernet0/0/0              192.168.2.2/24       up         up        
GigabitEthernet0/0/1              192.168.2.2/24       up         up        
GigabitEthernet0/0/2              23.1.1.1/24          up         up        
LoopBack0                         2.2.2.2/24           up         up(s) 

r3
GigabitEthernet0/0/0              23.1.1.2/24          up         up        
GigabitEthernet0/0/1              34.1.1.1/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         3.3.3.3/24           up         up(s)     

r4
GigabitEthernet0/0/0              34.1.1.2/24          up         up        
GigabitEthernet0/0/1              192.168.3.2/24       up         up        
GigabitEthernet0/0/2              unassigned           up         down      
GigabitEthernet4/0/0              192.168.3.2/24       up         up        
LoopBack0                         4.4.4.4/24           up         up(s)   

r5
GigabitEthernet0/0/0              192.168.3.1/24       up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         192.168.4.1/24       up         up(s) 


启动OSPF

r2
ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
  network 2.2.2.2 0.0.0.0 
  network 23.1.1.1 0.0.0.0 

r3
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 3.3.3.3 0.0.0.0 
  network 23.1.1.2 0.0.0.0 
  network 34.1.1.1 0.0.0.0 


r4
ospf 1 router-id 4.4.4.4 
 area 0.0.0.0 
  network 4.4.4.4 0.0.0.0 
  network 34.1.1.2 0.0.0.0 


BGP

bgp 1
 peer 3.3.3.3 as-number 1 
 peer 3.3.3.3 connect-interface LoopBack0
 peer 4.4.4.4 as-number 1 
 peer 4.4.4.4 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 3.3.3.3 enable
  peer 4.4.4.4 enable
  peer 4.4.4.4 next-hop-local 

客户A的MPLS VPN


r2
ip vpn-instance aa
 ipv4-family
  route-distinguisher 1:1
  vpn-target 1:1 export-extcommunity
  vpn-target 1:1 import-extcommunity
  interface GigabitEthernet0/0/0
 ip binding vpn-instance aa
 ip address 192.168.2.2 255.255.255.0 
ipv4-family vpn-instance aa 
  import-route direct
  import-route static
ip route-static vpn-instance aa 192.168.1.0 255.255.255.0 192.168.2.1

r4
ip vpn-instance aa
 ipv4-family
  route-distinguisher 1:1
  vpn-target 1:1 export-extcommunity
  vpn-target 1:1 import-extcommunity
interface GigabitEthernet0/0/1
 ip binding vpn-instance aa
 ip address 192.168.3.2 255.255.255.0 
ipv4-family vpn-instance aa 
  import-route direct
  import-route static
  ip route-static vpn-instance aa 192.168.4.0 255.255.255.0 192.168.3.1

ce端

ip route-static 192.168.3.0 255.255.255.0 192.168.2.2
ip route-static 192.168.4.0 255.255.255.0 192.168.2.2

路由表

 Total Number of Routes: 5
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   192.168.1.0        0.0.0.0         0                     0      ?
 *>   192.168.2.0        0.0.0.0         0                     0      ?
 *>   192.168.2.2/32     0.0.0.0         0                     0      ?
 *>i  192.168.3.0        4.4.4.4         0          100        0      ?
 *>i  192.168.4.0        4.4.4.4         0          100        0      ?

客户B

r2
ip vpn-instance b
 ipv4-family
  route-distinguisher 1:2
  vpn-target 1:1 2:2 export-extcommunity
  vpn-target 1:1 2:2 import-extcommunity
interface GigabitEthernet0/0/1
 ip binding vpn-instance b
 ip address 192.168.2.2 255.255.255.0 
rip 1 vpn-instance b
 network 192.168.0.0
 import-route bgp

ip vpn-instance b
 ipv4-family
  route-distinguisher 1:2
  vpn-target 2:2 export-extcommunity
  vpn-target 2:2 import-extcommunity
interface GigabitEthernet4/0/0
 ip binding vpn-instance b
 ip address 192.168.3.2 255.255.255.0 
ipv4-family vpn-instance b 
  import-route ospf 2
ospf 2 vpn-instance b
 import-route bgp
 area 0.0.0.0 
  network 192.168.3.1 0.0.0.0 





B路由表

[Huawei]display bgp vpnv4 vpn-instance b routing-table 

 BGP Local router ID is 23.1.1.1 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 VPN-Instance b, Router ID 23.1.1.1:

 Total Number of Routes: 5
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   192.168.1.0        192.168.2.1     0                     0      ?
 *>   192.168.2.0        192.168.2.2     0                     0      ?
 *>   192.168.2.2/32     127.0.0.1       0                     0      ?
 *>i  192.168.3.0        4.4.4.4         0          100        0      ?
 *>i  192.168.4.0        4.4.4.4         0          100        0      ?

r7可以访问公网环回

[r7]ip route-static 0.0.0.0 0 47.0.0.1

测试

<Huawei>ping 192.168.4.1
  PING 192.168.4.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.4.1: bytes=56 Sequence=1 ttl=252 time=60 ms
    Reply from 192.168.4.1: bytes=56 Sequence=2 ttl=252 time=80 ms
    Reply from 192.168.4.1: bytes=56 Sequence=3 ttl=252 time=70 ms
    Reply from 192.168.4.1: bytes=56 Sequence=4 ttl=252 time=50 ms
    Reply from 192.168.4.1: bytes=56 Sequence=5 ttl=252 time=70 ms

  --- 192.168.4.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 50/66/80 ms

测试

<r6>ping 192.168.4.1
  PING 192.168.4.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.4.1: bytes=56 Sequence=1 ttl=252 time=60 ms
    Reply from 192.168.4.1: bytes=56 Sequence=2 ttl=252 time=80 ms
    Reply from 192.168.4.1: bytes=56 Sequence=3 ttl=252 time=70 ms
    Reply from 192.168.4.1: bytes=56 Sequence=4 ttl=252 time=50 ms
    Reply from 192.168.4.1: bytes=56 Sequence=5 ttl=252 time=70 ms

  --- 192.168.4.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 50/66/80 ms
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值