isp mpls專線

背景兩家公司通過同一個isp接入,完成mpls ***專線使各個公司能夠訪問內部網絡。

wKioL1ZHRTGyxicwAABUtqeS8Mk489.png

拓撲如上:

ip : RX-RY:  RX: XY.1.1.X   L0:X.X.X.X  RY:XY.1.1.Y  L0:Y.Y.Y.Y

首先配置R2-R3-R4 isp網絡。這邊使用ospf協議保證isp網絡互通,使用bgp協議(VRf)進行傳遞私網路由,使用mpls標籤進行快速轉發。

R2:

os 1 

net 23.1.1.2 0.0.0.0 a 0

net 2.2.2.2 0.0.0.0 a 0

R3:

os 1

net 23.1.1.3 0.0.0.0 a 0

net 3.3.3.3 0.0.0.0 a 0

net 34.1.1.3 0.0.0.0 a 0

R4:

os 1 

net 34.1.1.4 0.0.0.0 a 0

net 4.4.4.4 0.0.0.0 a 0

完成上述配置,R2,R3,R4已經能夠建立ospf鄰居,ok這邊因爲主要是講mpls,所以就不加ospf區域驗證之類的了。

然後開啓mpls 

R2-R4

ip cef

int 所有公網接口 mpls ip 注:不包括和公司路由對接的接口如R2只在S1/2開啓mpls ip

mpls label range 200 299 / 300 399 / 400 499 便於排錯 開啓標籤範圍

完成上述配置,可以通過sh mpls for 查看lable

R3#sh mpls forwarding-table 

Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop    

tag    tag or VC   or Tunnel Id      switched   interface              

300    Pop tag     4.4.4.4/32        7647       Se1/1      point2point  

301    Pop tag     2.2.2.2/32        6009       Se1/0      point2point  

然後是R2 R4 開啓mp-bgp 用於傳遞vrf路由(關於vrf技術,你可以認爲把一臺路由器當成多臺路由器進行使用,主要區別各個虛擬路由器使用單獨的路由表)

R2 :

router b 2

 bgp router-id 2.2.2.2

 no bgp default ipv4-unicast

 neighbor 4.4.4.4 remote-as 4

 neighbor 4.4.4.4 ebgp-multihop 255

 neighbor 4.4.4.4 update-source Loopback0

 address-family ***v4

  neighbor 4.4.4.4 activate

  neighbor 4.4.4.4 send-community extended  //默認開啓,因爲需要傳遞私網路由。所以要加屬性

 exit-address-family

R4:

 跟R2差不多就是改一下地址

查看結果用sh ip bgp ***v4 all su 


Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

2.2.2.2         4     2      95      85       19    0    0 01:14:46        3

下面就是重點了:

R2:

ip vrf b

 rd 2:2   //

 route-target export 2:2

 route-target import 2:2

!         

ip vrf gongsia

 rd 1:1   

 route-target export 1:1

 route-target import 1:1

RD (Route Distinguisher)

  1. 用於標識PE上不同***實例,其主要作用是實現***實例之間地址複用,與IP地址一起構成12 Bytes的***v4地址。

  2. RD與路由一起被攜帶在BGP Update報文中發送給對端。

  3. RD不具有選路能力,不影響路由的發送與接受。

  4. RD用來區分本地VRF,本地有效。

RT (Route Target)

  1. RT是***v4路由攜帶的一個重要屬性,它決定***路由的收發和過濾,PE依靠RT屬性區分不同***之間路由。

  2. 當從VRF表中導出***路由時,要用Export RT對***路由進行標記。

  3. 當往VRF表中導入***路由時,只有所帶RT標記與VRF表中任意一個Import RT相符的路由纔會被導入到VRF表中。

----來自http://blog.sina.com.cn/s/blog_6a6b6f1a0100yzv5.html

分別把和公司A,公司b的接口加入的相關的vrf 下:

R2

interface Serial1/1

 ip vrf forwarding b   

//熟悉了之後先把接口加到vrf下再配置地址,否則你會發現介入vrf後沒地址了

interface Serial1/0

 ip vrf forwarding gongsia

R4做相同配置

下面是如何保證公司路由和isp的vrf進行路由的交換以及和公司分部的路由交換配置:

R6-R2 R7-R4

這邊我們採用的是ospf協議進行互通

這邊首先要指導,R2 和R4 已經使用了os 1 。

這邊我們使用ospf 10 進行互聯,基本配置就不貼了。重點是R2和R4的ospf 進程要寫:

R2:

router ospf 10 vrf gongsia  //ospf進程需要寫入vrf中,eigrp需要指定進程號

 log-adjacency-changes

 redistribute bgp 2 subnets  //這邊是用於將私網路由重分佈到bgp 中進行傳遞路由

 network 26.1.1.2 0.0.0.0 area 0

ip route vrf b 1.1.1.0 255.255.255.0 Serial1/1  公司b我們通過靜態路由寫,也要寫入vrf中

route b 2

 address-family ipv4 vrf gongsia

  redistribute ospf 10 vrf gongsia  //分別在不同bgp vrf下重分佈相應的和ce端路由協議

  no synchronization

 exit-address-family     

 !

 address-family ipv4 vrf b

  redistribute static   

  no synchronization

 exit-address-family

R4:

R4#sh run | s ospf

router ospf 10 vrf gongsia

 router-id 47.1.1.4

 log-adjacency-changes

 redistribute bgp 4 subnets

 network 47.1.1.4 0.0.0.0 area 0

router ospf 1

 log-adjacency-changes

 network 4.4.4.4 0.0.0.0 area 0

 network 34.1.1.4 0.0.0.0 area 0

  redistribute ospf 10 vrf gongsia

R4#sh run | s bgp

 redistribute bgp 4 subnets

router bgp 4

 bgp router-id 4.4.4.4

 no bgp default ipv4-unicast

 bgp log-neighbor-changes

 neighbor 2.2.2.2 remote-as 2

 neighbor 2.2.2.2 ebgp-multihop 255

 neighbor 2.2.2.2 update-source Loopback0

 !

 address-family ***v4

  neighbor 2.2.2.2 activate

  neighbor 2.2.2.2 send-community extended

 exit-address-family

 !

 address-family ipv4 vrf gongsia

  redistribute ospf 10 vrf gongsia

  no synchronization

 exit-address-family

 !

 address-family ipv4 vrf b

  redistribute static

  no synchronization

 exit-address-family

R3只要開啓mpls功能即可,不要其他配置。

查看mpls 鄰居,以及lable標籤

R4#sh mpls ldp bindings 

  tib entry: 2.2.2.2/32, rev 8

        local binding:  tag: 401

        remote binding: tsr: 3.3.3.3:0, tag: 301

  tib entry: 3.3.3.3/32, rev 6

        local binding:  tag: 400

        remote binding: tsr: 3.3.3.3:0, tag: imp-null

  tib entry: 4.4.4.4/32, rev 4

        local binding:  tag: imp-null

        remote binding: tsr: 3.3.3.3:0, tag: 300

  tib entry: 23.1.1.0/24, rev 10

        local binding:  tag: 402

        remote binding: tsr: 3.3.3.3:0, tag: imp-null

  tib entry: 34.1.1.0/24, rev 3

        local binding:  tag: imp-null

        remote binding: tsr: 3.3.3.3:0, tag: imp-null

R4#sh mpls ldp

R4#sh mpls ldp ne

R4#sh mpls ldp neighbor 

    Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 4.4.4.4:0

        TCP connection: 3.3.3.3.646 - 4.4.4.4.60420

        State: Oper; Msgs sent/rcvd: 109/110; Downstream

        Up time: 01:30:04

        LDP discovery sources:

          Serial1/0, Src IP addr: 34.1.1.3

        Addresses bound to peer LDP Ident:

          23.1.1.3        3.3.3.3         34.1.1.3    

R5#ping 1.1.1.1 so 5.5.5.5  //最後ping的時候需要加源


Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:

Packet sent with a source address of 5.5.5.5 

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 140/160/184 ms

忘了一點,如果mpls協議的底層協議是ospf。需要將lo 設置成32位地址,這邊我將R6 R7設置位32爲

R1 R5 24沒有問題。

本文還是個人筆記,如有錯誤請各位大神指正。摘抄已註明出處,如果有問題,單聊我,我會進行處理。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章