diff options
| author | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-06 14:40:28 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-06 12:40:28 +0100 |
| commit | 4b36114e053ee11d0cb264a1e4cfe4692d78f194 (patch) | |
| tree | be4ecc665eb3f1d556a37e768eed14989fec57b6 /docs/md-quick-start.md | |
| parent | 21a554bd4f9156e41f1c73ba6b7223bb63b3a4ef (diff) | |
| download | vyos-documentation-4b36114e053ee11d0cb264a1e4cfe4692d78f194.tar.gz vyos-documentation-4b36114e053ee11d0cb264a1e4cfe4692d78f194.zip | |
Add incremental RST-to-MyST swap mechanism (#1857)
* feat: add swap_sources.py for incremental RST-to-MyST migration
Pre-build swap/restore script that renames md-{name}.md β {name}.md
before Sphinx builds and restores after. Includes state tracking,
exclude file generation, collision detection, and partial-failure
rollback. 10 tests cover all specified behaviors plus rollback path.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: add import_myst.py for importing MyST files from myst/* branches
Adds scripts/import_myst.py with import_page, git_show, list_myst_files,
list_rst_files, and do_import. Imported files are written as md-{name}.md
alongside existing RST files; importing is decoupled from swap activation.
Adds tests/test_import_myst.py covering single-page write, identical-skip,
warn-on-different-without-force, force-overwrite, and nested-path creation.
All 5 tests pass on Python 3.9.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: add MyST swap exclude patterns and directive config to conf.py
π€ Generated by [robots](https://vyos.io)
* feat: add swap-wrapped rendering targets to Makefile
π€ Generated by [robots](https://vyos.io)
* feat: add swap pre/post build hooks for ReadTheDocs
π€ Generated by [robots](https://vyos.io)
* feat: add empty _swap.txt, remove atexit from swap script
The atexit handler in --swap mode caused immediate restore on process
exit, breaking standalone usage. Makefile trap and RTD post_build
handle restore reliably.
π€ Generated by [robots](https://vyos.io)
* feat: activate quick-start as MyST canary via swap mechanism
Imports docs/md-quick-start.md from origin/myst/current and adds
quick-start to docs/_swap.txt. Validates the swap pipeline end-to-end
on one page: import_myst pulls the MD via git show, swap_sources
renames md-quick-start.md to quick-start.md, sphinx-build renders
quick-start.html with zero MD-specific warnings, and restore reverses
the rename cleanly.
π€ Generated by [robots](https://vyos.io)
* feat: activate 106 visual-validated canaries via swap
Imports 105 MD files (plus quick-start already present) from
origin/myst/current and adds them to docs/_swap.txt. The selection
is the BackstopJS visual-passers cohort: pages with <5% rendered
diff vs the live RST docs at docs.vyos.io/en/latest/, filtered to
those with an RST counterpart on current and no cmdincludemd usage
(template-format reconciliation pending).
Local sphinx-build with all 106 swapped: succeeded with 100
warnings (vs 95 baseline). The 5 new warnings are all undefined
cross-reference labels, not build failures:
- contributing/development.md (missing 'coding-guidelines')
- operation/upgrade-recovery.md (3 missing 'how_it_works' /
'cancelling_recovery')
- vpp/configuration/dataplane/{buffers,memory,unix}.md (missing
'vpp_config_dataplane_*' labels)
Source list: ~/.claude/projects/-Users-vybot-GitHub-vyos-documentation/docs/2026-04-29-myst-conversion-audit/visual-passers-under-5pct.txt
BackstopJS report: claude/gifted-hertz-74b9f9 worktree
(visual-compare/), 2026-04-23 vs vyos--1838.org.readthedocs.build.
π€ Generated by [robots](https://vyos.io)
* fix: re-import 4 canary md-*.md files with xref label fixes
Re-imports the dash-form-corrected versions of:
- contributing/md-development.md (added (coding-guidelines)= anchor)
- operation/md-upgrade-recovery.md (3 ref renames: how_it_works /
cancelling_recovery -> dash form)
- vpp/configuration/dataplane/md-buffers.md (vpp_config_dataplane_physmem
-> vpp-config-dataplane-physmem)
- vpp/configuration/dataplane/md-unix.md
(vpp_config_dataplane_interface_rx_mode
-> vpp-config-dataplane-interface-rx-mode)
Source: origin/myst/current commit 59fbe3ea. Verified locally: clean
swap-build no longer reports any of the 5 target labels (1 of 6 β
vpp-config-hugepages β remains because system.md isn't in the canary
swap list; that anchor lives there).
π€ Generated by [robots](https://vyos.io)
* fix: re-add 4 canary md-*.md files deleted by 242b334a
Commit 242b334a accidentally staged deletions instead of modifications
because the working tree had unprefixed *.md files left over from an
incomplete swap-restore cycle. Re-imports the same 4 files from
origin/myst/current with the xref label fixes applied:
- contributing/md-development.md β (coding-guidelines)= anchor
- operation/md-upgrade-recovery.md β how_it_works β how-it-works,
cancelling_recovery β cancelling-recovery
- vpp/configuration/dataplane/md-buffers.md β vpp_config_dataplane_physmem
β vpp-config-dataplane-physmem
- vpp/configuration/dataplane/md-unix.md β vpp_config_dataplane_interface_rx_mode
β vpp-config-dataplane-interface-rx-mode
Source: origin/myst/current commit 59fbe3ea.
π€ Generated by [robots](https://vyos.io)
* fix: resolve remaining xref label gaps in swap-active build
Three small additions clear the cross-reference warnings tied to
underscore-vs-dash label form mismatches and the vpp-config-hugepages
reference that previously needed system.md in the canary set.
- system.rst: add .. _vpp-config-hugepages: alongside the existing
underscore label so memory.md references resolve regardless of
whether system.md is swap-active.
- md-lcp.md: add (vpp_config_dataplane_lcp_ignore-kernel-routes)=
alongside dash form (carries upstream from myst/current 079fa786).
- md-memory.md: add (vpp_config_dataplane_memory)= alongside dash
form (also from myst/current 079fa786).
Local clean swap-build with 106 canaries:
before: 305 warnings, 8 undefined-label entries in our scope
after: 300 warnings, 0 undefined-label entries in our scope
Remaining undefined-label warnings (release-notes, prepare_commit)
are in documentation.rst and unrelated to the canary swap mechanism.
π€ Generated by [robots](https://vyos.io)
* fix: re-add md-lcp.md and md-memory.md (deleted by 870c9e7e)
Same disaster pattern as 242b334a: a swap-restore cycle left
unprefixed *.md files in the working tree, and the subsequent
git add staged deletions instead of modifications. Restoring the
two affected md-*.md files from origin/myst/current 079fa786
(which has the dual underscore+dash anchors needed for the
swap-active build).
π€ Generated by [robots](https://vyos.io)
* feat: expand canaries to 114; refresh 3 with cfgcmd body fix
Adds 8 new visual-validated canaries from the post-cfgcmd-fix
BackstopJS run (2026-04-29):
- configuration/policy/as-path-list
- configuration/policy/community-list
- configuration/policy/extcommunity-list
- configuration/policy/large-community-list
- configuration/policy/local-route
- configuration/policy/prefix-list
- configuration/service/salt-minion
- configuration/system/updates
Refreshes 3 existing canaries whose MD content changed via the
cfgcmd/opcmd single-line body fix on myst/current fc19ab5c:
- configuration/firewall/global-options
- configuration/firewall/groups
- configuration/policy/route
All 11 sourced from origin/myst/current. Net: 106 -> 114 canaries.
π€ Generated by [robots](https://vyos.io)
* fix: re-import md-cloud-init.md (block 3 fix from myst/current)
π€ Generated by [robots](https://vyos.io)
* feat(swap): import .md files and webp transition from myst/current
Selective import from origin/myst/current (cf9c9b34):
- Add/update 255 .md files (full MyST conversion plus webp ref updates)
- Delete 175 PNG/JPG from docs/_static/images (webp twins already present)
- Delete 5 autotest topology.png (webp twins already present)
Preserved on swap (untouched):
- All .rst files (incremental swap pattern)
- conf.py, _ext/, _include/*.txt, .gitignore
- 115 canary md-*.md files
- 7 superpowers/specs/*.md design docs
- Logos vyos-logo.png / vyos-logo-icon.png (referenced by conf.py)
π€ Generated by [robots](https://vyos.io)
* chore(swap): remove canary md-*.md files and docs/superpowers
- Remove 115 canary md-*.md files (incremental swap helpers no longer needed)
- Remove 8 files under docs/superpowers (project planning/design docs that
shouldn't ship in the documentation tree)
π€ Generated by [robots](https://vyos.io)
* docs: address Copilot review feedback on imported MyST pages
Fix issues flagged by Copilot review on PR #1857 (the same content lives
in myst/current as the canonical source):
Real bugs:
- site-2-site-cisco.md: replace curly quote (U+2019) with ASCII apostrophe
- rsa-keys.md: fix typo "key-pair nam>>" β "key-pair name>"
- vmware.md: lowercase admonition directive (:::{NOTE} β :::{note})
- vpp/configuration/nat/index.md: remove blank line inside {include} fence
Grammar:
- vpp/configuration/interfaces/loopback.md: "bounded" β "bound"
- vpp/configuration/sflow.md: "VyOS support" β "VyOS supports"
- vpp/requirements.md: "bypass" β "bypasses"
- vpp/configuration/dataplane/interface.md: "configures" β "configure"
CI linter (IP addresses):
- nmp.md: wrap 8.8.8.8 example with stop/start_vyoslinter
- lac-lns.md: wrap LNS config block (contains 8.8.8.8)
- wan-load-balancing.md: wrap whole file (illustrative non-RFC IPs)
- policy/examples.md: replace 192.0.1.1 with RFC 5737 192.0.2.1
π€ Generated by [robots](https://vyos.io)
* fix(swap): address Copilot review feedback on swap infrastructure
Category D β drop obsolete canary mechanism settings:
- conf.py: remove '**/md-*.md' from exclude_patterns (no canaries left)
- Makefile: replace malformed '*/_build/*' with '$(BUILDDIR)/**' and drop
the '*/md-*' ignore (canary files no longer exist)
Category C β script robustness:
- import_myst.py:
* list_myst_files() now raises SystemExit on git ls-tree failure instead
of silently returning [] (would have masked typo'd --source refs)
* list_rst_files() skips _build/ when scanning for .rst stems
* import_page() rejects stems containing '..' or absolute paths and
re-checks that the resolved destination stays under docs_dir
* --dry-run uses a separate "would_import" counter; summary line now
distinguishes dry-run from actual imports
- swap_sources.py:
* parse_swap_list() reads with explicit encoding='utf-8'
* do_restore() validates state file version + entry shape before
renaming files; raises with actionable message on corruption
* State file reads/writes use explicit encoding='utf-8' throughout
_swap.txt:
- Wrap long comment line to satisfy 80-character doc-linter limit
π€ Generated by [robots](https://vyos.io)
* refactor(swap): rename imported .md files to md- prefix for swap mechanism
Restore the canary file naming convention that swap_sources.py expects:
the imported MyST pages now live as docs/<dir>/md-<name>.md alongside
the existing docs/<dir>/<name>.rst, so swap_sources.py --swap can rename
them into place at build time.
- 254 .md files renamed (every page with a matching .rst counterpart)
- 2 MyST-only pages left at their final names (no .rst exists, no swap
needed): docs/copyright.md, docs/automation/terraform/terraformvyos.md
All 114 stems listed in docs/_swap.txt now have a corresponding
md-<name>.md source file ready to swap in.
π€ Generated by [robots](https://vyos.io)
* docs: address CodeRabbit review feedback on imported MyST pages
Fix issues flagged by CodeRabbit on PR #1857. All issues are pre-existing
in the upstream RST docs and inherited by the MyST conversion.
Real bugs:
- inter-vrf-routing-vrf-lite.md: invalid IPv6 next-hop "2001:db8::*" β
"2001:db8::1"
- ipsec-pa-route-based.md: vendor mislabel "Cisco" β "Palo Alto"
(header on line 39 and "Monitoring on Cisco side" section heading)
- bgp-ipv6-unnumbered.md: AS number mismatch between configuration and
verification output for both routers (Router A: 65020 β 64496;
Router B: 65021 β 64499)
- qos.md: class 30 used "match ADDRESS20" instead of ADDRESS30 β broke
the documented pattern (classes 10/20/30 β ADDRESS10/20/30)
Security:
- OpenVPN_with_LDAP.md: redact full PEM private key material from the
three "set pki ... private key '...'" lines and from the embedded
OpenVPN client <key> block; replace with <REDACTED> / ...REDACTED...
placeholders. Public certificates retained.
π€ Generated by [robots](https://vyos.io)
* feat(swap): default to serving MyST for all swapped pages
Replace the previously-curated 114-stem _swap.txt with the full set of
254 imported md-prefixed pages, so MD is served by default at build
time. To revert any specific page back to RST, remove its stem from
_swap.txt (or comment it out).
π€ Generated by [robots](https://vyos.io)
* fix(ext): handle RST fallback in CmdInclude when _renderer absent
`cmdincludemd` is in `myst_fence_as_directive`, so MyST routes
fence blocks through `render_fence β render_restructuredtext β
MockRSTParser`. In that path `self.state` is a plain docutils Body
with no `_renderer`, crashing the build.
Fall back to `nested_parse` when `_renderer` is unavailable so the
directive works in both MyST and RST/MockRSTParser contexts.
π€ Generated by [robots](https://vyos.io)
* feat(conf): copy .md sources into HTML output for plain-text serving
Adds a build-finished hook that mirrors every .md file from the Sphinx
source tree into the HTML output directory verbatim, making unrendered
MyST sources accessible alongside HTML renders at the same URL path.
π€ Generated by [robots](https://vyos.io)
* docs: address review feedback from PR #1857
Fix conversion artifacts, typos, grammar errors, and technical
inaccuracies flagged by automated code review (Copilot + CodeRabbit).
Infrastructure: add root-level md-*.md exclusion to conf.py,
fix sphinx-autobuild ignore globs in Makefile.
Content: fix curly quotes, invalid Go panic() calls, shell quoting
in cURL examples, incorrect firewall command paths, typos across
22 documentation files, remove duplicate sections.
π€ Generated by [robots](https://vyos.io)
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'docs/md-quick-start.md')
| -rw-r--r-- | docs/md-quick-start.md | 381 |
1 files changed, 381 insertions, 0 deletions
diff --git a/docs/md-quick-start.md b/docs/md-quick-start.md new file mode 100644 index 00000000..9d1a6eee --- /dev/null +++ b/docs/md-quick-start.md @@ -0,0 +1,381 @@ +(quick-start)= + +# Quick Start + +This chapter will guide you on how to get up to speed quickly using your new +VyOS system. It will show you a very basic configuration example that will +provide a {ref}`nat` gateway for a device with two network interfaces +(`eth0` and `eth1`). + +(quick-start-configuration-mode)= + +## Configuration Mode + +By default, VyOS is in operational mode, and the command prompt displays +a `$`. To configure VyOS, you will need to enter configuration mode, resulting +in the command prompt displaying a `#`, as demonstrated below: + +```none +vyos@vyos$ configure +vyos@vyos# +``` + + +## Commit and Save + +After every configuration change, you need to apply the changes by using the +following command: + +```none +commit +``` + +Once your configuration works as expected, you can save it permanently by using +the following command: + +```none +save +``` + + +## Interface Configuration + +- Your outside/WAN interface will be `eth0`. It will receive its interface + address via DHCP. +- Your internal/LAN interface will be `eth1`. It will use a static IP address + of `192.168.0.1/24`. + +After switching to {ref}`quick-start-configuration-mode` issue the following +commands: + +```none +set interfaces ethernet eth0 address dhcp +set interfaces ethernet eth0 description 'OUTSIDE' +set interfaces ethernet eth1 address '192.168.0.1/24' +set interfaces ethernet eth1 description 'LAN' +``` + + +## SSH Management + +After switching to {ref}`quick-start-configuration-mode` issue the following +commands, and your system will listen on every interface for incoming SSH +connections. You might want to check the {ref}`ssh` chapter on how to listen +on specific addresses only. + +```none +set service ssh port '22' +``` + +(dhcp-dns-quick-start)= + +## DHCP/DNS quick-start + +The following settings will configure DHCP and DNS services on +your internal/LAN network, where VyOS will act as the default gateway and +DNS server. + +- The default gateway and DNS recursor address will be `192.168.0.1/24` +- The address range `192.168.0.2/24 - 192.168.0.8/24` will be reserved for + static assignments +- DHCP clients will be assigned IP addresses within the range of + `192.168.0.9 - 192.168.0.254` and have a domain name of `internal-network` +- DHCP leases will hold for one day (86400 seconds) +- VyOS will serve as a full DNS recursor, replacing the need to utilize Google, + Cloudflare, or other public DNS servers (which is good for privacy) +- Only hosts from your internal/LAN network can use the DNS recursor + +```none +set service dhcp-server shared-network-name LAN subnet 192.168.0.0/24 option default-router '192.168.0.1' +set service dhcp-server shared-network-name LAN subnet 192.168.0.0/24 option name-server '192.168.0.1' +set service dhcp-server shared-network-name LAN subnet 192.168.0.0/24 option domain-name 'vyos.net' +set service dhcp-server shared-network-name LAN subnet 192.168.0.0/24 lease '86400' +set service dhcp-server shared-network-name LAN subnet 192.168.0.0/24 range 0 start '192.168.0.9' +set service dhcp-server shared-network-name LAN subnet 192.168.0.0/24 range 0 stop '192.168.0.254' +set service dhcp-server shared-network-name LAN subnet 192.168.0.0/24 subnet-id '1' + +set service dns forwarding cache-size '0' +set service dns forwarding listen-address '192.168.0.1' +set service dns forwarding allow-from '192.168.0.0/24' +``` + + +## NAT + +The following settings will configure {ref}`source-nat` rules for our +internal/LAN network, allowing hosts to communicate through the outside/WAN +network via IP masquerade. + +```none +set nat source rule 100 outbound-interface name 'eth0' +set nat source rule 100 source address '192.168.0.0/24' +set nat source rule 100 translation address masquerade +``` + + +## Firewall + +A new firewall structureβwhich uses the `nftables` backend, rather +than `iptables`βis available on all installations starting from +VyOS `1.4-rolling-202308040557`. The firewall supports creation of distinct, +interlinked chains for each [Netfilter hook](<https://wiki.nftables.org/wiki-nftables/index.php/Netfilter_hooks>) +and allows for more granular control over the packet filtering process. + +The firewall begins with the base `filter` tables you define for each of the +`forward`, `input`, and `output` Netfiter hooks. Each of these tables is +populated with rules that are processed in order and can jump to other chains +for more granular filtering. + +### Configure Firewall Groups + +To make firewall configuration easier, we can create groups of interfaces, +networks, addresses, ports, and domains that describe different parts of +our network. We can then use them for filtering within our firewall rulesets, +allowing for more concise and readable configuration. + +In this case, we will create two interface groups β a `WAN` group for our +interfaces connected to the public internet and a `LAN` group for the +interfaces connected to our internal network. Additionally, we will create a +network group, `NET-INSIDE-v4`, that contains our internal subnet. + +```none +set firewall group interface-group WAN interface eth0 +set firewall group interface-group LAN interface eth1 +set firewall group network-group NET-INSIDE-v4 network '192.168.0.0/24' +``` + + +### Configure Stateful Packet Filtering + +With the new firewall structure, we have have a lot of flexibility in how we +group and order our rules, as shown by the three alternative approaches below. + +#### Option 1: Global State Policies + +Using options defined in `set firewall global-options state-policy`, state +policy rules that applies for both IPv4 and IPv6 are created. These global +state policies also applies for all traffic that passes through the router +(transit) and for traffic originated/destinated to/from the router itself, and +will be evaluated before any other rule defined in the firewall. + +Most installations would choose this option, and will contain: + +```none +set firewall global-options state-policy established action accept +set firewall global-options state-policy related action accept +set firewall global-options state-policy invalid action drop +``` + + +#### Option 2: Common/Custom Chain + +We can create a common chain for stateful connection filtering of multiple +interfaces (or multiple netfilter hooks on one interface). Those individual +chains can then jump to the common chain for stateful connection filtering, +returning to the original chain for further rule processing if no action is +taken on the packet. + +The chain we will create is called `CONN_FILTER` and has three rules: + +- A default action of `return`, which returns the packet back to the original + chain if no action is taken. +- A rule to `accept` packets from established and related connections. +- A rule to `drop` packets from invalid connections. + +```none +set firewall ipv4 name CONN_FILTER default-action 'return' + +set firewall ipv4 name CONN_FILTER rule 10 action 'accept' +set firewall ipv4 name CONN_FILTER rule 10 state established +set firewall ipv4 name CONN_FILTER rule 10 state related + +set firewall ipv4 name CONN_FILTER rule 20 action 'drop' +set firewall ipv4 name CONN_FILTER rule 20 state invalid +``` + +Then, we can jump to the common chain from both the `forward` and `input` +hooks as the first filtering rule in the respective chains: + +```none +set firewall ipv4 forward filter rule 10 action 'jump' +set firewall ipv4 forward filter rule 10 jump-target CONN_FILTER + +set firewall ipv4 input filter rule 10 action 'jump' +set firewall ipv4 input filter rule 10 jump-target CONN_FILTER +``` + + +#### Option 3: Per-Hook Chain + +Alternatively, you can take the more traditional stateful connection +filtering approach by creating rules on each base hook's chain: + +```none +set firewall ipv4 forward filter rule 5 action 'accept' +set firewall ipv4 forward filter rule 5 state established +set firewall ipv4 forward filter rule 5 state related +set firewall ipv4 forward filter rule 10 action 'drop' +set firewall ipv4 forward filter rule 10 state invalid + +set firewall ipv4 input filter rule 5 action 'accept' +set firewall ipv4 input filter rule 5 state established +set firewall ipv4 input filter rule 5 state related +set firewall ipv4 input filter rule 10 action 'drop' +set firewall ipv4 input filter rule 10 state invalid +``` + + +### Block Incoming Traffic + +Now that we have configured stateful connection filtering to allow traffic from +established and related connections, we can block all other incoming traffic +addressed to our local network. + +Create a new chain (`OUTSIDE-IN`) which will drop all traffic that is not +explicitly allowed at some point in the chain. Then, we can jump to that chain +from the `forward` hook when traffic is coming from the `WAN` interface +group and is addressed to our local network. + +```none +set firewall ipv4 name OUTSIDE-IN default-action 'drop' + +set firewall ipv4 forward filter rule 100 action jump +set firewall ipv4 forward filter rule 100 jump-target OUTSIDE-IN +set firewall ipv4 forward filter rule 100 inbound-interface group WAN +set firewall ipv4 forward filter rule 100 destination group network-group NET-INSIDE-v4 +``` + +We should also block all traffic destinated to the router itself that isn't +explicitly allowed at some point in the chain for the `input` hook. As +we've already configured stateful packet filtering above, we only need to +set the default action to `drop`: + +```none +set firewall ipv4 input filter default-action 'drop' +``` + + +### Allow Management Access + +We can now configure access to the router itself, allowing SSH +access from the inside/LAN network and rate limiting SSH access from the +outside/WAN network. + +First, create a new dedicated chain (`VyOS_MANAGEMENT`) for management +access, which returns to the parent chain if no action is taken. Add a rule +to accept traffic from the `LAN` interface group: + +```none +set firewall ipv4 name VyOS_MANAGEMENT default-action 'return' +``` + +Configure a rule on the `input` hook filter to jump to the `VyOS_MANAGEMENT` +chain when new connections are addressed to port 22 (SSH) on the router itself: + +```none +set firewall ipv4 input filter rule 20 action jump +set firewall ipv4 input filter rule 20 jump-target VyOS_MANAGEMENT +set firewall ipv4 input filter rule 20 destination port 22 +set firewall ipv4 input filter rule 20 protocol tcp +``` + +Finally, configure the `VyOS_MANAGEMENT` chain to accept connection from the +`LAN` interface group while limiting requests coming from the `WAN` +interface group to 4 per minute: + +```none +set firewall ipv4 name VyOS_MANAGEMENT rule 15 action 'accept' +set firewall ipv4 name VyOS_MANAGEMENT rule 15 inbound-interface group 'LAN' + +set firewall ipv4 name VyOS_MANAGEMENT rule 20 action 'drop' +set firewall ipv4 name VyOS_MANAGEMENT rule 20 recent count 4 +set firewall ipv4 name VyOS_MANAGEMENT rule 20 recent time minute +set firewall ipv4 name VyOS_MANAGEMENT rule 20 state new +set firewall ipv4 name VyOS_MANAGEMENT rule 20 inbound-interface group 'WAN' + +set firewall ipv4 name VyOS_MANAGEMENT rule 21 action 'accept' +set firewall ipv4 name VyOS_MANAGEMENT rule 21 state new +set firewall ipv4 name VyOS_MANAGEMENT rule 21 inbound-interface group 'WAN' +``` + + +### Allow Access to Services + +Here we're allowing the router to respond to pings. Then, we can allow access to +the DNS recursor we configured earlier, accepting traffic bound for port 53 from +all hosts on the `NET-INSIDE-v4` network: + +```none +set firewall ipv4 input filter rule 30 action 'accept' +set firewall ipv4 input filter rule 30 icmp type-name 'echo-request' +set firewall ipv4 input filter rule 30 protocol 'icmp' +set firewall ipv4 input filter rule 30 state new + +set firewall ipv4 input filter rule 40 action 'accept' +set firewall ipv4 input filter rule 40 destination port '53' +set firewall ipv4 input filter rule 40 protocol 'tcp_udp' +set firewall ipv4 input filter rule 40 source group network-group NET-INSIDE-v4 +``` + +Finally, we can now configure access to the services running on this router, +allowing all connections coming from localhost: + +```none +set firewall ipv4 input filter rule 50 action 'accept' +set firewall ipv4 input filter rule 50 source address 127.0.0.0/8 +``` + +Commit changes, save the configuration, and exit configuration mode: + +```none +vyos@vyos# commit +vyos@vyos# save +Saving configuration to '/config/config.boot'... +Done +vyos@vyos# exit +vyos@vyos$ +``` + + +## Hardening + +Especially if you are allowing SSH remote access from the outside/WAN +interface, there are a few additional configuration steps that should be taken. + +Replace the default `vyos` system user: + +```none +set system login user myvyosuser authentication plaintext-password mysecurepassword +``` + +Set up {ref}`ssh_key_based_authentication`: + +```none +set system login user myvyosuser authentication public-keys myusername@mydesktop type ssh-rsa +set system login user myvyosuser authentication public-keys myusername@mydesktop key contents_of_id_rsa.pub +``` + +Finally, try and SSH into the VyOS install as your new user. Once you have +confirmed that your new user can access your router without a password, delete +the original `vyos` user and completely disable password authentication for +{ref}`ssh`: + +```none +delete system login user vyos +set service ssh disable-password-authentication +``` + +As above, commit your changes, save the configuration, and exit +configuration mode: + +```none +vyos@vyos# commit +vyos@vyos# save +Saving configuration to '/config/config.boot'... +Done +vyos@vyos# exit +vyos@vyos$ +``` + +You now should have a simple yet secure and functioning router to experiment +with further. Enjoy! |
