# Configuring Virtual Routers

This section provides examples of some of the more common virtual router tasks.

There are different uses of the virtual-router command. You can create or access VRs and VRFs in Global Configuration mode or map a VR to a domain map in Domain Map Configuration mode. After you have created a VR, you can continue to work in different command modes and configure the same user interface parameters as before the virtual router was created.

For information about the many VR tasks you can configure, see the related chapter; for example, JunosE IP, IPv6, and IGP Configuration Guide or JunosE BGP and MPLS Configuration Guide.

To configure a virtual router:

- Create and name a VR in Configuration mode.
  host1(config)#virtual-router western host1:western(config)#
- Create a VRF to provide forwarding information to your router. In this example, the VRF created is in context with the VR created above.
  host1:western(config)#ip vrf eastern Proceed with new VRF creation? [confirm]host1:western(config-vrf)#virtual-router:eastern host1:western:eastern(config)#
- Access a VRF from the context of a different VR.
  host1(config)#virtual-router western:eastern host1:western:eastern(config)#
- View your configuration choices from a VR or VRF context.

      host1:western:eastern(config)#?
      aaa                      Configure authentication, authorization,
                                 and accounting characteristics
        access-list              Configure an access list entry
        arp                      Configure a static ARP entry
        bandwidth                Configure slot-group bandwidth control
        banner                   Define a banner line
        baseline                 Configure baseline operations
        boot                     Configure boot time behavior
        bulkstats                Configure bulkstats parameters
        classifier-list          Configure a classifier list entry
        clns                     Configure CLNS characteristics
        clock                    Set the system's clock
        controller               Configure controller parameters
        crypto                   Configure cryptographic parameters
        disable-autosync         Disable automatic synchronization of
                                 redundant system controller file system
        disable-switch-on-error  Disable automatic switch to redundant system
                                 controller upon software/hardware error
        enable                   Configure security related options
        end                      Exit Global Configuration mode
        exception                Configure core dump
        exclude-subsystem        Exclude copying a subsystem from the release
        exit                     Exit from the current command mode
        ftp-server               Configure FTP Server characteristics
        help                     Describe the interactive help system
        host                     Add/modify an entry to the host table
        hostname                 Set the host (system) name
        interface                Enter Interface Configuration mode
        ip                       Configure IP characteristics
        l2tp                     Configure L2TP parameters
        license                  Configure licenses
        line                     Enter Line Configuration mode
        log                      Configure logging settings
        macro                    Run a CLI macro
        map-list                 Create an NBMA static map
        memory                   Configure and administer memory operations
        mpls                     Configure MPLS global parameters
        no                       Negate a command or set its default(s)
        ntp                      Configure the Network Time Protocol
        policy-list              Enter Policy Configuration mode
        pppoe                    Configure PPPoE
        profile                  Specify a profile
        radius                   Configure RADIUS server
        rate-limit-profile       Enter rate limit profile configuration mode
        redundancy               Perform a redundancy configuration
        route-map                Configure a route map
        router                   Configure a routing protocol
        rtr                      Configure rtr parameters
        service                  Configure system-level services
        set                      Configure
        sleep                    Make the Command Interface pause for a
                                 specified duration
        slot                     Configure and administer slot operation
        snmp-server              Configure SNMP parameters
        sscc                     The SSC Client
        telnet                   telnet daemon configuration
        timing                   Configure network timing
        traffic-shape-profile    Enter traffic shape profile configuration mode
        virtual-router           Specify a virtual router
      host1:western:eastern(config)#

- View the VRF configuration choices from VRF Configuration mode.

      host1:western(config-vrf)#?
        exit          Exit from the current command mode
        export        Specify VRF export characteristics
        help          Describe the interactive help system
        import        Specify VRF import characteristics
        log           Configure logging settings
        macro         Run a CLI macro
        no            Negate a command or set its default(s)
        rd            Specify route distinguisher
        route-target  Specify VPN extended community Target
        sleep         Make the Command Interface pause for a
                       specified duration
      host1:western(config-vrf)#

- Access a VR to configure it with an interior gateway protocol (IGP) or exterior gateway protocol (EGP) to learn routes from a customer edge (CE) device. See the related routing protocol chapters for detailed information.

  Example 1
  VR with an IGP

  host1(config)#virtual-router miami host1:miami(config)#router ospf 5 host1:miami(config-router)#

  Example 2
  VR with an EGP

  host1(config)#virtual-router western host1:western(config)#router bgp 359 host1:western(config-router)#
- Configure a Telnet daemon to listen in VRs other than the default VR.
  host1(config)#virtual-router boston host1:boston(config)#telnet listen port 23
- List all VRs and VRFs on the router.

      host1#show virtual-router
      Virtual Router : default
      Virtual Router : thursday
      Virtual Router : western
                       VRF : eastern
      Virtual Router : boston
      Virtual Router : miami
      Virtual Router : northern
                       VRF : southern
      host1#

- Map a VR to a user domain name in Domain Map Configuration mode. The VR must already exist.
  host1(config)#aaa domain-map jacksonville host1(config-domain-map)#virtual-router western host1(config-domain-map)#

aaa domain-map

- Use to map a user domain name to a virtual router.
- Examples
  host1-0-1-90(config)#aaa domain-map juniper.net vrouter_1 host1-0-1-90(config)#aaa domain-map none vrouter__all_purpose host1-0-1-90(config)#aaa domain-map DEFAULT vrouter_all_purpose
- Use the no version to delete the domain map.
- See aaa domain-map.

ip vrf

- Use to create a VRF or access VRF Configuration mode to configure a VRF.
- You must specify a route distinguisher after you create a VRF. Otherwise, the VRF will not operate.
- Example
  host1-00-02-80:boston(config)#ip vrf vpn-A
- Use the no version to remove a VRF.
- See ip vrf.

telnet listen

- Use to create a Telnet daemon to listen in a virtual router.
- Example
  host1(config)#virtual-router 3 host1:3(config)#telnet listen port 3223
- Use the no version to delete the daemon.
- See telnet listen.

virtual-router

- From Global Configuration mode, use this command to create a virtual router or access the context of a previously created virtual router or a VRF.
- From Domain Map Configuration mode, use this command to map the VR to a user domain name. Use the no version in this mode to delete the VR parameter and assign the default VR.
- A VR name consists of 1–32 alphanumeric characters.
- After you are in the context of a particular VR or VRF (indicated by the change in the prompt), all subsequent commands you enter apply to that context until you exit the context.
- Use the no version of the command only to delete the VR and return the router to the default VR. Issuing the command no virtual-router vrName.vrfName has no effect.
- Issuing a no version of this command (no virtual-router : vrfName or no virtual-router vrName : vrfName) that specifies an existing VRF displays only the error message: “Cannot delete a VRF with this command.” You must use the no ip vrf command to remove a VRF.

  | Note: See the JunosE Command Reference Guide for additional information.

- Use the wait-for-completion keyword with the no version if you require a synchronous deletion of a VR, such as when executing Telnet or console commands through an external script. Alternatively, you might want to use this keyword if the VR being deleted has many configured VRFs and someone might attempt to re-create the VR before all the VRFs have been deleted. If you do not issue the wait-for-completion keyword in those circumstances, a virtual-router command issued as soon as the prompt appears could fail because the router is still deleting VRFs. You can specify a period during which the CLI waits before it returns a prompt. If you do not specify a wait time, then the CLI does not return a prompt until the operation is complete. You can press Ctrl+c to break out of the wait period early.
- See virtual-router.