Skip to content

Configuration File Guide

Landscape reads configuration from these files:

  • landscape_init.toml: a complete export containing all rule definitions and the settings from landscape.toml. Landscape reads it only during initialization, before landscape_init.lock exists. See the landscape_init.toml Reference for every available field.
  • landscape.toml: process settings read on every startup, including listen addresses, administrator credentials, and logging.

Landscape can start without either file. Use landscape_init.toml to provide a complete configuration on the first startup.

Configuration priority

The same setting can come from several places. From highest priority to lowest:

  1. Command-line arguments — e.g. --port 6300
  2. Environment variables — e.g. LANDSCAPE_WEB_HTTP_PORT=6300
  3. landscape.toml
  4. Built-in defaults — i.e. the "Default" column in the tables below

WARNING

  • Deleting landscape_init.lock makes the next startup replace the current configuration with landscape_init.toml. Verify the init file before deleting the lock.
  • Configuration paths may be absolute or relative. Paths beginning with ~ are not supported.
  • An init file can only be restored by the same Landscape version that created it. For a cross-version restore, restore with the original version first, then start the target version so its database migrations can run. Versioned exports are available in v0.6.7 and later.

Below, <HOME> refers to the configuration directory, /root/.landscape-router by default, changeable with -c / LANDSCAPE_CONF_PATH.

Full landscape.toml reference

Every section and field may be omitted; omitted ones take the value in the "Default" column.

[auth] management credentials

FieldTypeDefaultDescription
admin_userstring"root"Login user
admin_passstring"root"Login password

Change the default credentials

Change both values before exposing the management interface to an untrusted network.

[web] management interface

FieldTypeDefaultDescription
web_rootpath<HOME>/staticFrontend static file directory
portu166300HTTP listen port
https_portu166443HTTPS listen port
addressip"::"Listen address. Use 0.0.0.0 for IPv4 only

[log] logging

FieldTypeDefaultDescription
log_pathpath<HOME>/logsLog directory
debugboolfalseDebug mode. Defaults to true in debug builds
log_output_in_terminalboolfalseAlso log to the terminal. true in debug builds
max_log_filesusize7Maximum number of log files kept

[store] database

FieldTypeDefaultDescription
database_pathstringsqlite://<HOME>/landscape_db.sqlite?mode=rwcDatabase connection string

WARNING

The environment variable for database_path is DATABASE_URL. If it is already set in the shell, a repository .env file, or CI, it overrides the directory supplied with -c. Check this variable when configuration changes appear to be written to an unexpected database.

[metric] metrics collection

Metrics land in <HOME>/metric/. This section can also be edited from the frontend.

FieldTypeDefaultDescription
modeenum"duckdb"off disabled / memory in-memory only / duckdb on disk
connect_second_window_minutesu645Retention window for per-second connection data (minutes)
connect_1m_retention_daysu641Retention for 1-minute granularity connection data (days)
connect_1h_retention_daysu647Retention for 1-hour granularity connection data (days)
connect_1d_retention_daysu6430Retention for 1-day granularity connection data (days)
dns_retention_daysu647Retention for DNS query records (days)
write_batch_sizeusize20000Row-count threshold for a batch write
write_flush_interval_secsu6430Time threshold for a batch write (seconds)
db_max_memory_mbusize256DuckDB memory ceiling (MB)
db_max_threadsusize4DuckDB thread ceiling
cleanup_interval_secsu64300Interval between expiry sweeps. 60 in debug builds
cleanup_time_budget_msu642000Time budget per sweep (ms); yields when exceeded
cleanup_slice_window_secsu64300Width of the time slice handled per sweep (seconds)

TIP

The metric directory grows while the router runs. Cleanup follows the retention settings above. On constrained devices or small root filesystems, reduce connect_*_retention_days and dns_retention_days, or set mode = "memory".

[dns] DNS service

FieldTypeDefaultDescription
cache_capacityu324096Maximum cache entries
cache_ttlu3286400TTL ceiling for positive results (seconds), 24h default
negative_cache_ttlu32120TTL for empty results (NXDOMAIN / NODATA) in seconds
doh_listen_portu166053DoH listen port
doh_http_endpointstring"/dns-query"HTTP path for DoH

[lan_hostname] LAN hostname resolution

Serves DNS for LAN device hostnames under a shared suffix, and advertises that suffix over DHCP. See LAN Hostnames and the LAN Suffix for the full story.

FieldTypeDefaultDescription
enablebooltrueWhether LAN hostname resolution is enabled
lan_suffixstring"lan"LAN domain suffix; multi-label values such as home.arpa work

Upgrade note

This section used to be named [hostname_registry]. The old key is still accepted for compatibility, but exports and serialization always write [lan_hostname]. A configuration containing both keys is invalid, so keep only one when editing the file manually.

[ui] frontend preferences

These three are written and persisted by the frontend and rarely need to be set by hand. When unset, the frontend decides.

FieldTypeDescription
languagestringInterface language
timezonestringTimezone
themestringTheme

[time] NTP time synchronisation

FieldTypeDefaultDescription
enabledboolfalseWhether time sync is enabled
servers[string]["ntp.aliyun.com:123", "time.cloudflare.com:123", "pool.ntp.org:123"]NTP server list; ports required
sync_interval_secsu643600Sync interval (seconds)
timeout_secsu643Per-query timeout (seconds)
step_threshold_msu64500Step the clock instead of slewing when the offset exceeds this
samples_per_serveru83Samples taken per server

