Skip to content

Device Prompts

Device Prompts Configuration for Reliable Network Command Execution in rConfig V8

Section titled “Device Prompts Configuration for Reliable Network Command Execution in rConfig V8”

Device prompts are critical components of rConfig’s command execution engine, serving as the signaling mechanism that determines when command output is complete and when the next command should be sent. Accurate prompt configuration directly impacts the reliability, efficiency, and completeness of device backups across your network infrastructure.

Understanding how device prompts work and how to configure them properly is essential for successful configuration management operations. Incorrectly configured prompts can lead to incomplete configuration captures, backup timeouts, or excessive delays in the backup process. This documentation provides comprehensive guidance on configuring device prompts, utilizing regular expressions for complex scenarios, and troubleshooting common prompt-related issues.

Device prompts are the text strings that network devices display to indicate they are ready to accept the next command. These prompts appear after a device completes processing and outputting the results of a command. In rConfig, prompt patterns tell the system when to stop capturing output and when to proceed with the next command in the backup sequence.

Common prompt examples across vendors:

Cisco IOS/IOS-XE: Router# or Router(config)#

Juniper JUNOS: user@router> or user@router#

Arista EOS: switch# or switch(config)#

Palo Alto Networks: admin@PA-firewall> or admin@PA-firewall#

Proper prompt configuration is fundamental to rConfig’s operation for several critical reasons:

Output Completeness: rConfig relies on prompt detection to know when command output has finished. If the prompt pattern doesn’t match what the device actually displays, rConfig may prematurely stop capturing output, resulting in incomplete configuration files that fail integrity checks.

Backup Efficiency: Accurate prompts allow rConfig to immediately proceed to the next command once output is complete. Incorrect prompts force rConfig to wait for timeout periods before continuing, significantly increasing backup duration across large device populations.

Command Sequencing: Many backup workflows require executing commands in specific CLI modes (enable mode, configuration mode, specific configuration contexts). Proper prompt configuration for each mode ensures commands execute in the correct sequence and context.

Error Detection: When prompts don’t match as expected, it often indicates underlying issues such as authentication failures, insufficient privileges, or device accessibility problems. Proper prompt configuration enables early detection of these issues.

Impact of incorrect prompts:

  • Download delays: Backups take significantly longer due to timeout waiting periods
  • Partial output: Configuration files are incomplete, missing critical sections
  • Failed integrity checks: Truncated output triggers CIC failures
  • Cascading failures: One incorrect prompt can cause subsequent commands in the sequence to fail

rConfig uses two distinct prompt configurations to handle different device CLI modes and command execution contexts.

The Main Prompt is the primary prompt pattern that rConfig expects to see after most commands execute. This is typically the standard user mode or enable mode prompt displayed by the device.

Purpose: Identifies when the device has completed processing a standard command and is ready for the next instruction.

Common patterns:

  • Cisco devices: hostname#
  • Juniper devices: user@hostname>
  • Generic pattern: .*# (matches any text ending with #)

When Main Prompt is used: After every standard show command, display command, or informational command executed during the backup process.

The Enable Prompt is used specifically after sending the enable command (or equivalent privilege escalation command) to a device. Some devices display a different prompt after privilege escalation, and this pattern tells rConfig to recognize that transition.

Purpose: Identifies successful privilege escalation and confirms the device is ready for privileged commands.

Common patterns:

  • Cisco enable mode: hostname#
  • Some devices use identical prompts for user and enable mode
  • Other devices show mode indicators in the prompt

When Enable Prompt is used: Specifically after the enable command or privilege escalation sequence, before executing commands that require elevated privileges.

Important distinction: Not all devices require separate enable prompt configuration. If your device displays the same prompt before and after privilege escalation, the enable prompt should match the main prompt.

For devices with consistent, unchanging prompts, static prompt configuration is straightforward and reliable.

Example: Single device with known hostname

If your device always displays Router-NYC# as its prompt:

Main Prompt: Router-NYC#
Enable Prompt: Router-NYC#

Example: Device with configuration mode prompts

