Example: Using Virtual Routing Instances to Route Among VLANs on EX-series Switches
Virtual routing instances allow each EX-series switch to have multiple routing tables on a device. With virtual routing instances, you can segment your network to isolate traffic without setting up additional devices.
This example describes how to create virtual routing instances:
Requirements
This example uses the following hardware and software components:
- One EX-series switch
- JUNOS Release 9.2 or later for EX-series switches
Before you create the virtual routing instances, make sure you have:
- Configured the necessary VLANs. See Configuring VLANs for EX-series Switches (CLI Procedure) or Configuring VLANs for EX-series Switches (J-Web Procedure).
Overview and Topology
In a large office, you may need multiple VLANs to properly manage your traffic. This configuration example shows a simple topology to illustrate how to connect a single EX-series switch with a virtual routing instance for each of two VLANs, enabling traffic to pass between those VLANs.
In the example topology, the LAN is segmented into two VLANs, each associated with an interface and a routing instance on the EX-series switch.
Configuration
CLI Quick Configuration
To quickly create and configure virtual routing instances, copy the following commands and paste them into the switch terminal window:
[edit] set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 1030
family inet address 103.1.1.1/24 set interfaces ge-0/0/3 unit 1 vlan-id 1031
family inet address 103.1.1.1/24 set routing-instances r1 instance-type virtual-routerset routing-instances r1 interface ge-0/0/1.0set routing-instances r1 interface ge-0/0/3.0set routing-instances r2 instance-type virtual-routerset routing-instances r2 interface ge-0/0/2.0set routing-instances r2 interface ge-0/0/3.1Step-by-Step Procedure
To configure virtual routing instances:
- Create a VLAN-tagged interface:
[edit]
user@switch# set interfaces ge-0/0/3 vlan-tagging - Create two subinterfaces, on the interface, one
for each routing instance:
[edit]
user@switch# set interfaces ge-0/0/3 unit 0 vlan-id 1030 family inet address 103.1.1.1/24user@switch# set interfaces ge-0/0/3 unit 1 vlan-id 1031 family inet address 103.1.1.1/24 - Create two virtual routers:
[edit]
user@switch# set routing-instances r1 instance-type virtual-router
user@switch# set routing-instances r2 instance-type virtual-router - Set the interfaces for the virtual routers:
[edit]
user@switch# set routing-instances r1 interface ge-0/0/1.0user@switch# set routing-instances r1 interface ge-0/0/3.0user@switch# set routing-instances r2 interface ge-0/0/2.0user@switch# set routing-instances r2 interface ge-0/0/3.1
Results
Check the results of the configuration:
- user@switch> show configuration
- interfaces {
-
- ge-0/0/1 {
-
- unit 0 {
- family ethernet-switching;
- }
- }
-
- ge-0/0/2 {
-
- unit 0 {
- family ethernet-switching;
- }
- }
-
- ge-0/0/3 {
- vlan-tagging;
-
- unit 0 {
- vlan-id 1030;
-
- family inet {
- address 103.1.1.1/24;
- }
- }
-
- unit 1 {
- vlan-id 1031;
-
- family inet {
- address 103.1.1.1/24;
- }
- }
- }
-
- routing-instances {
-
- r1 {
- instance-type virtual-router;
- interface ge-0/0/1.0;
- interface ge-0/0/3.0;
- }
-
- r2 {
- instance-type virtual-router;
- interface ge-0/0/2.0;
- interface ge-0/0/3.1;
- }
- }
Verification
To confirm that the configuration is working properly, perform these tasks:
Verifying That the Routing Instances Were Created
Purpose
Verify that the virtual routing instances were properly created on the switch.
Action
Use the show route instance command:
user@switch> show route instanceInstance Type
Primary RIB Active/holddown/hidden
master forwarding
inet.0 3/0/0
r1 virtual-router
r1.inet.0 1/0/0
r2 virtual-router
r2.inet.0 1/0/0
Meaning
Each routing instance created is displayed, along with its type, information about whether it is active or not, and its primary routing table.
