Option - Системные опции

Системные опции VyOS позволяют настроить поведение системы, оптимизировать производительность, управлять HTTP/SSH клиентами и изменять различные system-wide параметры для адаптации роутера под специфические требования.

Обзор

Категории системных опций

Performance Options:

  • Throughput optimization для высокой пропускной способности
  • Latency optimization для низких задержек
  • Kernel tweaks для специфических workloads

Network Client Options:

  • HTTP client source address и interface
  • SSH client source address и interface
  • Контроль исходящих соединений

Hardware Options:

  • Keyboard layout для консоли
  • Startup beep enable/disable
  • Root partition auto-resize

System Behavior:

  • CTRL-ALT-DELETE behavior (ignore/reboot/poweroff)
  • Reboot on kernel panic
  • Reboot on upgrade failure

Kernel Options:

  • CPU mitigations disable
  • Power saving disable
  • AMD P-State driver mode
  • Quiet boot mode

Применение в облачных средах

Yandex Cloud:

  • Performance tuning для compute-optimized instances
  • HTTP client source для metadata service
  • Auto-resize для disk expansion

VK Cloud:

  • Latency optimization для high-performance workloads
  • SSH client source для management networks
  • Kernel optimizations для specific instance types

Требования к изменениям

Большинство опций требуют:

  • Configuration commit
  • System reboot для kernel и performance опций
  • Проверка после применения

Performance Options

Performance Profiles

VyOS предоставляет два performance профиля для оптимизации network stack:

Throughput Profile:

# Оптимизация для максимальной пропускной способности
set system option performance throughput

commit

Назначение:

  • Максимизация network throughput
  • Оптимальные buffer sizes для bulk data transfer
  • Подходит для file servers, backup, content delivery

Изменяемые параметры:

  • Увеличенные TCP/UDP buffers
  • Aggressive TCP window scaling
  • Optimized interrupt coalescing

Latency Profile:

# Оптимизация для минимальных задержек
set system option performance latency

commit

Назначение:

  • Минимизация network latency
  • Быстрая packet processing
  • Подходит для VoIP, gaming, real-time applications

Изменяемые параметры:

  • Reduced buffer sizes
  • Faster interrupt processing
  • Lower latency network stack tuning

Применение Performance Profiles

После применения требуется reboot:

set system option performance throughput
commit
save

# Reboot system
reboot now

Проверка активного профиля

# Проверить текущую конфигурацию
show configuration system option performance

# System network parameters
show system kernel-parameters | grep net

Default Performance Mode

Если performance profile не задан:

  • Используется balanced mode
  • Default Linux kernel network stack settings
  • Подходит для general purpose workloads

HTTP Client Configuration

HTTP Client Source Address

Настройка source address для исходящих HTTP соединений:

# Использовать specific IP для HTTP requests
set system option http-client source-address 10.0.1.1

commit

Применение:

  • Контроль source IP для HTTP traffic
  • Routing specific для management connections
  • Compliance с firewall rules

HTTP Client Source Interface

Настройка source interface для исходящих HTTP соединений:

# Использовать specific interface для HTTP requests
set system option http-client source-interface eth0

commit

Применение:

  • Force HTTP через specific interface
  • Management traffic isolation
  • Multi-homed routing control

Комбинированная конфигурация

# Source interface и address
set system option http-client source-interface eth1
set system option http-client source-address 192.168.1.1

commit

Use Cases для HTTP Client Options

Yandex Cloud Metadata Service:

# Ensure HTTP metadata requests из правильного interface
set system option http-client source-interface eth0
set system option http-client source-address 10.0.0.10

commit

VK Cloud Management Network:

# Isolate management HTTP traffic
set system option http-client source-interface eth2
set system option http-client source-address 172.16.1.1

commit

Multi-WAN с HTTP источником:

# Force HTTP updates через specific WAN
set system option http-client source-interface eth1
set system option http-client source-address 203.0.113.1

commit

SSH Client Configuration

SSH Client Source Address

Настройка source address для исходящих SSH соединений:

# Использовать specific IP для SSH connections
set system option ssh-client source-address 10.0.1.1

commit

Применение:

  • Контроль source IP для SSH traffic
  • Firewall rules на remote servers
  • Audit и logging

SSH Client Source Interface

Настройка source interface для исходящих SSH соединений:

# Использовать specific interface для SSH
set system option ssh-client source-interface eth1

commit

Применение:

  • Force SSH через management interface
  • Network isolation
  • Multi-homed routing

Пример: SSH через Management Network

# SSH только через management interface
set system option ssh-client source-interface eth2
set system option ssh-client source-address 192.168.100.1

commit

# Проверка
ssh admin@remote-server
# Connection будет из 192.168.100.1

Keyboard Layout

Изменение раскладки клавиатуры

Keyboard layout влияет только на system console (не SSH):

# Доступные layouts: us, fr, de, fi, no, dk
set system option keyboard-layout us

commit

Supported Layouts:

  • us - US English (default)
  • fr - French
  • de - German
  • fi - Finnish
  • no - Norwegian
  • dk - Danish

Применение

Изменение требует reboot:

set system option keyboard-layout de
commit
save

reboot now

Проверка текущей раскладки

# Конфигурация
show configuration system option keyboard-layout

# Console keyboard settings
localectl status

Примечания

  • Keyboard layout влияет только на physical console
  • SSH sessions используют client keyboard layout
  • Serial console также использует configured layout

Startup Beep

Enable/Disable System Beep

Управление звуковым сигналом при загрузке системы:

Disable Beep (рекомендуется для datacenter):

# Отключить startup beep
set system option startup-beep

commit
save

Enable Beep (default behavior):

# Включить startup beep (удалить опцию)
delete system option startup-beep

commit
save

Применение

  • Изменение требует reboot
  • Полезно в datacenter для снижения шума
  • Diagnostic tool для troubleshooting загрузки

Проверка

# Текущая конфигурация
show configuration system option startup-beep

# После reboot system beeps или нет

CTRL-ALT-DELETE Behavior

Настройка поведения CTRL-ALT-DELETE

Control+Alt+Delete на console keyboard может быть настроен:

Ignore (рекомендуется для production):

# Игнорировать CTRL-ALT-DELETE
set system option ctrl-alt-delete ignore

commit
save

Reboot:

# Reboot при CTRL-ALT-DELETE
set system option ctrl-alt-delete reboot

commit
save

Poweroff:

# Poweroff при CTRL-ALT-DELETE
set system option ctrl-alt-delete poweroff

commit
save

Default (без конфигурации):

# Использовать system default (обычно ignore)
delete system option ctrl-alt-delete

commit

Безопасность

Production Environment:

# Всегда ignore для предотвращения accidental reboots
set system option ctrl-alt-delete ignore

commit

Development/Lab:

# Reboot для удобства
set system option ctrl-alt-delete reboot

commit

Проверка

# Текущая конфигурация
show configuration system option ctrl-alt-delete

# Systemd configuration
systemctl status ctrl-alt-del.target

Reboot on Panic

Automatic Reboot при Kernel Panic

Настройка автоматической перезагрузки при kernel panic:

Enable Reboot on Panic:

# Автоматический reboot при kernel panic
set system option reboot-on-panic

commit
save

Disable (default):

# Не reboot при panic (для debugging)
delete system option reboot-on-panic

commit

Применение

Production Servers:

# Enable для автоматического recovery
set system option reboot-on-panic

commit

Development/Debugging:

# Disable для анализа panic
delete system option reboot-on-panic

commit

Kernel Panic Timeout

Timeout настраивается через sysctl:

# Set panic timeout (секунды перед reboot)
set system sysctl parameter kernel.panic value 10

commit

Проверка

# VyOS конфигурация
show configuration system option reboot-on-panic

# Kernel parameter
cat /proc/sys/kernel/panic

Reboot on Upgrade Failure

Automatic Reboot при Failed Upgrade

Rollback и reboot при неудачном system upgrade:

Enable с Timeout:

# Reboot после 5 минут если upgrade failed
set system option reboot-on-upgrade-failure 300

commit
save

Disable (default):

delete system option reboot-on-upgrade-failure

commit

Timeout Values

# 5 минут (300 секунд)
set system option reboot-on-upgrade-failure 300

# 10 минут
set system option reboot-on-upgrade-failure 600

# 1 минута (minimum for testing)
set system option reboot-on-upgrade-failure 60

commit

Use Case

Remote Upgrades:

# Safety net для remote upgrades
set system option reboot-on-upgrade-failure 600

# Add system image
add system image https://example.com/vyos.iso

# System автоматически reboot если upgrade fails

Root Partition Auto-Resize

Automatic Root Filesystem Expansion

Автоматическое расширение root partition при загрузке:

Enable Auto-Resize:

# Расширить root filesystem при первой загрузке
set system option root-partition-auto-resize

commit
save

Disable:

delete system option root-partition-auto-resize

commit

Применение в Cloud

Yandex Cloud:

# При увеличении disk size в консоли
set system option root-partition-auto-resize

commit
save

# Reboot для применения
reboot now

VK Cloud:

# После resize instance disk
set system option root-partition-auto-resize

commit
reboot now

Проверка расширения

# Disk space до
df -h /

# После reboot с auto-resize
df -h /
# Filesystem должен использовать весь доступный disk

Manual Resize (альтернатива)

# Growpart для partition expansion
sudo growpart /dev/vda 1

# Resize filesystem
sudo resize2fs /dev/vda1

# Проверка
df -h /

Kernel Options

Disable CPU Mitigations

Отключение CPU mitigations для производительности (Spectre, Meltdown):

Disable Mitigations:

# Отключить CPU vulnerability mitigations
set system option kernel disable-mitigations

commit
save
reboot now

Warning: Отключение mitigations снижает security для повышения performance. Используйте только в trusted environments.

Disable Power Saving

Отключение CPU power saving для максимальной производительности:

Disable Power Saving:

# Максимальная performance без power saving
set system option kernel disable-power-saving

commit
save
reboot now

Применение:

  • High-performance compute workloads
  • Низкая latency applications
  • Когда power consumption не критична

AMD P-State Driver

Настройка AMD P-State driver mode (для AMD CPUs):

Available Modes:

# Passive mode (default)
set system option kernel amd-pstate-driver passive

# Active mode (более aggressive power management)
set system option kernel amd-pstate-driver active

# Guided mode (balance)
set system option kernel amd-pstate-driver guided

commit
save
reboot now

Passive Mode:

  • Default mode
  • Legacy frequency scaling
  • Better compatibility

Active Mode:

  • Hardware-controlled frequency
  • Better power efficiency
  • Newer AMD CPUs

Guided Mode:

  • Hybrid approach
  • Balance performance/power

Quiet Boot

Скрыть kernel boot messages:

Enable Quiet Boot:

# Минимальные boot messages
set system option kernel quiet

commit
save
reboot now

Disable (verbose boot):

delete system option kernel quiet

commit
reboot now

Проверка Kernel Options

# Boot parameters
cat /proc/cmdline

# CPU frequency governor
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

