僞裝網絡工程師18——初識VRF

1、背景介紹

企業生產環境中,常常處於安全性的考慮會將網絡分爲:生產網絡,備份網絡等,這時候就須要對網絡進行隔離,而隔離的方法無外乎物理隔離與邏輯隔離。
物理隔離,就是爲每個網絡平面準備單獨的網元設備
僞裝網絡工程師18——初識VRF 安全

2、VRF的介紹

物理隔離儘管能實現網絡隔離的要求,但他有個明顯的短板:當網絡中存在多個平面時爲每個平面分配單獨的核心交換機成本太大,此處就須要藉助VRF(***-instance)來實現。
VRF實現的方式相似於虛擬化,邏輯上建立出一個空間,該空間有獨立的接口、TCP/IP協議棧、路由表,之間互不干擾,能夠理解爲將一臺物理核心交換機邏輯的分爲多個核心交換機,每一個交換機之間相互隔離
僞裝網絡工程師18——初識VRF 網絡

3、實驗拓撲

1.基礎配置

本次實驗拓撲以下圖所示,紫色部分是OM網絡,要求與黃色部分的網絡相互隔離,且同一區域兩個終端PC可以正常通訊。PC與路由器上的基礎配置省略,核心交換機的配置以下:
僞裝網絡工程師18——初識VRF ide

  1. 建立相應的vlan,併爲vlanif接口設置IP地址
    [SW1]vlan batch 10 20 100 200
    [SW1]interface Vlanif 10 
    [SW1-Vlanif10]ip add 1.1.1.254 24
    ........
  2. 此時發現vlanif接口是down狀態,緣由是此時並無接口加入到對應的vlan
    Interface                         IP Address/Mask      Physical   Protocol  
    MEth0/0/1                         unassigned           down       down      
    NULL0                             unassigned           up         up(s)     
    Vlanif1                           unassigned           up         down      
    Vlanif10                          1.1.1.254/24         down       down      
    Vlanif20                          2.2.2.254/24         down       down      
    Vlanif100                         11.0.0.1/24          down       down      
    Vlanif200                         12.0.0.1/24          down       down
  3. 將對應的接口加入到vlan
    [SW1]interface g0/0/11
    [SW1-GigabitEthernet0/0/11]port link-type access 
    [SW1-GigabitEthernet0/0/11]port default vlan 100
    .........
  4. 再看藉口狀態,vlanif端口狀態變爲up
    Interface                         IP Address/Mask      Physical   Protocol  
    MEth0/0/1                         unassigned           down       down      
    NULL0                             unassigned           up         up(s)     
    Vlanif1                           unassigned           down       down      
    Vlanif10                          1.1.1.254/24         up         up        
    Vlanif20                          2.2.2.254/24         up         up        
    Vlanif100                         11.0.0.1/24          up         up        
    Vlanif200                         12.0.0.1/24          up         up

    但此時PC1與PC2之間可以正常通訊,由於這兩個網段是直連到三層交換機上
    僞裝網絡工程師18——初識VRF
    此時並不知足要求,接下來就要建立VRF。 ui

    2.建立VRF進行網絡隔離

  5. 建立om的vrf,rd值是在mpls***中作網絡區分的,此處不作介紹
    [SW1]ip ***-instance om 
    [SW1-***-instance-om]route-distinguisher 1:1
  6. 將對應接口加入om的vrf,此時會發現接口上的IP地址配置被清空,從新爲vlanif添加IP地址
    [SW1]interface Vlanif 20
    [SW1-Vlanif20]ip binding ***-instance om
    Info: All IPv4 related configurations on this interface are removed!
    Info: All IPv6 related configurations on this interface are removed!
    ......

    再次添加地址後,全局路由表中再也不有2.2.2.0/24與12.0.0.0/24網段的信息
    僞裝網絡工程師18——初識VRF
    這兩個網段的信息收錄在在om平面的vrf中
    僞裝網絡工程師18——初識VRF this

    3.啓動ospf進程,完成配置

  7. R1上啓動ospf進程
    [R1]ospf 1 router-id 3.3.3.3 
    [R1-ospf-1]area 0
    [R1-ospf-1-area-0.0.0.0]network 11.0.0.2 0.0.0.0
    [R1-ospf-1-area-0.0.0.0]network 3.3.3.254 0.0.0.0
  8. R2上啓動ospf進程
    [R2]ospf 1 router-id 4.4.4.4
    [R2-ospf-1]area 0
    [R2-ospf-1-area-0.0.0.0]network 12.0.0.2 0.0.0.0
    [R2-ospf-1-area-0.0.0.0]network 4.4.4.254 0.0.0.0
  9. 在SW根實例上啓動ospf進程
    SW1]ospf 1 router-id 1.1.1.1 
    [SW1-ospf-1]area 0
    [SW1-ospf-1-area-0.0.0.0]network 1.1.1.254 0.0.0.0
    [SW1-ospf-1-area-0.0.0.0]network 11.0.0.1 0.0.0.0
  10. 在SW的OM實例上啓動ospf進程,注意此時進程號不能重複
    [SW1]ospf 2 router-id 1.1.1.1 ***-instance om
    [SW1-ospf-2]area 0
    [SW1-ospf-2-area-0.0.0.0]network 2.2.2.254 0.0.0.0
    [SW1-ospf-2-area-0.0.0.0]network 12.0.0.1 0.0.0.0

    此時能看到ospf的鏈接關係已創建
    僞裝網絡工程師18——初識VRF
    om平面的路由表並不會顯示在全局路由表中,查看時須要指定vrf進行查看
    僞裝網絡工程師18——初識VRF 3d

相關文章
相關標籤/搜索