VyOS Operation Mode
Operation mode in VyOS provides commands for monitoring system health, diagnosing problems, and performing operational tasks without changing the configuration. It is the primary working mode for day-to-day VyOS administration.
Core Concepts
Operation vs Configuration Mode
Operation Mode:
- The default mode after logging in
- Read-only and monitoring
- Runs operational commands (show, monitor, reset, clear)
- Does not change the configuration
- Prompt:
vyos@router:~$
Configuration Mode:
- For changing the configuration
- The set, delete, commit, and rollback commands
- Transactional approach
- Prompt:
vyos@router# - Entry: the
configurecommand
Command Categories
- show - Viewing information (state, statistics, configuration)
- monitor - Real-time monitoring
- reset - Resetting state (not the configuration)
- clear - Clearing counters and caches
- ping/traceroute - Network diagnostics
- generate/add/delete - System operations
Show Commands
System Information
# General system information
show version
# Output:
# Version: VyOS 1.5.x
# Release train: current
# Built by: autobuild@vyos.net
# Built on: Mon 14 Oct 2024 12:00 UTC
# Build UUID: ...
# Architecture: x86_64
# Hardware information
show system hardware
# Resource usage
show system memory
show system cpu
show system storage
# Uptime and load average
show system uptime
# Processes
show system processes
show system processes summary
show system processes extensiveNetwork Interfaces
# All interfaces
show interfaces
# A specific interface
show interfaces ethernet eth0
show interfaces bridge br0
show interfaces bond bond0
# Brief format
show interfaces brief
# Interface statistics
show interfaces ethernet eth0 statistics
show interfaces ethernet eth0 counters
# Physical state
show interfaces ethernet eth0 physical
# Interface queues
show interfaces ethernet eth0 queueIP Configuration and Routing
# IP addresses
show interfaces addresses
# ARP table
show arp
show arp interface eth0
# Routing table
show ip route
show ip route summary
show ip route 192.168.1.0/24
# A specific route
show ip route 8.8.8.8
# IPv6 routes
show ipv6 route
show ipv6 route summary
# Neighbor table (IPv6)
show ipv6 neighborsRouting Protocols
# OSPF
show ip ospf neighbor
show ip ospf database
show ip ospf interface
show ip ospf route
# BGP
show ip bgp summary
show ip bgp neighbors
show ip bgp
show ip bgp neighbor 10.0.0.1 advertised-routes
show ip bgp neighbor 10.0.0.1 received-routes
# Route maps and prefix lists
show route-map
show ip prefix-list
show ip community-listVPN
# IPsec
show vpn ipsec sa
show vpn ipsec state
show vpn ipsec status
# WireGuard
show interfaces wireguard
show interfaces wireguard wg01
# OpenVPN
show openvpn server
show openvpn client
show openvpn status server server1Firewall and NAT
# Firewall rules
show firewall
show firewall name WAN_IN
show firewall statistics
# NAT
show nat source statistics
show nat destination statistics
show nat source rules
show nat destination rules
# Connection tracking
show conntrack table ipv4
show conntrack table ipv6
show conntrack statisticsServices
# DHCP server
show service dhcp-server leases
show service dhcp-server statistics
show service dhcp-server leases pool LAN
# DHCPv6 server
show service dhcpv6-server leases
# DNS forwarding
show dns forwarding statistics
show dns forwarding nameservers
# NTP
show ntp
show system ntp
# SNMP
show snmp community
show snmp v3System Services
# SSH
show service ssh
# Users
show users
show users recent
# Logs
show log
show log tail
show log tail 50
show log | match error
show log | match eth0
# Services
show system servicesConfiguration
# Current configuration
show configuration
# A specific section
show configuration interfaces
show configuration service dhcp-server
# Commands for reproduction
show configuration commands
show configuration commands | match interface
# Saved configuration
show configuration file /config/config.boot
# Commit history
show system commit
show system commit diff 5Monitor Commands
Real-Time Monitoring
# Logs in real time
monitor log
monitor log colored
# Interface traffic
monitor interfaces
monitor interfaces eth0
monitor interfaces eth0 traffic
# Firewall
monitor firewall
monitor firewall name WAN_IN
# BGP neighbors
monitor protocol bgp
# Bandwidth usage
monitor bandwidth interface eth0Traffic Capture
# Traffic capture (tcpdump)
monitor traffic interface eth0
monitor traffic interface eth0 filter "port 80"
monitor traffic interface eth0 save /tmp/capture.pcap
# With additional filters
monitor traffic interface eth0 filter "host 192.168.1.100 and port 443"
# Verbose output
monitor traffic interface eth0 verboseReset Commands
Connection and Session Reset
# Reset a BGP neighbor
reset ip bgp 10.0.0.1
# Reset the OSPF process
reset ip ospf process
# Reset an IPsec SA
reset vpn ipsec-peer 203.0.113.1
# Reset conntrack connections
reset conntrack-sync external
reset conntrack-sync internalTerminal Reset
# Reset the terminal
reset terminalClear Commands
Clearing Counters and Cache
# Clear interface counters
clear interfaces ethernet eth0 counters
# Clear firewall counters
clear firewall name WAN_IN counters
clear firewall statistics
# Clear the ARP cache
clear arp
# Clear the route cache
clear ip route cache
# Clear the DNS cache
clear dns forwarding cache
# Clear the conntrack table
clear conntrack table ipv4
clear conntrack table ipv6Clearing System State
# Clear system logs
clear system login history user vyos
# Clear a DHCP lease
clear service dhcp-server lease 192.168.1.100Network Diagnostic Commands
Connectivity Testing
# Ping
ping 8.8.8.8
ping 8.8.8.8 count 5
ping 8.8.8.8 size 1400
ping 8.8.8.8 source-address 192.168.1.1
# Ping IPv6
ping 2001:4860:4860::8888
ping6 2001:4860:4860::8888
# Traceroute
traceroute 8.8.8.8
traceroute 8.8.8.8 source-address 192.168.1.1
# Traceroute IPv6
traceroute6 2001:4860:4860::8888
# MTU path discovery
ping 8.8.8.8 do-not-fragment size 1500DNS and Network Tools
# DNS lookup
nslookup google.com
nslookup google.com 8.8.8.8
# Dig
dig google.com
dig google.com @8.8.8.8 +short
dig google.com MX
# Host
host google.com
host 8.8.8.8
# Telnet
telnet 192.168.1.1 22
telnet smtp.gmail.com 25Network Scanning
# Port scan (if nmap is installed)
scan port 192.168.1.1
scan port 192.168.1.0/24 port 22
# ARP scan
scan arp interface eth1System Operation Commands
Power Management
# Reboot
reboot
reboot now
reboot in 10
# Power off
poweroff
poweroff now
poweroff in 30
# Cancel a scheduled reboot
shutdown -cImage Management
# List images
show system image
# Install a new image
add system image https://downloads.vyos.io/...
# Delete an image
delete system image 1.4.0
# Set the default boot image
set system image default-boot 1.5.0Configuration Management
# Copy the configuration
copy file /config/config.boot to /config/config.boot.backup
copy running-config file /tmp/running.conf
# Load a configuration
load /config/config.boot.backup
# Save the configuration
save
save /config/config.boot.backupPKI Operations
# Generate keys
generate pki key-pair
generate pki key-pair install my-key
# Generate a certificate
generate pki certificate sign my-ca install my-cert
# Generate a CSR
generate pki certificate-request install my-csr
# View certificates
show pki ca
show pki certificateSSH Keys
# Generate SSH keys
generate ssh-key user vyos
# Show SSH keys
show ssh fingerprints
show ssh server-keyAdvanced Operational Commands
System Debugging
# Enable debugging for a protocol
debug ospf events
debug bgp updates
# View the debug output
show log | match debug
# Disable debugging
no debug ospf events
no debug allHardware Information
# PCI devices
show hardware pci
# CPU information
show hardware cpu
# Memory banks
show hardware mem
# Sensors (temperature, fans)
show hardware sensorsContainer Operations
# List containers
show container
# Container details
show container name my-container
# Container logs
show container log name my-container
# Container statistics
show container name my-container statisticsPractical Usage Examples
1. Diagnosing Connectivity Problems
# Step 1: Check the interfaces
show interfaces brief
# Step 2: Check IP addresses
show interfaces addresses
# Step 3: Check routing
show ip route 8.8.8.8
# Step 4: Check conntrack
show conntrack table ipv4 | match 8.8.8.8
# Step 5: Ping test
ping 8.8.8.8 source-address <your-ip>
# Step 6: Traceroute
traceroute 8.8.8.82. Checking VPN Status
# IPsec
show vpn ipsec sa
show vpn ipsec status
# If the tunnel is down - check the logs
show log | match ipsec
# VTI interface statistics
show interfaces vti vti0 statistics
# Routing over the VPN
show ip route | match vti03. Performance Monitoring
# CPU and memory
show system uptime
show system cpu
show system memory
# Network throughput
show interfaces eth0 statistics
# Connection tracking usage
show conntrack statistics
# Top processes
show system processes extensive | head -204. BGP Diagnostics
# BGP neighbor state
show ip bgp summary
# Neighbor details
show ip bgp neighbors 10.0.0.1
# Received routes
show ip bgp neighbor 10.0.0.1 received-routes
# Advertised routes
show ip bgp neighbor 10.0.0.1 advertised-routes
# BGP table
show ip bgp
# Path to a specific network
show ip bgp 203.0.113.0/245. Firewall Analysis
# All firewall rules
show firewall
# Statistics for a specific ruleset
show firewall name WAN_IN statistics
# Connection tracking
show conntrack table ipv4 | wc -l
# Top conntrack sources
show conntrack table ipv4 | awk '{print $5}' | cut -d= -f2 | sort | uniq -c | sort -rn | head -10
# Check a specific connection
show conntrack table ipv4 | match "192.168.1.100"6. DHCP Troubleshooting
# Active leases
show service dhcp-server leases
# DHCP statistics
show service dhcp-server statistics
# Leases for a specific pool
show service dhcp-server leases pool LAN
# DHCP logs
show log | match dhcpUseful Techniques
Filtering Output
# Grep (match)
show configuration | match interface
show log | match error
# Exclude
show configuration | no-more | grep -v "!"
# Head/Tail
show log tail 50
show log | head -20
# Pipe to less for long output
show configuration | no-moreFormatting Output
# JSON format (for the API)
show interfaces format json
show configuration format json
# Without pagination
show log | no-more
# With timestamps
show log | match error | tailCopying and Saving Output
# Save to a file
show configuration > /tmp/config.txt
show running-config | cat > /tmp/running.txt
# SCP copy
scp /tmp/config.txt user@server:/backup/Aliases for Frequent Commands
In configuration mode:
configure
set system login user vyos alias sh="show"
set system login user vyos alias si="show interfaces"
set system login user vyos alias sir="show ip route"
commit
saveNow, in operation mode:
sh version # instead of show version
si brief # instead of show interfaces brief
sir summary # instead of show ip route summaryCommand Cheat Sheet
Top 20 Commands for Daily Work
show interfaces brief- Brief interface statusshow ip route- Routing tableshow configuration- Current configurationshow system uptime- System uptimeshow log tail 50- Last 50 log linesping 8.8.8.8- Connectivity testshow service dhcp-server leases- DHCP leasesshow vpn ipsec sa- IPsec tunnelsshow ip bgp summary- BGP statusshow firewall- Firewall rulesshow conntrack table ipv4- Connection trackingmonitor log- Logs in real timeshow system memory- Memory usageshow system cpu- CPU usageshow interfaces statistics- Interface statisticsshow nat source statistics- NAT statisticsshow version- System versionshow users- Logged-in usersshow system commit- Commit historysave- Save the configuration
Best Practices
Regular monitoring
- Check
show system uptimedaily - Monitor
show system memoryand CPU - Track
show conntrack statistics - Check
show log | match error
- Check
Documentation
- Save the output of important commands
- Take screenshots when problems occur
- Keep an operations log book
- Document changes
Troubleshooting workflow
- Start with
show interfaces brief - Check
show log tail 100 - Use
monitor logfor real-time visibility - Collect all diagnostics before contacting support
- Start with
Performance monitoring
- Regularly check
show system resources - Monitor interface statistics
- Track conntrack usage
- Keep an eye on routing table size
- Regularly check
Security
- Regularly check
show users - Monitor
show system login - Review firewall statistics
- Analyze conntrack for anomalies
- Regularly check
Automation
- Use scripts for regular checks
- Collect metrics into monitoring systems
- Automate routine tasks
- Create health check scripts
Backup awareness
- Run
saveregularly - Periodically run
show configuration commands > backup.txt - Store backups off the device
- Test the restore procedure
- Run
Learning path
- Start with the basic show commands
- Study command output
- Experiment with filters
- Create your own aliases
Remote management
- Use SSH instead of telnet
- Set up tmux/screen for long sessions
- Maintain out-of-band access
- Document recovery procedures
Command history
- Use the command history (up/down arrows)
- Ctrl+R to search the history
- Save frequently used commands
- Create command templates
Conclusion
VyOS operation mode provides a powerful set of commands for monitoring, diagnosing, and managing the system. Mastering these commands is critical for efficient VyOS administration and for quickly resolving problems in production environments.
Key takeaways:
- Operation mode is for monitoring, not for changes
- Show commands are the foundation of diagnostics
- Monitor commands give real-time visibility
- Reset/Clear are for operational tasks
- Hands-on practice is the key to mastery
Additional resources:
- VyOS Command Reference
- Configuration Guide - for changing the configuration
- Troubleshooting - problem-solving methodology
Reviewed by OpenNix LLC · Last updated on