企業生產環境中,常常處於安全性的考慮會將網絡分爲:生產網絡,備份網絡等,這時候就須要對網絡進行隔離,而隔離的方法無外乎物理隔離與邏輯隔離。
物理隔離,就是爲每個網絡平面準備單獨的網元設備 安全
物理隔離儘管能實現網絡隔離的要求,但他有個明顯的短板:當網絡中存在多個平面時爲每個平面分配單獨的核心交換機成本太大,此處就須要藉助VRF(***-instance)來實現。
VRF實現的方式相似於虛擬化,邏輯上建立出一個空間,該空間有獨立的接口、TCP/IP協議棧、路由表,之間互不干擾,能夠理解爲將一臺物理核心交換機邏輯的分爲多個核心交換機,每一個交換機之間相互隔離 網絡
本次實驗拓撲以下圖所示,紫色部分是OM網絡,要求與黃色部分的網絡相互隔離,且同一區域兩個終端PC可以正常通訊。PC與路由器上的基礎配置省略,核心交換機的配置以下: ide
[SW1]vlan batch 10 20 100 200 [SW1]interface Vlanif 10 [SW1-Vlanif10]ip add 1.1.1.254 24 ........
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
[SW1]interface g0/0/11 [SW1-GigabitEthernet0/0/11]port link-type access [SW1-GigabitEthernet0/0/11]port default vlan 100 .........
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之間可以正常通訊,由於這兩個網段是直連到三層交換機上
此時並不知足要求,接下來就要建立VRF。 ui
[SW1]ip ***-instance om [SW1-***-instance-om]route-distinguisher 1:1
[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網段的信息
這兩個網段的信息收錄在在om平面的vrf中 this
[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
[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
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
[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的鏈接關係已創建
om平面的路由表並不會顯示在全局路由表中,查看時須要指定vrf進行查看 3d