VRF-Virtual Routing & Forwarding

原文 譯

Network Virtualization – Path Isolation

Network Virtualization makes most modern Path Isolation techniques in networking possible. Network Virtualization and Path Isolation are crucial in modern network design and implementation.
網(wǎng)絡(luò)虛擬化使大多數(shù)現(xiàn)代化路徑隔離技術(shù)在網(wǎng)絡(luò)中成為可能. 網(wǎng)絡(luò)虛擬化和路徑隔離是現(xiàn)代網(wǎng)絡(luò)設(shè)計(jì)和實(shí)現(xiàn)有著至關(guān)重要作用.

Tips: Virtualization is VRF in the router, VLAN in the switch, trunk (dot1q tagging) on the Ethernet link, context or VDOM on the firewall and VM on the server.
虛擬化 是 VRF之于路由器, VLAN之于交換機(jī),trunk之于以太網(wǎng)連接,VDOM之于防火墻,VM之于服務(wù)器

VRF

This was good enough reason for creating a blog post series which is giving an organized overview of different approaches in implementation of separated logical network partitions which are implemented over the enterprise physical network.
所以有足夠好的理由來(lái)創(chuàng)建一個(gè)blog系列,此系列對(duì)在企業(yè)物理網(wǎng)絡(luò)上實(shí)現(xiàn)分離的邏輯網(wǎng)絡(luò)分區(qū)的不同方法做了一個(gè)系統(tǒng)性的概述。

EVER NEEDED ONE EXTRA ROUTER? IT’S POSSIBLE TO SPLIT THE ROUTER INTO MORE LOGICAL ROUTERS BY USING VRF. HOW? HERE’S HOW!

Virtual Routing and Forwarding or VRF allows a router to run more that one routing table simultaneously. When running more routing tables in the same time, they are completely independent. For example, you could use overlapping IP addresses inside more VRFs on the same router and they will function independently without conflict (You can see this kind of overlap in the example below). It is possible to use same VRF instance on more routers and connect every instance separately using VRF dedicated router port or only a sub-interface.

虛擬路由轉(zhuǎn)發(fā)允許同時(shí)運(yùn)行多個(gè)路由表。當(dāng)同一時(shí)間運(yùn)行多個(gè)路由表時(shí),它們完全是各自獨(dú)立的。 比如,你可以在同一臺(tái)路由器上使用多個(gè)VRFs內(nèi)的重疊IP地址,并且它們將獨(dú)立運(yùn)行而不會(huì)發(fā)生沖突(您可以在下面的示例中看到這種重疊) 可以在更多路由器上使用相同的VRF實(shí)例,并使用VRF專用路由器端口或僅子接口分別連接每個(gè)實(shí)例。

You can find VRFs to be used on ISP side. Provider Edge (PE) routers are usually running one VRF per customer VPN so that one router can act as a PE router for multiple Customer Edge (CE) routers even with more customers exchanging the same subnets across the VPN. By running VRF per customer, those subnets will never mix in-between them.
你可以找到網(wǎng)絡(luò)服務(wù)提供商(Internet Service Provider)端使用的VRF。 供應(yīng)商端路由器通常為每個(gè)客戶VPN運(yùn)行一個(gè)VRF,以便一個(gè)路由器可以充當(dāng)多個(gè)客戶端(CE)路由器的PE路由器,即使有更多客戶通過(guò)VPN交換相同的子網(wǎng)。 通過(guò)為每個(gè)客戶運(yùn)行VRF,這些子網(wǎng)絕不會(huì)混合在它們之間。

VRFs are used to create multiple virtual routers from one physical router.
VRFs 被用來(lái)在單個(gè)實(shí)體物理路由上新建多個(gè)虛擬路由器

Every VRF is creating his own Routing table and CEF table, basically a separate RIB andFIB.
每個(gè)VRF會(huì)新建它自身的路由表及轉(zhuǎn)發(fā)表,基本上是一個(gè)獨(dú)立的RIB(Routing Information Base)和FIB(Forwarding Info Base)。 What is RIB and FIB ?

VRF is simply created by entering this command into Cisco router supporting VRFs:
VRF可以在cisco路由器上這樣簡(jiǎn)單的創(chuàng)建:

   ip vrf  MYTESTVRF 

