|
@@ -6,14 +6,15 @@ breadcrumbs:
|
|
---
|
|
---
|
|
{% include header.md %}
|
|
{% include header.md %}
|
|
|
|
|
|
-## Foreword
|
|
|
|
-
|
|
|
|
-As VyOS is Debian-based, the Linux router notes are also highly related.
|
|
|
|
-
|
|
|
|
## Resources
|
|
## Resources
|
|
|
|
|
|
- [VyOS User Guide](https://docs.vyos.io/)
|
|
- [VyOS User Guide](https://docs.vyos.io/)
|
|
|
|
|
|
|
|
+## Info
|
|
|
|
+
|
|
|
|
+- Debian-based.
|
|
|
|
+- Forked from Vyatta.
|
|
|
|
+
|
|
## Installation
|
|
## Installation
|
|
|
|
|
|
See [Installation (VyOS)](https://docs.vyos.io/en/latest/install.html).
|
|
See [Installation (VyOS)](https://docs.vyos.io/en/latest/install.html).
|
|
@@ -48,19 +49,34 @@ An example of a full configuration. Except intuitive stuff I forgot to mention.
|
|
1. Remove default NTP servers: `delete system ntp <server>` (for each server)
|
|
1. Remove default NTP servers: `delete system ntp <server>` (for each server)
|
|
1. Add new NTP servers: `set system ntp server ntp.justervesenet.no` (example)
|
|
1. Add new NTP servers: `set system ntp server ntp.justervesenet.no` (example)
|
|
1. (Optional) Enable Ctrl+Alt+Del reboot: `set system options ctrl-alt-del-action reboot` (or `ignore`)
|
|
1. (Optional) Enable Ctrl+Alt+Del reboot: `set system options ctrl-alt-del-action reboot` (or `ignore`)
|
|
-1. Replace default user:
|
|
|
|
- 1. Add new user with password: `set system login user <username> authentication plaintext-password "<password>"` (remember quotation marks if it contains spaces)
|
|
|
|
- 1. Commit and log into the new user.
|
|
|
|
- 1. Delete the default user: `delete system login user vyos`
|
|
|
|
1. Set up a plain WAN-facing interface with an IP address (without LAG or VLAN):
|
|
1. Set up a plain WAN-facing interface with an IP address (without LAG or VLAN):
|
|
1. Show all Ethernet interfaces: `run show interfaces ethernet`
|
|
1. Show all Ethernet interfaces: `run show interfaces ethernet`
|
|
1. Enter interface config: `edit interfaces ethernet <if>`
|
|
1. Enter interface config: `edit interfaces ethernet <if>`
|
|
|
|
+ 1. Set the MAC address for the interface to bind to if missing: `set hw-id <mac-addr>`
|
|
1. Set description: `set description <description>`
|
|
1. Set description: `set description <description>`
|
|
1. (Alternative) Set static address (IPv4 + IPv6): `set address <addr>/<prefix-length>`
|
|
1. (Alternative) Set static address (IPv4 + IPv6): `set address <addr>/<prefix-length>`
|
|
1. (Alternative) Set to get IPv4 address from DHCPv4: `set address dhcp`
|
|
1. (Alternative) Set to get IPv4 address from DHCPv4: `set address dhcp`
|
|
1. (Alternative) Set to get IPv6 address from DHCPv6: `set address dhcpv6`
|
|
1. (Alternative) Set to get IPv6 address from DHCPv6: `set address dhcpv6`
|
|
1. (Alternative) Set to get IPv6 address from SLAAC: `set ipv6 address autoconf`
|
|
1. (Alternative) Set to get IPv6 address from SLAAC: `set ipv6 address autoconf`
|
|
1. (Optional) Set firewall policies: `set firewall {local | in | out} <...>`
|
|
1. (Optional) Set firewall policies: `set firewall {local | in | out} <...>`
|
|
|
|
+1. Set default routes: `set protocols static route[6] <0.0.0.0/0|::/0> next-hop <next-hop>` (for IPv4 and IPv6)
|
|
|
|
+1. (Optional) Setup basic SSHD:
|
|
|
|
+ 1. Enable server: `set service ssh`
|
|
|
|
+ 1. (Optional) Commit and log in through SSH instead of the console.
|
|
|
|
+1. Replace default user:
|
|
|
|
+ 1. Note: You may want to skip ahead to the SSHD step so you can paste stuff vis SSH instead of manually writing it into the console.
|
|
|
|
+ 1. Enter new user: `system login user <username>`
|
|
|
|
+ 1. Set password: `set authentication plaintext-password "<password>"`
|
|
|
|
+ - Remember quotation marks if the password string spaces.
|
|
|
|
+ - To generate an `encrypted-password` instead of specifying it as plaintext, run `openssl passwd -6` on a "safe" machine.
|
|
|
|
+ 1. (Optional) Add your personal SSH pubkey:
|
|
|
|
+ 1. Set key type: `set authentication public-keys <name> type ssh-rsa`
|
|
|
|
+ 1. Set key (only the Base64-encoded part): `set authentication public-keys <name> key <key>`
|
|
|
|
+ 1. Commit and log into the new user.
|
|
|
|
+ 1. Delete the default user: `delete system login user vyos`
|
|
|
|
+1. Setup SSHD:
|
|
|
|
+ 1. Enable server: `set service ssh`
|
|
|
|
+ 1. (Optional) Disable password login (pubkeys only): `set service ssh disable-password-authentication`
|
|
1. (Optional) Set up a LAG interface:
|
|
1. (Optional) Set up a LAG interface:
|
|
1. Enter interface config: `edit interfaces bonding bond<n>`
|
|
1. Enter interface config: `edit interfaces bonding bond<n>`
|
|
1. Set member interfaces: `set member interface <if>`
|
|
1. Set member interfaces: `set member interface <if>`
|
|
@@ -71,37 +87,27 @@ An example of a full configuration. Except intuitive stuff I forgot to mention.
|
|
1. Enter the parent/physical interface config.
|
|
1. Enter the parent/physical interface config.
|
|
1. Enter the VLAN subinterface config: `edit vif <VID>`
|
|
1. Enter the VLAN subinterface config: `edit vif <VID>`
|
|
1. Configure as a normal interface.
|
|
1. Configure as a normal interface.
|
|
-1. Set default routes: `set protocols static route[6] <0.0.0.0/0|::/0> next-hop <next-hop>` (for IPv4 and IPv6)
|
|
|
|
1. (Optional) Set black hole route: `set protocols static route[6] <prefix> blackhole` (for IPv4 and IPv6)
|
|
1. (Optional) Set black hole route: `set protocols static route[6] <prefix> blackhole` (for IPv4 and IPv6)
|
|
1. Enable LLDP: `set service lldp interface all`
|
|
1. Enable LLDP: `set service lldp interface all`
|
|
-1. Setup SSHD:
|
|
|
|
- 1. Enable server: `set service ssh`
|
|
|
|
- 1. (Optional) Commit and log in through SSH instead of the console.
|
|
|
|
- 1. (Optional) Add your personal pubkey by entering it:
|
|
|
|
- 1. Enter section: `edit system login user <user> authentication public-keys <some-key-id>`
|
|
|
|
- 1. Set key type: `set type ssh-rsa`
|
|
|
|
- 1. Set key (only the Base64-encoded part): `set key <key>`
|
|
|
|
- 1. (Optional) Add your personal pubkey bu downloading it: `loadkey <username> <URI>`
|
|
|
|
- 1. Disable password login (pubkeys only): `set service ssh disable-password-authentication`
|
|
|
|
1. Enable unicast reverse path forwarding (uRPF) globally: `set firewall source-validation strict`
|
|
1. Enable unicast reverse path forwarding (uRPF) globally: `set firewall source-validation strict`
|
|
-1. Set firewall options:
|
|
|
|
- 1. Enter firewall section.
|
|
|
|
- 1. `set all-ping enable` (default) (still recommended to add ping rules)
|
|
|
|
- 1. `set broadcast-ping disable`
|
|
|
|
- 1. `set receive-redirects disable`
|
|
|
|
- 1. `set ipv6-receive-redirects disable`
|
|
|
|
- 1. `set ip-src-route disable`
|
|
|
|
- 1. `set ipv6-src-route disable`
|
|
|
|
- 1. `set log-martians disable`
|
|
|
|
- 1. `set send-redirects disable`
|
|
|
|
-1. Setup firewall:
|
|
|
|
|
|
+1. Set firewall:
|
|
|
|
+ 1. Enter `firewall` section.
|
|
|
|
+ 1. Set options:
|
|
|
|
+ 1. `set all-ping enable` (default) (still recommended to add ping rules)
|
|
|
|
+ 1. `set broadcast-ping disable`
|
|
|
|
+ 1. `set receive-redirects disable`
|
|
|
|
+ 1. `set ipv6-receive-redirects disable`
|
|
|
|
+ 1. `set ip-src-route disable`
|
|
|
|
+ 1. `set ipv6-src-route disable`
|
|
|
|
+ 1. `set log-martians disable`
|
|
|
|
+ 1. `set send-redirects disable`
|
|
1. Set default policies:
|
|
1. Set default policies:
|
|
- `set firewall state-policy established action accept`
|
|
- `set firewall state-policy established action accept`
|
|
- `set firewall state-policy related action accept`
|
|
- `set firewall state-policy related action accept`
|
|
- `set firewall state-policy invalid action drop`
|
|
- `set firewall state-policy invalid action drop`
|
|
1. 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.
|
|
1. 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.
|
|
1. Attach rule sets to interfaces (typically "local" and "out").
|
|
1. Attach rule sets to interfaces (typically "local" and "out").
|
|
-1. Tuning:
|
|
|
|
|
|
+1. (Optional) Tuning (bare metal):
|
|
- **TODO** This can be done in the interface ethernet configs instead.
|
|
- **TODO** This can be done in the interface ethernet configs instead.
|
|
- See the Linux router notes.
|
|
- See the Linux router notes.
|
|
- Enable GRO (example): `ethtool -K <if> gro on`
|
|
- Enable GRO (example): `ethtool -K <if> gro on`
|