[gateway] HTTP reverse proxy

Forwards requests on 80/443 to internal services by domain. Disabled by default, and also editable from the frontend.

FieldTypeDefaultDescription
enableboolfalseWhether the proxy is on
http_portu1680Proxy HTTP listen port
https_portu16443Proxy HTTPS listen port

landscape.toml Configuration Example (configure only what you need)

toml
[auth]
# Login username
admin_user = "root"
# Login password
admin_pass = "root"

[web]
# Web root directory path
web_root = "/root/.landscape-router/static"
# HTTP listen port
port = 6300
# HTTPS listen port
https_port = 6443
# Listen address, use 0.0.0.0 for IPv4 only
address = "::"

[log]
# Log file path
log_path = "/root/.landscape-router/logs"
# Enable debug mode
debug = false
# Output logs to terminal
log_output_in_terminal = false
# Maximum number of log files
max_log_files = 10

[store]
# Database path
database_path = "sqlite:///root/.landscape-router/landscape_db.sqlite?mode=rwc"

[gateway] # HTTP reverse proxy is disabled by default, but can be changed in the UI
enable = true
http_port = 80 # Reverse proxy HTTP listen port
https_port = 443 # Reverse proxy HTTPS listen port

[metric] # Metrics configuration, can be changed in the UI
mode = "duckdb"

landscape_init.toml Configuration Example

config Definition

Configuration details are the same as above. The only difference is that you need to add the config. prefix, for example:

toml
[config.auth]
admin_user = "root"
admin_pass = "root"

[config.web]
web_root = "/root/.landscape-router/static"

[config.log]
log_path = "/root/.landscape-router/logs"

[config.store]
database_path = "sqlite:///root/.landscape-router/landscape_db.sqlite?mode=rwc"

Network Interface Definition

toml
[[ifaces]]
name = "ens3" # Interface name
create_dev_type = "no_need_to_create" # Physical interface does not need to be created
zone_type = "wan" # Zone
enable_in_boot = true # Start this interface on boot
wifi_mode = "undefined" # Whether it is a WiFi interface

# xps_rps configuration for CPU soft load balancing, useful when a single CPU core is weak
[ifaces.xps_rps]
xps = "4"
rps = "4"

Interface IP Configuration Method

toml
[[ipconfigs]]
iface_name = "ens3" # Which interface to apply to
enable = true # Whether to enable

[ipconfigs.ip_model] # Specific IP configuration method
t = "static" # Static IP configuration
default_router_ip = "10.1.1.10" # Router IP
default_router = true # Whether to set default_router_ip as the default route
ipv4 = "10.1.1.237" # Static IP to configure on the current interface
ipv4_mask = 24

DHCP Service Configuration

toml
[[dhcpv4_services]]
iface_name = "test"
enable = false

[dhcpv4_services.config]
ip_range_start = "192.168.5.2"
ip_range_end = "192.168.5.255"
server_ip_addr = "192.168.5.1"
network_mask = 24

# MAC address bindings for IPs
mac_binding_records = [
    { mac = "00:11:22:33:44:55", ip = "192.168.5.100" },
    { mac = "00:11:22:33:44:55", ip = "192.168.5.200" },
]

Command Line Arguments and Environment Variables

Command line arguments take precedence over landscape.toml. Every argument has a corresponding environment variable, convenient for container deployment.

ArgumentEnvironment variableCorresponding config item
-c, --config-dirLANDSCAPE_CONF_PATHConfig directory (<HOME>)
-w, --webLANDSCAPE_WEB_ROOTweb.web_root
-p, --portLANDSCAPE_WEB_HTTP_PORTweb.port
-s, --httpsLANDSCAPE_WEB_HTTPS_PORTweb.https_port
-a, --addressLANDSCAPE_WEB_ADDRweb.address
--userLANDSCAPE_ADMIN_USERauth.admin_user
--passLANDSCAPE_ADMIN_PASSauth.admin_pass
--log_pathLANDSCAPE_LOG_PATHlog.log_path
--debugLANDSCAPE_DEBUGlog.debug
-o, --log-output-in-terminalLANDSCAPE_LOG_TERMINALlog.log_output_in_terminal
--max-log-filesLANDSCAPE_LOG_FILE_LIMITlog.max_log_files
--db_urlDATABASE_URLstore.database_path

Command line only (no corresponding landscape.toml field):

ArgumentEnvironment variableDescription
--log-filterLANDSCAPE_LOG_FILTERComma-separated keywords. When set, only ERROR/WARN logs and logs matching the keywords are output, e.g. dhcp,dns
--autoLANDSCAPE_AUTOAutomatically initialize the default network. Automatically assigns existing network cards to zones
-e, --export-manager-Allow accessing the management UI from the WAN IP
--try-xdp, --txdp-Try native XDP attachment. No value = all network cards, or give comma-separated ifindexes like 3,5. Defaults to TC (SKB) mode only
--ebpf_map_spaceLANDSCAPE_EBPF_MAP_SPACEeBPF map namespace, default default

DANGER

--auto will automatically assign detected network cards to zones. On a machine that already has a configuration, or on a machine where you only want isolated testing, it may take over the management network card in use and cause you to lose connection. Do not pass this argument unless it is the first-time initialization.

Subcommands

sh
# Interactively roll back the database to a release boundary
landscape-webserver db rollback
# Or use the alias
landscape-webserver db rb