When created, VRF needs route distinguisher in order to become functional. Route distinguishers are described a bit later. Route distinguisher (RD) for this VRF MYTESTVRF are configured with:
創(chuàng)建時(shí),VRF需要路由標(biāo)識(shí)符才能生效。 稍后介紹路由標(biāo)識(shí)符。 此VRF MYTESTVRF的路由標(biāo)識(shí)符配置為:

  rd 111:1

When created and configured with RD, VRF needs some interfaces which will then be dedicated to this VRF and could bring some traffic into this VRF. Router interface (or most probably subinterface), will be assigned to a VRF like this:
在創(chuàng)建和配置RD時(shí),VRF需要一些專用的接口,并可能會(huì)將一些流量引入此VRF。 路由器接口(或者最可能的子接口)將被分配給一個(gè)VRF,如下

  int gi1/0/1
    ip vrf forwarding MYTESTVRF

On L3 switch which is also a clever router, when we want a VLAN to become part of the VRF, we need to add VLAN interface to VRF and all members of the VLAN will then be part of that special VRF:
L3交換機(jī)也是一個(gè)智能的路由器,當(dāng)我們想要一個(gè)VLAN成為VRF的一部分時(shí),我們需要添加VLAN接口到VRF, VLAN的所有成員將會(huì)特別的多聯(lián)機(jī)的一部分:

  int VLAN 20
      ip vrf forwarding MYTESTVRF

You need to take into account that addition of interface to VRF will remove all existing IP addresses configured on the interface. It is done in this way because it can help to avoid address duplication in the new routing table if some incautious engineer is entering interface with IP address into VRF that already has an interface with this same IP.
需要考慮添加到VRF的接口將刪除接口上配置的所有現(xiàn)有IP地址。 這樣做是因?yàn)槿绻恍┎恍⌒牡墓こ處熣趯⒕哂蠭P地址的接口輸入到已經(jīng)具有與該相同IP的接口的VRF中,則可以避免在新路由表中的地址重復(fù)。

When configured, traffic received on the interface which is member of VRF is routed and forwarded with that VRF table.
配置后,VRF成員接口上的接收的流量將會(huì)隨著VRF表路由和轉(zhuǎn)發(fā)。

When thinking of VRFs, best example of something similar is VLAN trunking between two switches. Packet with VLAN tag entering the trunk interconnection in-between two switches can only enter the same VLAN when arriving on the other switch side. With VRFs is the same but done on L3 rather L2 for VLANs, and there are no trunk ports but L3 sub-interfaces (or physical interfaces). Packets that enter a specific VRF will be forwarded with routes from that VRF’s routing table.

Example goes even further. Like VLANs that span across multiple switches through trunk port, VRFs can be extended across multiple devices as well through sub-interfaces of two router interconnection or with separate interconnections.

The connections are L3 sub-interfaces, usually Ethernet VLAN interfaces with dot1q encapsulation. Most common Layer 2 virtualisation technique used these days.

VRF

CONFIGURATION FOR BOTH EXAMPLES

FIRST EXAMPLE (TWO INTERCONNECTIONS)

R1:

ip vrf MYTESTVRF
  rd 111:1

interface Gi 1/0/1
description Global Routing Table Interconnect
ip address 10.10.10.1 255.255.255.252

interface Gi 1/0/2
description VRF MYTESTVRF Interconnect
ip vrf forwarding MYTESTVRF
ip address 10.10.10.1 255.255.255.252

R2:

ip vrf MYTESTVRF
  rd 111:1

interface Gi 1/0/1
description Global Routing Table Interconnect
ip address 10.10.10.2 255.255.255.252

interface Gi 1/0/2
description VRF MYTESTVRF Interconnect
ip vrf forwarding MYTESTVRF
ip address 10.10.10.2 255.255.255.252

SECOND EXAMPLE (DOT1Q TAGGED SUBINTERFACES)

R1:

ip vrf MYTESTVRF
  rd 111:1
interface Gi 1/0/1.10
description Global Routing Table Interconnect
encapsulation dot1q 10
ip address 10.10.10.1 255.255.255.252