If your device shows different prompts in different modes:

Main Prompt: Switch-LAB#
Enable Prompt: Switch-LAB>

Note that configuration mode prompts like Switch-LAB(config)# don’t require separate configuration if they all end with # and will be matched by the standard prompt pattern.

When managing multiple devices or devices whose prompts contain variable elements, wildcard patterns provide flexibility.

Simple wildcard example:

If you have devices named Router-Site1, Router-Site2, etc.:

Main Prompt: Router-.*#

The .* matches any characters, so this pattern matches:

  • Router-Site1#
  • Router-Site2#
  • Router-NYC#
  • Router-Production-East#

Generic wildcard for any device:

The most flexible pattern matches any hostname:

Main Prompt: .*#

This matches virtually any prompt ending with #, making it suitable for diverse device populations.

rConfig V8 provides enhanced regular expression (regex) support for device prompts, enabling sophisticated pattern matching for complex prompt scenarios. This addresses the challenge of managing devices with dynamic prompts, multiple CLI modes, or vendor-specific prompt variations.

Regular expressions allow you to define flexible patterns that match multiple variations of a prompt. This is essential when:

  • Device hostnames contain dynamic or site-specific elements
  • Devices display different prompts in various configuration modes
  • Managing multi-vendor environments with inconsistent prompt formats
  • Handling devices where prompts include timestamps, session IDs, or other variable data

Key point about delimiters: When entering regex patterns in rConfig prompt fields, you do NOT need to include regex delimiter characters (like / or ~) at the beginning and end of the string. rConfig handles delimiters internally. You only need to provide the pattern itself.

Special characters that must be escaped with backslash:

  • ( and ) - Parentheses: \( and \)
  • [ and ] - Square brackets: \[ and \]
  • { and } - Curly braces: \{ and \}
  • . - Period (literal dot): \.
  • * - Asterisk (literal): \*
  • + - Plus sign (literal): \+
  • ? - Question mark (literal): \?
  • | - Pipe character (literal): \|
  • ^ - Caret (literal): \^
  • $ - Dollar sign (literal): \$

Common regex metacharacters used in prompts:

  • . - Matches any single character
  • .* - Matches any sequence of characters (zero or more)
  • .+ - Matches any sequence of characters (one or more)
  • ? - Makes preceding element optional
  • | - OR operator (match this OR that)
  • ^ - Start of line anchor
  • $ - End of line anchor
  • \d - Matches any digit
  • \w - Matches any word character (letter, digit, underscore)
  • \s - Matches any whitespace

Scenario: Devices with naming pattern hostname-location#

myrouter-NYC#
myrouter-LAB#
myrouter-Production#

Regex pattern:

myrouter-.*#

How it works: .* matches any characters between myrouter- and #, accommodating any location or site identifier.

Scenario: Device shows different prompts in various configuration modes

hostname(config)#
hostname(config-if)#
hostname(config-vlan)#
hostname(config-router)#

Regex pattern:

hostname\(config.*\)#$

How it works:

  • \( - Matches literal opening parenthesis
  • config.* - Matches “config” followed by any characters
  • \) - Matches literal closing parenthesis
  • #$ - Matches # at end of line

This pattern matches all configuration mode variations while ensuring the prompt ends with #.

Scenario: Match only specific configuration sub-modes

hostname(config-if)#
hostname(config-vlan)#
hostname(config)#

Regex pattern:

hostname\(config(-if|-vlan)?\)#$

How it works:

  • \(config - Matches “config” after opening parenthesis
  • (-if|-vlan)? - Optionally matches either “-if” OR “-vlan”
  • \) - Matches closing parenthesis
  • #$ - Matches # at end of line

The ? makes the entire (-if|-vlan) group optional, so it matches (config)# as well as the specific sub-modes.

Scenario: Prompts with timestamps or session information

Router-NYC [08:45:23]#
Router-NYC [14:22:11]#
Router-LAB [timestamp]#

Regex pattern:

Router-.*\[.*\]#

How it works: \[.*\] matches the bracketed timestamp or any content within brackets, while .* after Router- matches the location identifier.

