目錄表

JUNOS routing-instances

其概念有一點點類似大型 Router 的 logical-routers,不過 routing-instances 沒有像 logical-routers 可以切割的那麼完整,應付小型的分割其實是足夠的。

instance-type

  1. forwarding
    • Forwarding instance
  2. l2vpn
    • Layer 2 VPN routing instance
  3. mpls-internet-multicast
    • Internet Multicast over MPLS routing instance
  4. no-forwarding
    • Nonforwarding instance
  5. virtual-router
    • Virtual routing instance
  6. vrf
    • Virtual routing forwarding instance

virtual-router

以下是將二個 vlan interface 獨立成一個 virtual-router instance,並為其建立自己的 routing table.

interfaces {
    vlan {
        unit 3001 {
            family inet {
                address 10.1.1.2/24;
            }
            family inet6 {
                address 2001:288:1009:ffa1::2/64;
            }
        }
        unit 4001 {
            family inet {
                address 10.2.1.1/24;
            }
            family inet6 {
                address 2001:288:1009:ffb1::1/64;
            }
        }
    }
}
routing-instances {
    v3001_vr {
        instance-type virtual-router;
        interface vlan.3001;
        interface vlan.4001;
        routing-options {
            rib v3001_vr.inet6.0 { // 特別注意這邊 rib 的名稱,請一定要跟 routing-instances 的名稱相符!!
                static {
                    route 0::0/0 next-hop 2001:b030:2308:ffb1::2;
                    route 2001:b030:2308:38::/64 next-hop 2001:b030:2308:ffa1::1;
                }
            }
            static {
                route 0.0.0.0/0 next-hop 10.2.1.254;
                route 10.38.0.0/16 next-hop 10.1.1.1;
            }
        }
    }
}

forwarding

可用來處理類似 Policy Based Route,在 JUNOS 是使用 Firewall 這個 function 來處理判斷的條件,然後再由 routing-instances 中的 forwarding 來進行轉送動作。相關的設定範例請見Routing Policy(AKA.Policy Based Route)