interface Gi 1/0/1.20
description VRF MYTESTVRF Interconnect
encapsulation dot1q 20
ip vrf forwarding MYTESTVRF
ip address 10.10.10.1 255.255.255.252

R2:

ip vrf MYTESTVRF
  rd 111:1
interface Gi 1/0/1.10
description Global Routing Table Interconnect
encapsulation dot1q 10
ip address 10.10.10.2 255.255.255.252

interface Gi 1/0/1.20
description VRF MYTESTVRF Interconnect
encapsulation dot1q 20
ip vrf forwarding MYTESTVRF
ip address 10.10.10.2 255.255.255.252

ICMP TEST EXAMPLE

Pinging from Gi 1/0/1 to Gi 1/0/1 on other side within Global Routing Table is straight forward ping:

R1:

ping 10.10.10.2

If you want to ping the same (but other) ip address. The one that is inside VRF MYTESTVRF you neet to initiate the ping within that VRF on R1:

ping vrf MYTESTVRF 10.10.10.2

Example above shows both solutions, although the subinterface example is the one that is used in the real world most of the time. We are extending VRF **MYTESTVRF **to other router (R2) by configuring interfaces of interconnection with VRF mapping configuration (ip vrf forwarding inside interface configuration). In this way every one of the interconnection will forward the traffic for mapped VRF.

Global Routing table is basically a VRF 0. The first RIB and FIB with no need of mapping as they exist by default and all L3 interfaces on the router are by default part of Global Routing table. When expanding VRF MYTESTVRF

we use one interconnection but we need to use another interconnection for Global routing table.

We can look at Global Routing table as first (native) VRF on the router with more VRF configured. This is also known as Global VRF, existing on all routers, with all interfaces assigned to it by default.

VRF LITE

Method of expanding several VRFs across multiple devices by using separate sub-interfaces or separate interconnection links is known as VRF Lite. This is basically the most lightweight way of running VPNs.

Being the simplest way of creating non-overlapping VPNs in a network is having some downsides to. This way of doing VRF expansion has poor scalability. You need dedicated link between two routers for every VPN (or dedicated sub-interface of one link). If you have the need for many VRFs, you will need many provisioned connections between routers.
作為在網(wǎng)絡(luò)中創(chuàng)建不重疊的VPN的最簡(jiǎn)單的方法有一些缺點(diǎn)。 這種做VRF擴(kuò)展的方式靈活性差。 每個(gè)VPN(或一個(gè)鏈路的專用子接口)需要兩臺(tái)路由器之間的專用鏈路。 如果您需要多個(gè)VRF,則需要在路由器之間提供很多配置的連接。

ROUTE DISTINGUISHERS

Remember from above, this is basic VRF config:

ip vrf MYTESTVRF rd 111:1

111 and 1 are 32-bit integers. Route Distinguisher is used to label every route from an VRF routing table with 64-bit prefix. It is done so that router can distinguish which prefixes are member of which VRF (different routing tables) avoiding that prefixes from different VRFs are mixed up.

Format for RD should be ASN:NN, with ASN meaning autonomous system and NN VRF number inside the router. Other way to configure it is

IP-Address:NN, IP being the router IP address and NN VRF number.

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 230,622評(píng)論 6 544
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 99,716評(píng)論 3 429
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人,你說(shuō)我怎么就攤上這事?!?“怎么了?”我有些...
    開封第一講書人閱讀 178,746評(píng)論 0 383
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)。 經(jīng)常有香客問我,道長(zhǎng),這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,991評(píng)論 1 318
  • 正文 為了忘掉前任,我火速辦了婚禮,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 72,706評(píng)論 6 413
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 56,036評(píng)論 1 329
  • 那天,我揣著相機(jī)與錄音,去河邊找鬼。 笑死,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 44,029評(píng)論 3 450
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 43,203評(píng)論 0 290
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 49,725評(píng)論 1 336
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 41,451評(píng)論 3 361
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 43,677評(píng)論 1 374
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 39,161評(píng)論 5 365
  • 正文 年R本政府宣布,位于F島的核電站,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 44,857評(píng)論 3 351
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 35,266評(píng)論 0 28
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 36,606評(píng)論 1 295
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 52,407評(píng)論 3 400
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 48,643評(píng)論 2 380

推薦閱讀更多精彩內(nèi)容