diff --git a/docs/adguard-vpn-for-linux/settings.md b/docs/adguard-vpn-for-linux/settings.md index 56fceffdb..ae3a0802b 100644 --- a/docs/adguard-vpn-for-linux/settings.md +++ b/docs/adguard-vpn-for-linux/settings.md @@ -5,7 +5,9 @@ sidebar_position: 4 You can manage AdGuard VPN for Linux settings from the command line. To view the current configuration, type: - adguardvpn-cli config show +```shell +adguardvpn-cli config show +``` ## VPN mode: TUN or SOCKS5 @@ -28,7 +30,9 @@ When TUN mode is enabled, AdGuard VPN: To set the default tunnel mode, type: - adguardvpn-cli config set-mode TUN +```shell +adguardvpn-cli config set-mode TUN +``` ### SOCKS5 mode @@ -42,14 +46,18 @@ When SOCKS5 mode is enabled, AdGuard VPN: To prevent DNS leaks, use a client that resolves hostnames via the proxy (often denoted as `socks5h` in tools like `curl`). If an app resolves hostnames locally, system DNS may bypass the proxy. - curl -x socks5://127.0.0.1:1080 https://example.com - curl -x socks5h://127.0.0.1:1080 https://example.com +```shell +curl -x socks5://127.0.0.1:1080 https://example.com +curl -x socks5h://127.0.0.1:1080 https://example.com +``` ::: To set the SOCKS5 mode, type: - adguardvpn-cli config set-mode SOCKS +```shell +adguardvpn-cli config set-mode SOCKS +``` :::note @@ -74,7 +82,9 @@ adguardvpn-cli config set-socks-password Replace `` and `` with your desired username and password. To clear the SOCKS username and password, type: - adguardvpn-cli config clear-socks-auth +```shell +adguardvpn-cli config clear-socks-auth +``` To set the SOCKS5 port, type: @@ -94,7 +104,9 @@ adguardvpn-cli config set-dns Replace `` with the address of your DNS server. To use this DNS server at the system level, type: - adguardvpn-cli config set-change-system-dns on +```shell +adguardvpn-cli config set-change-system-dns on +``` If you set the parameter to `off`, the system DNS settings remain unchanged and DNS queries may bypass the VPN tunnel. @@ -114,9 +126,11 @@ AdGuard VPN CLI brings up the TUN interface but does not modify the system routi Use this option if you want to manage routes yourself manually or with third-party tools. -To set the tunnel routing mode to NONE (no routing), type: +To set the tunnel routing mode to `NONE` (no routing), type: - adguardvpn-cli config set-tun-routing-mode NONE +```shell +adguardvpn-cli config set-tun-routing-mode NONE +``` ### AUTO — automatic routing @@ -126,81 +140,95 @@ AdGuard VPN CLI creates and maintains the minimal set of routes required for the - Preserving access to local networks (commonly RFC1918 subnets) and other exclusions, so that your LAN, printers, and routers remain reachable. - Reacting to reconnects and endpoint changes by reapplying routes as needed. -Use AUTO if you want a “just works” configuration with system-wide protection and no per-app setup. +Use `AUTO` if you want a “just works” configuration with system-wide protection and no per-app setup. -To set the tunnel routing mode to AUTO (automatic routing), type: +To set the tunnel routing mode to `AUTO` (automatic routing), type: - adguardvpn-cli config set-tun-routing-mode AUTO +```shell +adguardvpn-cli config set-tun-routing-mode AUTO +``` ### SCRIPT — user-defined routing AdGuard VPN CLI executes a user-supplied script that adds or removes routes when the tunnel state changes. You have full control over what goes through the tunnel and what stays direct. -To set the tunnel routing mode to SCRIPT (custom routing script), type: +To set the tunnel routing mode to `SCRIPT` (custom routing script), type: - adguardvpn-cli config set-tun-routing-mode SCRIPT +```shell +adguardvpn-cli config set-tun-routing-mode SCRIPT +``` To create a routes script with proper permissions, type: - adguardvpn-cli config create-routes-script +```shell +adguardvpn-cli config create-route-script +``` -Use SCRIPT if you need fine-grained split tunneling, enterprise routing policies, or custom exceptions beyond what AUTO provides. +Use `SCRIPT` if you need fine-grained split tunneling, enterprise routing policies, or custom exceptions beyond what `AUTO` provides. #### Examples **Linux custom script:** - #!/bin/sh - INTERFACE="$1" - - # Example 1: Route only specific corporate networks through VPN - ip route add 192.168.100.0/24 dev "$INTERFACE" # Corporate network - ip route add 10.0.0.0/8 dev "$INTERFACE" # Private networks - ip route add 172.16.0.0/12 dev "$INTERFACE" # Another private range - - # Example 2: Route everything except local networks - # ip route add 0.0.0.0/1 dev "$INTERFACE" - # ip route add 128.0.0.0/1 dev "$INTERFACE" - # ip -6 route add 2000::/3 dev "$INTERFACE" || true - # ip route del 192.168.0.0/16 dev "$INTERFACE" 2>/dev/null || true - # ip route del 10.0.0.0/8 dev "$INTERFACE" 2>/dev/null || true +```shell +#!/bin/sh +INTERFACE="$1" + +# Example 1: Route only specific corporate networks through VPN +ip route add 192.168.100.0/24 dev "$INTERFACE" # Corporate network +ip route add 10.0.0.0/8 dev "$INTERFACE" # Private networks +ip route add 172.16.0.0/12 dev "$INTERFACE" # Another private range + +# Example 2: Route everything except local networks +# ip route add 0.0.0.0/1 dev "$INTERFACE" +# ip route add 128.0.0.0/1 dev "$INTERFACE" +# ip -6 route add 2000::/3 dev "$INTERFACE" || true +# ip route del 192.168.0.0/16 dev "$INTERFACE" 2>/dev/null || true +# ip route del 10.0.0.0/8 dev "$INTERFACE" 2>/dev/null || true +``` **macOS custom script:** - #!/bin/sh - INTERFACE="$1" - - # Example 1: Route only specific corporate networks through VPN - route add 192.168.100.0/24 -iface "$INTERFACE" # Corporate network - route add 10.0.0.0/8 -iface "$INTERFACE" # Private networks - route add 172.16.0.0/12 -iface "$INTERFACE" # Another private range - - # Example 2: Route everything except local networks - # route add 1.0.0.0/8 -iface "$INTERFACE" - # route add 2.0.0.0/7 -iface "$INTERFACE" - # route add 4.0.0.0/6 -iface "$INTERFACE" - # route add 8.0.0.0/5 -iface "$INTERFACE" - # route add 16.0.0.0/4 -iface "$INTERFACE" - # route add 32.0.0.0/3 -iface "$INTERFACE" - # route add 64.0.0.0/2 -iface "$INTERFACE" - # route add 128.0.0.0/1 -iface "$INTERFACE" - # route add -inet6 2000::/3 -iface "$INTERFACE" || true - # route delete 192.168.0.0/16 2>/dev/null || true - # route delete 10.0.0.0/8 2>/dev/null || true +```shell +#!/bin/sh +INTERFACE="$1" + +# Example 1: Route only specific corporate networks through VPN +route add 192.168.100.0/24 -iface "$INTERFACE" # Corporate network +route add 10.0.0.0/8 -iface "$INTERFACE" # Private networks +route add 172.16.0.0/12 -iface "$INTERFACE" # Another private range + +# Example 2: Route everything except local networks +# route add 1.0.0.0/8 -iface "$INTERFACE" +# route add 2.0.0.0/7 -iface "$INTERFACE" +# route add 4.0.0.0/6 -iface "$INTERFACE" +# route add 8.0.0.0/5 -iface "$INTERFACE" +# route add 16.0.0.0/4 -iface "$INTERFACE" +# route add 32.0.0.0/3 -iface "$INTERFACE" +# route add 64.0.0.0/2 -iface "$INTERFACE" +# route add 128.0.0.0/1 -iface "$INTERFACE" +# route add -inet6 2000::/3 -iface "$INTERFACE" || true +# route delete 192.168.0.0/16 2>/dev/null || true +# route delete 10.0.0.0/8 2>/dev/null || true +``` ## Set protocol To set the protocol used by AdGuard VPN (HTTP2, QUIC, or automatic choice between them), type one of the commands, depending on your choice: - adguardvpn-cli config set-protocol http2 - adguardvpn-cli config set-protocol quic - adguardvpn-cli config set-protocol auto +```shell +adguardvpn-cli config set-protocol http2 +adguardvpn-cli config set-protocol quic +adguardvpn-cli config set-protocol auto +``` ## Crash reports If you enable automatic crash reports, AdGuard VPN will notify the developers if something goes wrong. To enable the setting, type: - adguardvpn-cli config send-reports on +```shell +adguardvpn-cli config send-reports on +``` To disable it, set it to `off`. @@ -218,7 +246,9 @@ Replace `` with `release`, `beta`, or `nightly`, depending on your pref AdGuard VPN can show you hints after executing commands — for example, what to do next or how to fix an error. This setting is enabled by default but you can disable it by typing: - adguardvpn-cli config set-show-hints off +```shell +adguardvpn-cli config set-show-hints off +``` To re-enable it, replace `off` with `on`. @@ -226,7 +256,9 @@ To re-enable it, replace `off` with `on`. To report a bug, you may need to share debug logs with the developers or support team. To enable debug logging, type: - adguardvpn-cli config set-debug-logging on +```shell +adguardvpn-cli config set-debug-logging on +``` Disable this setting after exporting logs. @@ -238,7 +270,9 @@ The setting is responsible for the appearance of system notifications when AdGua - A user turns VPN off — the *VPN disconnected* notification appears. - A user is waiting for the VPN connection to be recovered — the *Waiting for connection* notification appears. - adguardvpn-cli config set-show-notifications on +```shell +adguardvpn-cli config set-show-notifications on +``` ## Exclusions