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, Chapter 1, Configuring IP or JUNOSe BGP and MPLS Configuration Guide, Chapter 1, Configuring BGP Routing.
To configure a virtual router:
host1(config)#virtual-router westernhost1: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 easternProceed with new VRF creation? [confirm]host1:western(config-vrf)#virtual-router:easternhost1:western:eastern(config)#Access a VRF from the context of a different VR. host1(config)#virtual-router western:easternhost1:western:eastern(config)#View your configuration choices from a VR or VRF context. host1:western:eastern(config)#?aaa Configure authentication, authorization,and accounting characteristicsaccess-list Configure an access list entryarp Configure a static ARP entrybandwidth Configure slot-group bandwidth controlbanner Define a banner linebaseline Configure baseline operationsboot Configure boot time behaviorbulkstats Configure bulkstats parametersclassifier-list Configure a classifier list entryclns Configure CLNS characteristicsclock Set the system's clockcontroller Configure controller parameterscrypto Configure cryptographic parametersdisable-autosync Disable automatic synchronization ofredundant system controller file systemdisable-switch-on-error Disable automatic switch to redundant systemcontroller upon software/hardware errorenable Configure security related optionsend Exit Global Configuration modeexception Configure core dumpexclude-subsystem Exclude copying a subsystem from the releaseexit Exit from the current command modeftp-server Configure FTP Server characteristicshelp Describe the interactive help systemhost Add/modify an entry to the host tablehostname Set the host (system) nameinterface Enter Interface Configuration modeip Configure IP characteristicsl2tp Configure L2TP parameterslicense Configure licensesline Enter Line Configuration modelog Configure logging settingsmacro Run a CLI macromap-list Create an NBMA static mapmemory Configure and administer memory operationsmpls Configure MPLS global parametersno Negate a command or set its default(s)ntp Configure the Network Time Protocolpolicy-list Enter Policy Configuration modepppoe Configure PPPoEprofile Specify a profileradius Configure RADIUS serverrate-limit-profile Enter rate limit profile configuration moderedundancy Perform a redundancy configurationroute-map Configure a route maprouter Configure a routing protocolrtr Configure rtr parametersservice Configure system-level servicesset Configuresleep Make the Command Interface pause for aspecified durationslot Configure and administer slot operationsnmp-server Configure SNMP parameterssscc The SSC Clienttelnet telnet daemon configurationtiming Configure network timingtraffic-shape-profile Enter traffic shape profile configuration modevirtual-router Specify a virtual routerhost1:western:eastern(config)#View the VRF configuration choices from VRF Configuration mode. host1:western(config-vrf)#?exit Exit from the current command modeexport Specify VRF export characteristicshelp Describe the interactive help systemimport Specify VRF import characteristicslog Configure logging settingsmacro Run a CLI macrono Negate a command or set its default(s)rd Specify route distinguisherroute-target Specify VPN extended community Targetsleep Make the Command Interface pause for aspecified durationhost1: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 IGPhost1(config)#virtual-router miamihost1:miami(config)#router ospf 5host1:miami(config-router)#Example 2
VR with an EGPhost1(config)#virtual-router westernhost1:western(config)#router bgp 359host1:western(config-router)#host1(config)#virtual-router bostonhost1:boston(config)#telnet listen port 23List all VRs and VRFs on the router. host1#show virtual-routerVirtual Router : defaultVirtual Router : thursdayVirtual Router : westernVRF : easternVirtual Router : bostonVirtual Router : miamiVirtual Router : northernVRF : southernhost1#Map a VR to a user domain name in Domain Map Configuration mode. The VR must already exist. host1(config)#aaa domain-map jacksonvillehost1(config-domain-map)#virtual-router westernhost1(config-domain-map)#aaa domain-map
host1-0-1-90(config)#aaa domain-map juniper.net vrouter_1host1-0-1-90(config)#aaa domain-map none vrouter__all_purposehost1-0-1-90(config)#aaa domain-map DEFAULT vrouter_all_purposeUse the no version to delete the 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-AUse the no version to remove a VRF. telnet listen
host1(config)#virtual-router 3host1:3(config)#telnet listen port 3223Use the no version to delete the daemon. 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 132 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.