title: VyOS
breadcrumbs:
- title: Configuration
- title: Network
---
{% include header.md %}
Foreword
As VyOS is Debian-based, the Linux router notes are also highly related.
Resources
Installation
See Installation (VyOS).
- (Recommended) Disable Intel Hyper-Threading.
- Download the latest rolling release (free) or LTS release (paid) ISO.
- Burn and boot from it (it's a live image).
- Log in using user
vyos
and password vyos
.
- Run
install image
to run the permanent installation wizard.
- Keep the suggested image name to keep track of versions.
- If asked about which config to copy, any one is fine.
- Remove the live image and reboot.
Initial Configuration
An example of a full configuration. Except intuitive stuff I forgot to mention.
- Log in as user
vyos
and password as set in the installation (or vyos
if using the live media).
- It'll drop you directly into operational mode.
- Fix the keyboard layout:
- Run config TUI:
set console keymap
- FIXME: This doesn't seem to work. Relogging or restarting doesn't help either.
- Enter configuration mode:
configure
- This changes the prompt from
$
to #
.
- Set hostname:
- Note:
<host-name>.<domain-name>
should be an FQDN.
- Hostname:
set system host-name <hostname>
- Domain name:
set system domain-name <domain-name>
- Set the DNS servers:
set system name-server <ip-address>
(for each server)
- Set the time zone:
set system time-zone Europe/Oslo
(Norway)
- (Optional) Replace the NTP servers:
- Remove default NTP servers:
delete system ntp <server>
(for each server)
- Add new NTP servers:
set system ntp server ntp.justervesenet.no
(example)
- (Optional) Enable Ctrl+Alt+Del reboot:
set system options ctrl-alt-del-action reboot
(or ignore
)
- Replace default user:
- Add new user with password:
set system login user <username> authentication plaintext-password "<password>"
(remember quotation marks if it contains spaces)
- Commit and log into the new user.
- Delete the default user:
delete system login user vyos
- Set up a plain WAN-facing interface with an IP address (without LAG or VLAN):
- Show all Ethernet interfaces:
run show interfaces ethernet
- Enter interface config:
edit interfaces ethernet <if>
- Set description:
set description <description>
- (Alternative) Set static address (IPv4 + IPv6):
set address <addr>/<prefix-length>
- (Alternative) Set to get IPv4 address from DHCPv4:
set address dhcp
- (Alternative) Set to get IPv6 address from DHCPv6:
set address dhcpv6
- (Alternative) Set to get IPv6 address from SLAAC:
set ipv6 address autoconf
- (Optional) Set firewall policies:
set firewall {local | in | out} <...>
- (Optional) Set up a LAG interface:
- Enter interface config:
edit interfaces bonding bond<n>
- Set member interfaces:
set member interface <if>
- Enable LACP:
set mode 802.3ad
- Set hashing policy:
set hash-policy layer2+3
- Configure as a normal interface.
- (Optional) Set up a VLAN interface:
- Enter the parent/physical interface config.
- Enter the VLAN subinterface config:
edit vif <VID>
- Configure as a normal interface.
- Set default routes:
set protocols static route[6] <0.0.0.0/0|::/0> next-hop <next-hop>
(for IPv4 and IPv6)
- (Optional) Set black hole route:
set protocols static route[6] <prefix> blackhole
(for IPv4 and IPv6)
- Enable LLDP:
set service lldp interface all
- Setup SSHD:
- Enable server:
set service ssh
- (Optional) Commit and log in through SSH instead of the console.
- (Optional) Add your personal pubkey by entering it:
- Enter section:
edit system login user <user> authentication public-keys <some-key-id>
- Set key type:
set type ssh-rsa
- Set key (only the Base64-encoded part):
set key <key>
- (Optional) Add your personal pubkey bu downloading it:
loadkey <username> <URI>
- Disable password login (pubkeys only):
set service ssh disable-password-authentication
- Enable unicast reverse path forwarding (uRPF) globally:
set firewall source-validation strict
- Set firewall options:
- Enter firewall section.
set all-ping enable
set broadcast-ping disable
set receive-redirects disable
set ipv6-receive-redirects disable
set ip-src-route disable
set ipv6-src-route disable
set log-martians disable
set send-redirects disable
- Setup firewall:
- Set default policies:
set firewall state-policy established action accept
set firewall state-policy related action accept
set firewall state-policy invalid action drop
- Create IPv4 and IPv6 rule sets. Note that IPv4 and IPv6 rule sets can't share names, so you can suffix the names with
-4
and -6
to avoid conflict.
- Attach rule sets to interfaces (typically "local" and "out").
- Tuning:
- TODO This can be done in the interface ethernet configs instead.
- See the Linux router notes.
- Enable GRO (example):
ethtool -K <if> gro on
- Increase RX/TX buffer sizes (example):
ethtool -G <if> tx 4096 rx 4096
- Enable scatter/gather aka vectored I/O (example):
ethtool -K <if> sg on
- Make any ethtool (e.g.) commands permanent by adding them to
/config/scripts/vyos-postconfig-bootup.script
.
- Commit and save:
commit
and save
.
General Configuration
CLI
- The system is in "operational mode" (
$
) after logging in. Enter "configuration mode" (#
) using the configure
command.
- Use
?
to show alternatives and tab to auto-complete.
- Use
run
to run operational mode commands in configuration mode.
Basics
- System information:
- Show log:
show log [tail]
- Interface and routing information:
- L2/L3 interfaces overview:
show interfaces
- Routes:
show ip routes
and show ipv6 routes
- Configuration changes:
- Show configuration:
show
- Running this in conf mode shows any changes.
- Run this in op mode if you intend to copy it from the terminal, to avoid the change indentation.
- Apply changes:
commit
- Apply changes with confirmation:
commit-confirm [comment <comment>] [minutes]
- Run
confirm
within N minutes when you've verified that the changes are working as intended.
- Not confirming in time will cause the system to reboot.
- Save changes:
save
Tasks
Reset Admin Password
Reboot the device and wait for the boot screen. In the boot screen, select the "lost password change (KVM)" option. It will boot to into a prompt asking you to set a new password. After setting a new password, the device will automatically reboot.
Random Notes
- The DHCPv4 relay requires the interface towards the upstream DHCP server to be included in the relay interfaces. Otherwise the responses from the upstream server will be dropped. The relay is also very bugged at the moment so I'd recommend not using it until it gets fixed. See T377 and T1276.
{% include footer.md %}