Scenario: Managing devices from different vendors with varying prompt formats

cisco-router#
juniper-switch>
arista-switch#
paloalto-firewall>

Regex pattern (matches # or >):

.*[#>]$

How it works: [#>] matches either # or > character, $ anchors to end of line, and .* matches any preceding text.

Scenario: Devices that include privilege level in prompt

router#15
router#1
router#

Regex pattern:

router#\d*$

How it works: \d* matches zero or more digits after #, and $ anchors to end of line, matching prompts with or without privilege level numbers.

Start anchor (^): Ensures the pattern matches from the beginning of the prompt

^hostname.*#$

This ensures “hostname” appears at the very start, preventing matches to prompts like some-prefix-hostname#.

End anchor ($): Ensures the pattern matches to the end of the prompt

.*#$

This confirms the prompt actually ends with # rather than having additional characters after it.

Alternation with |: Match multiple distinct patterns

(Router|Switch|Firewall)-.*#

Matches any prompt starting with Router, Switch, or Firewall followed by any characters and ending with #.

Optional groups with ?: Make entire sections optional

hostname(-\w+)?\(config\)#

Matches both hostname(config)# and hostname-site01(config)# because the (-\w+)? group is optional.

Custom character sets: Define exactly what characters can appear

Router-[A-Z]{3}\d{2}#

Matches prompts like Router-NYC01# or Router-LAB02# where the site code is three uppercase letters followed by two digits.

Before deploying regex prompts to production, thorough testing ensures they match actual device output correctly.

Using regex101.com for testing:

  1. Navigate to regex101.com
  2. Select PHP as the flavor (rConfig uses PHP regex engine)
  3. Enter your prompt pattern in the “Regular Expression” field
  4. Do not add delimiters - enter the pattern exactly as you would in rConfig
  5. Enter sample device prompts in the “Test String” field
  6. Verify that all expected prompts match and unwanted prompts don’t match
  7. Review the “Explanation” panel to understand how your pattern works

Test cases to validate:

  • All expected prompt variations from your devices
  • Edge cases like prompts with unusual characters
  • Prompts from different CLI modes (enable, config, sub-config)
  • Prompts that should NOT match (to avoid false positives)

Example testing workflow:

If you’re configuring a prompt for Cisco devices that might be in various config modes, test these patterns:

Test strings:
Router-NYC#
Router-NYC(config)#
Router-NYC(config-if)#
Router-NYC(config-router)#
Switch-LAB#
Switch-LAB(config-vlan)#
Pattern to test:
.*\(config.*\)?#$

Verify that all test strings match correctly before implementing in rConfig.

Initial approach: Begin with the most specific prompt pattern that matches your device’s actual output.

# Specific pattern for known device
Main Prompt: Router-Production-01#

Expand gradually: If managing similar devices, broaden the pattern incrementally.

# Slightly broader for device family
Main Prompt: Router-Production-.*#
# Even broader for all routers at site
Main Prompt: Router-.*#
# Broadest for any device
Main Prompt: .*#

Rationale: Specific patterns provide better error detection. If a prompt doesn’t match as expected, it may indicate device configuration issues, authentication problems, or other failures that broader patterns might mask.

For sophisticated regex patterns, maintain documentation explaining:

  • What prompt variations the pattern matches
  • Why specific regex elements were chosen
  • Examples of matching and non-matching prompts
  • Any vendor-specific considerations

Example documentation format:

Device: Cisco 3850 Switches
Main Prompt: catalyst-\d{4}\(config.*\)?#$
Purpose: Matches config and enable modes for numbered catalyst switches
Matches:
- catalyst-3850#
- catalyst-3850(config)#
- catalyst-3850(config-if)#
Does not match:
- catalyst-3850> (user mode, insufficient privileges)
- other-switch-3850# (wrong hostname prefix)

After modifying prompt configurations:

  1. Test with manual device connection: Verify the pattern matches actual device output
  2. Run test backup: Execute a backup of a single device to confirm prompt detection
  3. Review backup logs: Check /var/www/html/rconfig8/current/storage/logs/laravel.log for prompt-related warnings
  4. Verify output completeness: Ensure captured configurations are complete and pass CIC checks
  5. Monitor backup duration: Confirm no timeout delays indicating prompt mismatch

Different vendors have distinct prompt conventions that inform pattern design:

Cisco IOS/IOS-XE:

  • Standard format: hostname# or hostname(config)#
  • Multiple config modes: (config-if)#, (config-router)#, (config-vlan)#
  • Recommended pattern: .*\(config.*\)?#$

Juniper JUNOS:

  • User mode: user@hostname>
  • Operational mode: user@hostname>
  • Configuration mode: user@hostname#
  • Recommended pattern: .*[@].*[>#]$

Arista EOS:

  • Similar to Cisco: hostname# or hostname(config)#
  • Recommended pattern: .*\(config.*\)?#$

Palo Alto Networks:

  • Format: username@hostname> or username@hostname#
  • Different prompts for operational and configuration mode
  • Recommended pattern: .*@.*[>#]$

HP/Aruba:

  • Format varies by platform
  • ProCurve: hostname# or hostname(config)#
  • AOS-CX: hostname# or hostname(config)#
  • Recommended pattern: .*\(config.*\)?#$

Devices requiring enable command:

When devices require explicit privilege escalation (like Cisco’s enable command), configure both prompts appropriately:

Main Prompt: Router-.*#
Enable Prompt: Router-.*#

If the enable and privileged prompts are identical (as with most Cisco devices), use the same pattern for both.

Devices with different enable prompts:

Some devices show distinct prompts after privilege escalation:

Main Prompt: user@device>
Enable Prompt: user@device#

The enable prompt specifically matches the privileged mode indicator, while the main prompt matches standard operational mode.

Some devices have multiple levels of configuration mode (sub-modes within config mode). Ensure your patterns accommodate these:

# Matches all config mode depths
hostname\(config.*\)#$
Examples matched:
hostname(config)#
hostname(config-if)#
hostname(config-if-range)#
hostname(config-router-bgp)#

The .* within config.* matches any sub-mode indicators, providing flexibility for deep configuration contexts.

Symptoms: Device backups take significantly longer than expected, eventually timing out or completing after excessive delays.

Likely cause: The configured prompt pattern doesn’t match the actual device prompt, forcing rConfig to wait for timeout periods before proceeding.

Diagnosis steps:

  1. Manually connect to the device: Use SSH or Telnet to see the actual prompt displayed
  2. Compare with configured pattern: Check if the actual prompt matches your configured pattern
  3. Review backup logs: Look for timeout warnings in /var/www/html/rconfig8/current/storage/logs/laravel.log
Terminal window
# Check for prompt-related timeouts in logs
tail -n 200 /var/www/html/rconfig8/current/storage/logs/laravel.log | grep -i "timeout\|prompt"

Resolution:

Update the prompt configuration to match the actual device output. Test the new pattern using regex101.com before deploying.

Symptoms: Retrieved configuration files are truncated or missing sections, CIC checks fail.

Likely cause: rConfig stops capturing output prematurely because it incorrectly matched text within the command output as a prompt.

Diagnosis steps:

  1. Examine the captured output: Look at where the configuration file ends
  2. Check if prompt pattern appears in output: Search the configuration for text matching your prompt pattern
  3. Test pattern specificity: Verify your pattern doesn’t match content within command output

Example problematic scenario:

If your prompt pattern is simply # without anchors or context:

Main Prompt: #

Command output like this would cause premature capture termination:

! Configuration section
interface GigabitEthernet0/1
description Link to Core Switch #1
# This would trigger false prompt match

Resolution:

Make the prompt pattern more specific with appropriate anchors and context:

Main Prompt: .*#$

The .* before # and $ anchor ensure it matches the complete prompt line, not just any # character in output.

Symptoms: Backups fail during privilege escalation, logs show authentication errors or command failures after enable attempt.

Likely cause: Enable prompt doesn’t match the actual privileged mode prompt, so rConfig doesn’t recognize successful escalation.

Diagnosis steps:

  1. Manually execute enable command: Connect to device and run enable to see the resulting prompt
  2. Compare prompts: Check if the privileged prompt differs from user mode prompt
  3. Review enable prompt configuration: Verify it matches the actual privileged mode prompt

Resolution:

Update the enable prompt to match the actual privileged mode prompt. For devices where enable and user prompts are identical, ensure both prompt fields contain the same pattern.

Symptoms: Backups complete but captured output includes unexpected content, or multiple device types incorrectly use the same prompt configuration.

Likely cause: Prompt pattern is too generic and matches prompts from unintended devices or command output.

Resolution:

Narrow the prompt pattern to be more specific to your actual device configuration:

# Too broad
.*#
# More specific
Router-.*#
# Most specific
Router-Production-\d{2}#

Step-by-step testing procedure:

  1. Configure the prompt in rConfig device settings
  2. Enable detailed logging temporarily to capture prompt matching details
  3. Execute a test backup on a single device
  4. Monitor the backup in real-time if possible
  5. Review logs immediately after completion
  6. Examine captured output for completeness
  7. Validate CIC results to ensure complete configuration capture

Test backup command example:

Terminal window
# Trigger manual backup for specific device (adjust for your environment)
cd /var/www/html/rconfig8/current
php artisan rconfig:device-backup --device-id=123

Log analysis for prompt issues:

Terminal window
# Search for prompt-related log entries
grep -i "prompt" /var/www/html/rconfig8/current/storage/logs/laravel.log
# Look for timeout warnings
grep -i "timeout" /var/www/html/rconfig8/current/storage/logs/laravel.log
# Check for privilege escalation issues
grep -i "enable" /var/www/html/rconfig8/current/storage/logs/laravel.log

When troubleshooting complex regex patterns:

Break down the pattern: Test each component of your regex separately to identify which part isn’t matching.

# Full pattern
hostname\(config.*\)?#$
# Test components individually
hostname # Does hostname match?
hostname\(config # Does config mode match?
hostname\(config.*\) # Does any config mode match?
hostname\(config.*\)?# # Does optional config with # match?
hostname\(config.*\)?#$ # Does anchored version match?

Add explicit anchors: If your pattern matches unexpectedly, add ^ at start and $ at end to ensure complete line matching.

Escape special characters carefully: Double-check that all special characters are properly escaped.

Test with actual device output: Copy the exact prompt from a live device connection and test against it rather than assumed prompt format.

Some network devices include dynamic information in their prompts such as timestamps, session IDs, or connection details.

Example dynamic prompt:

admin@firewall [session:1234] [2025-10-14 15:30:22]>
admin@firewall [session:5678] [2025-10-14 16:45:11]>

Pattern to match:

admin@firewall \[session:\d+\] \[.*\]>

Explanation: \d+ matches any session number, and \[.*\] matches any timestamp format.

Some devices have multiple privilege levels with distinct prompts.

Example:

router> (user mode, level 1)
router# (privileged mode, level 15)
router#15 (privileged mode with explicit level)

Pattern to match all:

router[>#]\d*$

Explanation: [>#] matches either > or #, and \d* optionally matches privilege level numbers.

Devices in clusters or stacks may show member information in prompts.

Example:

switch-stack-1-member-1#
switch-stack-1-member-2#
switch-stack-2-member-1#

Pattern to match:

switch-stack-\d+-member-\d+#

Explanation: \d+ matches stack and member numbers, accommodating any stack/member configuration.

Some devices show the configuration context in their prompt.

Example:

router(config-router-bgp-65000)#
router(config-router-ospf-1)#
router(config-router-eigrp-100)#

Pattern to match:

router\(config-router-\w+-\d+\)#

Explanation: \w+ matches the routing protocol name, \d+ matches the process ID or AS number.

Impact of Prompt Matching on Backup Performance

Section titled “Impact of Prompt Matching on Backup Performance”

Accurate prompts = faster backups: When prompts match precisely, rConfig immediately proceeds to the next command without waiting, minimizing backup duration.

Timeout penalties: Each prompt mismatch forces rConfig to wait for configured timeout periods (typically 10-30 seconds per command). For a backup with 20 commands, incorrect prompts could add 3-10 minutes per device.

Large-scale impact: In environments with hundreds or thousands of devices, prompt configuration directly impacts overall backup window duration and system resource utilization.

Optimizing Prompt Patterns for Performance

Section titled “Optimizing Prompt Patterns for Performance”

Specificity vs. flexibility tradeoff: More specific patterns match faster but require more configuration effort. Broader patterns are easier to maintain but may have slightly longer matching times.

Regex complexity: Extremely complex regex patterns with many alternations or lookaheads may have minor performance impacts. For most scenarios, this is negligible compared to network latency and command execution time.

Caching considerations: rConfig caches compiled regex patterns internally, so pattern complexity has minimal impact on repeated backups of the same device.

  • Device Configuration: Complete guide to device setup including credential and connection settings
  • Commands: Understanding command execution and how prompts interact with command processing
  • Backup Policies: Creating efficient backup schedules that account for prompt configuration
  • Connection Templates: Configuring templates that include appropriate prompts for device families
  • Troubleshooting Device Backups: Comprehensive backup failure diagnosis and resolution
CharacterMeaningExample
.Any single characterRouter. matches Router1 or RouterA
.*Any characters (zero or more)Router-.*# matches Router-NYC#
.+Any characters (one or more)Router-.+# requires at least one character after -
?Previous element optionalRouter(-\d+)?# matches Router# or Router-01#
|OR operator(Router|Switch)# matches either device type
^Start of line^Router must start with Router
$End of line#$ must end with #
\dAny digitRouter-\d+# matches Router-123#
\wWord characterRouter-\w+# matches Router-NYC#
\sWhitespaceRouter\s+# matches Router #
CharacterEscaped FormUsage
(\(Router\(config\)#
)\)Router\(config\)#
[\[Router\[active\]#
]\]Router\[active\]#
{\{Router\{status\}#
}\}Router\{status\}#
VendorTypical PromptRecommended Pattern
Cisco IOSRouter# or Router(config)#.*\(config.*\)?#$
Juniper JUNOSuser@router> or user@router#.*@.*[>#]$
Arista EOSSwitch# or Switch(config)#.*\(config.*\)?#$
Palo Altoadmin@firewall> or admin@firewall#.*@.*[>#]$
HP ProCurveSwitch# or Switch(config)#.*\(config.*\)?#$
Fortinet FortiGateFortiGate # or FortiGate (config) #.* (\(.*\) )?#$

Device prompts are foundational to rConfig’s ability to reliably capture network device configurations. Proper prompt configuration ensures complete output capture, efficient backup operations, and early detection of device connectivity or authentication issues.

Prompt accuracy is critical: Incorrect prompts are among the most common causes of incomplete backups, timeout delays, and failed CIC checks. Investing time in accurate prompt configuration prevents significant operational issues.

Regex enables flexibility: Regular expression support allows sophisticated prompt patterns that accommodate dynamic elements, multiple CLI modes, and diverse device populations while maintaining accurate matching.

Test before deploying: Always validate regex patterns using tools like regex101.com and test backup operations on individual devices before deploying new prompt configurations broadly.

Start specific, expand judiciously: Begin with the most specific prompt pattern that matches your devices, broadening only as needed for manageability. Overly generic patterns mask potential issues.

No delimiters required: rConfig handles regex delimiters internally - enter only the pattern itself with appropriate escaping of special characters.

  1. Capture actual prompts from live devices rather than assuming prompt formats
  2. Document complex patterns with examples of matching and non-matching prompts
  3. Test regex patterns thoroughly before production deployment
  4. Monitor backup performance to identify prompt-related delays or failures
  5. Review logs after prompt configuration changes to confirm proper matching
  6. Maintain vendor-specific documentation for prompt patterns that work well with different device types
  7. Use anchors (^ and $) to ensure complete line matching