# CPU mitigations
cat /sys/devices/system/cpu/vulnerabilities/*

Примеры конфигураций

Пример 1: Yandex Cloud - Performance Tuning

Scenario: High-throughput compute instance в Yandex Cloud.

configure

# Throughput optimization
set system option performance throughput

# HTTP client для metadata service
set system option http-client source-interface eth0

# Auto-resize для disk expansion
set system option root-partition-auto-resize

# Reboot on panic для availability
set system option reboot-on-panic

# Disable unnecessary beep
set system option startup-beep

# Ignore CTRL-ALT-DELETE
set system option ctrl-alt-delete ignore

# Kernel optimizations
set system option kernel disable-power-saving

commit
save

# Reboot для применения kernel options
reboot now

Результат:

  • Максимальная network throughput
  • Автоматический disk resize
  • High availability через reboot on panic
  • Оптимизированная производительность

Пример 2: VK Cloud - Low Latency VoIP Router

Scenario: VoIP router в VK Cloud требующий минимальных задержек.

configure

# Latency optimization
set system option performance latency

# SSH через management network
set system option ssh-client source-interface eth1
set system option ssh-client source-address 172.16.1.10

# HTTP через management
set system option http-client source-interface eth1
set system option http-client source-address 172.16.1.10

# Reboot on panic
set system option reboot-on-panic

# Ignore CTRL-ALT-DELETE
set system option ctrl-alt-delete ignore

# Disable startup beep
set system option startup-beep

# Kernel options для low latency
set system option kernel disable-power-saving

commit
save
reboot now

Результат:

  • Минимальная network latency для VoIP
  • Isolated management traffic
  • Consistent performance

Пример 3: Enterprise Datacenter - Security-Focused

Scenario: Enterprise router с focus на security.

configure

# Balanced performance (no specific profile)
# Используем default

# HTTP client control
set system option http-client source-interface eth2
set system option http-client source-address 192.168.100.1

# SSH client control
set system option ssh-client source-interface eth2
set system option ssh-client source-address 192.168.100.1

# Security settings
set system option ctrl-alt-delete ignore

# Reboot on panic disabled для forensics
delete system option reboot-on-panic

# Disable beep
set system option startup-beep

# Keep CPU mitigations enabled (default)
# Не используем disable-mitigations для security

# Quiet boot для cleaner console
set system option kernel quiet

commit
save
reboot now

Результат:

  • Controlled management traffic
  • Security mitigations enabled
  • Production-ready configuration

Пример 4: Development Lab - Convenience

Scenario: Development/testing environment.

configure

# Throughput для testing
set system option performance throughput

# CTRL-ALT-DELETE reboot для удобства
set system option ctrl-alt-delete reboot

# Reboot on panic
set system option reboot-on-panic

# Verbose boot для debugging
delete system option kernel quiet

# German keyboard для локального console
set system option keyboard-layout de

commit
save
reboot now

Результат:

  • Удобство для developers
  • Easy troubleshooting
  • Fast recovery

Мониторинг и диагностика

Проверка системных опций

# Все system options
show configuration system option

# Specific option
show configuration system option performance
show configuration system option http-client
show configuration system option ssh-client

Performance Metrics

Network Throughput:

# Interface statistics
show interfaces ethernet eth0

# Detailed stats
show interfaces ethernet eth0 statistics

# Monitor traffic
monitor interface eth0

Latency Testing:

# Ping test
ping 8.8.8.8

# MTR для latency analysis
mtr 8.8.8.8

# Traffic capture
monitor traffic interface eth0

HTTP Client Verification

# Test HTTP source
curl -v http://example.com

# Check connection source
tcpdump -i eth1 -n port 80

# Verify routing
show ip route

SSH Client Verification

# SSH с verbose
ssh -v user@remote-host

# Check SSH source
# На remote host:
tail -f /var/log/auth.log
# Должен показать source address

Kernel Parameters

# Boot command line
cat /proc/cmdline

# CPU frequency
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# Performance stats
cat /proc/stat

# Memory usage
free -h

# System load
uptime

Performance Testing

Throughput Test:

# iperf3 server на remote
iperf3 -s

# iperf3 client на VyOS
iperf3 -c remote-server -t 60
# Должен показать high throughput с throughput profile

Latency Test:

# hping3 для latency
sudo hping3 -1 remote-server --fast

# sockperf для network latency
sockperf ping-pong -i remote-server -p 5001

Troubleshooting

Performance Profile не работает

Проблема: Performance profile не улучшает производительность.

Причины:

  1. System не был rebooted после изменений
  2. Hardware limitations
  3. Bottleneck в другом месте (CPU, disk)

Решение:

# Проверить конфигурацию
show configuration system option performance

# Проверить kernel parameters
cat /proc/cmdline | grep performance

# Если нет - reboot required
reboot now

# После reboot verify
cat /proc/sys/net/core/rmem_max
cat /proc/sys/net/core/wmem_max

HTTP Client Source не работает

Проблема: HTTP requests не используют configured source.

Причины:

  1. Source interface down
  2. No route через source interface
  3. Source address не на source interface

Диагностика:

# Check interface status
show interfaces

# Check routing table
show ip route

# Check source address
ip addr show eth1

# Test connectivity
ping -I eth1 8.8.8.8

Решение:

# Verify source interface up
show interfaces ethernet eth1

# Verify source address exists
show interfaces ethernet eth1 address

# Fix if needed
set interfaces ethernet eth1 address 10.0.1.1/24

# Verify routing
set protocols static route 0.0.0.0/0 next-hop 10.0.1.254 interface eth1

commit

Keyboard Layout не изменился

Проблема: Keyboard layout остался прежним после настройки.

Причины:

  1. System не был rebooted
  2. Опция задана неправильно
  3. Console vs SSH confusion

Решение:

# Verify configuration
show configuration system option keyboard-layout

# Reboot system
reboot now

# After reboot test на console (не SSH)
# SSH использует client keyboard layout

CTRL-ALT-DELETE не игнорируется

Проблема: CTRL-ALT-DELETE вызывает reboot несмотря на ignore.

Причины:

  1. Configuration не saved
  2. Systemd не обновлен
  3. Testing на SSH (не работает, только console)

Решение:

# Set ignore
set system option ctrl-alt-delete ignore
commit
save

# Verify systemd
systemctl status ctrl-alt-del.target

# Test только на physical console

Reboot on Panic не срабатывает

Проблема: System не reboots при kernel panic.

Причины:

  1. Panic timeout не задан
  2. Hardware hang
  3. Panic слишком серьезный для reboot

Решение:

# Enable reboot on panic
set system option reboot-on-panic
commit

# Set panic timeout
set system sysctl parameter kernel.panic value 10
commit
save

# Test trigger panic (ONLY IN TEST ENVIRONMENT)
# echo c > /proc/sysrq-trigger

Root Partition не расширился

Проблема: Root partition не expanded после disk resize.

Причины:

  1. System не был rebooted
  2. Partition table не обновлена
  3. Filesystem уже maximum size

Диагностика:

# Check disk size
lsblk

# Check filesystem size
df -h /

# Check partition table
sudo fdisk -l /dev/vda

Решение:

# Enable auto-resize
set system option root-partition-auto-resize
commit
save

# Reboot
reboot now

# Manual resize если auto-resize failed
sudo growpart /dev/vda 1
sudo resize2fs /dev/vda1

# Verify
df -h /

Kernel Options не применились

Проблема: Kernel options (disable-mitigations, disable-power-saving) не active.

Причины:

  1. System не был rebooted
  2. Hardware не поддерживает опцию
  3. Conflicting kernel parameters

Диагностика:

# Check boot parameters
cat /proc/cmdline

# Should see mitigations=off если configured
# Should see processor.max_cstate=0 для disable-power-saving

Решение:

# Verify configuration
show configuration system option kernel

# Reboot required для kernel options
reboot now

# After reboot verify
cat /proc/cmdline

# Check CPU governor
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Безопасность

Performance vs Security Trade-offs

Disable CPU Mitigations:

# Повышает performance НО снижает security
set system option kernel disable-mitigations

Риски:

  • Уязвим к Spectre, Meltdown attacks
  • Side-channel vulnerabilities
  • Используйте только в trusted networks

Рекомендация:

# Production - keep mitigations enabled (default)
delete system option kernel disable-mitigations

# Trusted lab - можно disable для performance
set system option kernel disable-mitigations

CTRL-ALT-DELETE Security

Production:

# Всегда ignore для предотвращения accidental reboots
set system option ctrl-alt-delete ignore

Physical Security:

  • Console access должен быть физически защищен
  • Ignore CTRL-ALT-DELETE не заменяет physical security
  • Monitor console access

Source Address Security

Whitelisting:

# Control source для HTTP/SSH
set system option http-client source-address 10.0.1.1
set system option ssh-client source-address 10.0.1.1

# Remote firewalls могут whitelist эти IPs

Audit:

# Log outgoing connections
set system syslog host 192.168.1.100 facility local0 level info

# Monitor source addresses
tcpdump -i any -n | grep "10.0.1.1"

Интеграция с облачными платформами

Yandex Cloud Metadata Service

HTTP Client для Metadata:

# Ensure metadata requests через правильный interface
set system option http-client source-interface eth0

# Metadata service IP: 169.254.169.254
# Должен быть доступен через eth0

commit

Testing:

# Test metadata access
curl http://169.254.169.254/latest/meta-data/

# Should return metadata

VK Cloud Instance Metadata

Similar Configuration:

# HTTP client через primary interface
set system option http-client source-interface eth0

# VK Cloud metadata service
curl http://169.254.169.254/openstack/latest/meta_data.json

commit

Cloud Disk Auto-Resize

Yandex Cloud:

# При увеличении disk в консоли
set system option root-partition-auto-resize
commit
save
reboot now

# После reboot filesystem expanded

VK Cloud:

# Similar process
set system option root-partition-auto-resize
commit
save
reboot now

Лучшие практики

  1. Performance Tuning:

    • Используйте throughput profile для file servers, backup
    • Используйте latency profile для VoIP, gaming, real-time apps
    • Test before/after для измерения improvement
    • Reboot после изменения performance profile
  2. HTTP/SSH Client Source:

    • Настройте source для predictable routing
    • Whitelist source addresses на remote firewalls
    • Document source configurations для troubleshooting
    • Test connectivity после изменений
  3. Keyboard Layout:

    • Настройте если используете non-US keyboard на console
    • Помните: только для console, не SSH
    • Reboot required после изменения
  4. Startup Beep:

    • Disable в datacenter для noise reduction
    • Keep enabled в small deployments для diagnostic
    • Personal preference
  5. CTRL-ALT-DELETE:

    • Всегда ignore в production
    • Physical console security критична
    • Document behavior для operations team
  6. Reboot on Panic:

    • Enable в production для automatic recovery
    • Disable в development для debugging
    • Set reasonable panic timeout (10-60 секунд)
    • Monitor panic events
  7. Root Auto-Resize:

    • Enable для cloud instances с dynamic disks
    • Test resize procedure перед production
    • Monitor filesystem space после resize
  8. Kernel Options:

    • Disable mitigations только в trusted environments
    • Disable power-saving для consistent performance
    • AMD P-State для новых AMD CPUs
    • Always test после kernel changes
  9. Change Management:

    • Test system options в lab environment
    • Document all changes
    • Plan reboot windows
    • Backup configuration перед changes
    • Verify после reboot
  10. Monitoring:

    • Monitor performance metrics после tuning
    • Track source address usage
    • Log kernel panics
    • Alert on unexpected reboots

Заключение

Системные опции VyOS предоставляют гибкие инструменты для настройки поведения системы и оптимизации производительности. Ключевые возможности:

  • Performance profiles - throughput и latency optimization для specific workloads
  • HTTP/SSH client source - контроль исходящих connections для security и routing
  • Keyboard layout - поддержка различных layouts для console access
  • System behavior - настройка startup beep, CTRL-ALT-DELETE, reboot on panic
  • Kernel options - advanced tuning для performance и power management
  • Cloud integration - auto-resize и metadata service support

Правильная конфигурация system options позволяет:

  • Оптимизировать performance под specific use cases
  • Улучшить security через source address control
  • Повысить availability через automatic reboot on panic
  • Упростить cloud deployment через auto-resize

Используйте system options для адаптации VyOS под ваши специфические требования:

  • High-throughput workloads → throughput profile
  • Low-latency applications → latency profile
  • Cloud environments → auto-resize и metadata configuration
  • Enterprise security → source address control и mitigations enabled

Всегда тестируйте изменения в non-production environment и планируйте reboot windows, так как большинство опций требуют system restart для применения.