MPLS

R2/3/4是公网范围

R1与R5使用mpls

R6与R7使用mpls,R7g0/0/1连接公网

拓扑如下

一、

先将R2/3/4用ospf连通

R2

ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
  network 2.2.2.0 0.0.0.255 
  network 23.1.1.0 0.0.0.255 

R3

ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 3.3.3.0 0.0.0.255 
  network 23.1.1.0 0.0.0.255 
  network 34.1.1.0 0.0.0.255 

R4

ospf 1 router-id 4.4.4.4 
 silent-interface GigabitEthernet0/0/1 //将R7设置为静态端口
 area 0.0.0.0 
  network 4.4.4.0 0.0.0.255 
  network 34.1.1.0 0.0.0.255 
  network 47.1.1.0 0.0.0.255

R7向公网指缺省

ip route-static 0.0.0.0 0.0.0.0 47.1.1.1

R2与R4建立BGP邻居

R2

bgp 1
 router-id 2.2.2.2
 peer 4.4.4.4 as-number 1 
 peer 4.4.4.4 connect-interface LoopBack0
 ipv4-family vpnv4
  policy vpn-target
  peer 4.4.4.4 enable
  peer 4.4.4.4 advertise-community

R4

bgp 1
 router-id 4.4.4.4
 peer 2.2.2.2 as-number 1 
 peer 2.2.2.2 connect-interface LoopBack0
 ipv4-family vpnv4
  policy vpn-target
  peer 2.2.2.2 enable
  peer 2.2.2.2 advertise-community

二、

R2/3/4建立MPLS

R2

mpls lsr-id 2.2.2.2
mpls

mpls ldp
interface GigabitEthernet0/0/1
 ip address 23.1.1.1 255.255.255.0 
 mpls
 mpls ldp

R3

mpls lsr-id 3.3.3.3
mpls

mpls ldp
interface GigabitEthernet0/0/1
 ip address 23.1.1.2 255.255.255.0 
 mpls
 mpls ldp

interface GigabitEthernet0/0/2
 ip address 34.1.1.1 255.255.255.0 
 mpls
 mpls ldp

R4

mpls lsr-id 4.4.4.4
mpls

mpls ldp
interface GigabitEthernet0/0/2
 ip address 34.1.1.2 255.255.255.0 
 mpls
 mpls ldp

R2/4建立vpn空间

R2

ip vpn-instance b
 ipv4-family
  route-distinguisher 1:1
  vpn-target 1:1 export-extcommunity
  vpn-target 1:1 import-extcommunity

R4

ip vpn-instance b
 ipv4-family
  route-distinguisher 1:1
  vpn-target 1:1 export-extcommunity
  vpn-target 1:1 import-extcommunity

将R1R2私网连通

R2

ip route-static vpn-instance b 192.168.1.0 255.255.255.0 192.168.2.1

R1

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

将R4R5私网连通

R4

ip route-static vpn-instance b 192.168.4.0 255.255.255.0 192.168.3.1

R5

ip route-static 192.168.1.0 255.255.255.0 192.168.3.2
ip route-static 192.168.2.0 255.255.255.0 192.168.3.2

R2/4传递路由

R2

bgp 1 
ipv4-family vpn-instance b 
  import-route direct
  import-route static

R4

bgp 1 
ipv4-family vpn-instance b 
  import-route direct
  import-route static

三、

R6/7使用mpls通信

R2建立vpn空间

ip vpn-instance a
 ipv4-family
  route-distinguisher 2:2
  vpn-target 2:2 export-extcommunity
  vpn-target 2:2 import-extcommunity

R4建立vpn空间

ip vpn-instance a
 ipv4-family
  route-distinguisher 2:2
  vpn-target 2:2 export-extcommunity
  vpn-target 2:2 import-extcommunity

R2/6使用RIP协议

R6

rip 1
 undo summary
 version 2
 network 192.168.1.0
 network 192.168.2.0

R2

rip 1 vpn-instance a
 undo summary
 version 2
 network 192.168.2.0

R4/7使用ospf协议

R4

ospf 2 router-id 4.4.4.4 vpn-instance a
 area 0.0.0.0 
  network 192.168.3.0 0.0.0.255 

R7

ospf 2 router-id 7.7.7.7 
 area 0.0.0.0 
  network 192.168.3.0 0.0.0.255 
  network 192.168.4.0 0.0.0.255 

最后使用双点双向重发布

R2

rip 1 vpn-instance a
 import-route bgp
bgp 1
 ipv4-family vpn-instance a 
  import-route rip 1

R4

ospf 2 router-id 4.4.4.4 vpn-instance a
 import-route bgp
bgp 1 
ipv4-family vpn-instance a 
  import-route ospf 2

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值