Linux command
vtysh 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Start the interactive shell
sudo vtysh
Execute a single command
sudo vtysh -c "[show ip route]"
Execute command and echo it
sudo vtysh -E -c "[show ip route]"
Connect to a specific daemon
sudo vtysh -d [bgpd]
Execute boot startup configuration
sudo vtysh -b
Show running configuration
sudo vtysh -c "show running-config"
说明
vtysh is an integrated command shell for FRRouting (FRR) and Quagga routing software. It provides a unified Cisco IOS-like CLI for configuring and monitoring all routing daemons (Zebra, BGP, OSPF, RIP, IS-IS, etc.) from a single interface. The shell operates in hierarchical modes: User EXEC mode for basic commands, Privileged EXEC mode (via enable) for administrative commands, and Configuration mode (via configure terminal) for making changes. Each routing protocol has its own configuration sub-mode. vtysh connects to all running routing daemons through their control sockets, presenting their combined functionality. Commands like show ip route, show bgp summary, and show running-config aggregate information from all relevant daemons. Configuration can be saved with write memory to the integrated config file (/etc/frr/frr.conf) or individual daemon configs.
参数
- -b, --boot
- Execute boot startup configuration from the integrated config file.
- -c _command_, --command _command_
- Execute specified command and exit. Can be used multiple times for multiple commands.
- -d _daemon_, --daemon _daemon_
- Connect to specific daemon only (zebra, bgpd, ospfd, ripd, isisd, etc.).
- -E, --echo
- Echo the command and prompt before displaying results. Useful for scripting.
- -C, --dryrun
- Check the configuration file for syntax validity without applying.
- -n, --noerror
- Ignore errors for purposes of return codes (useful in scripts).
- -u, --user
- Restrict to unprivileged mode, disallowing configuration commands.
- -h, --help
- Display help message.
FAQ
What is the vtysh command used for?
vtysh is an integrated command shell for FRRouting (FRR) and Quagga routing software. It provides a unified Cisco IOS-like CLI for configuring and monitoring all routing daemons (Zebra, BGP, OSPF, RIP, IS-IS, etc.) from a single interface. The shell operates in hierarchical modes: User EXEC mode for basic commands, Privileged EXEC mode (via enable) for administrative commands, and Configuration mode (via configure terminal) for making changes. Each routing protocol has its own configuration sub-mode. vtysh connects to all running routing daemons through their control sockets, presenting their combined functionality. Commands like show ip route, show bgp summary, and show running-config aggregate information from all relevant daemons. Configuration can be saved with write memory to the integrated config file (/etc/frr/frr.conf) or individual daemon configs.
How do I run a basic vtysh example?
Run `sudo vtysh` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -b, --boot do in vtysh?
Execute boot startup configuration from the integrated config file.