← Back to Home

AmneziaVPN site list from any website

Updated · NetRoute version 4.1.4

AmneziaVPN can send only the addresses from a list through the VPN — split tunneling for sites. The list consists of IPv4 addresses and subnets, and building it by hand for a site with dozens of domains takes long. NetRoute does it from the page: open the site, click “Analyze website”, download the file for import.

What is inside the file

The file is a JSON array of entries in the shape AmneziaVPN itself exports its list: each entry has a hostname, the list of addresses ips and the first of them in ip — for older versions of the app.

[
  { "hostname": "api.github.com", "ips": ["140.82.112.4"], "ip": "140.82.112.4" },
  { "hostname": "github.com", "ips": ["140.82.112.3"], "ip": "140.82.112.3" },
  { "hostname": "140.82.112.0/20", "ips": [], "ip": "" },
  { "hostname": "185.199.108.0/22", "ips": [], "ip": "" }
]
NetRoute popup after scanning github.com: the selected format and the result on the Routes tab NetRoute popup after scanning github.com: the selected format and the result on the Routes tab
The NetRoute popup with the “AmneziaVPN (site list)” format: the Routes tab holds the list for import, hosts with addresses and subnets. Scan data: a github.com page.

What you need

Step 1. Generate the list in NetRoute

  1. Open the website in Chrome and reload the page so the extension’s sniffer sees the background requests
  2. Start NetRoute
  3. Under Target OS pick AmneziaVPN (site list) — the “VPN clients” group
  4. The Gateway IP and Device fields do not affect this format
  5. Click Analyze website
  6. On the Domains tab untick what you do not need — counters, ad networks, third-party CDNs; the list updates at once
  7. Click Download: the file is named after the site, for example github_com_rules.json
About changing addresses. The AmneziaVPN documentation warns that an address obtained from a domain is not updated automatically, and that large services need whole subnets. So before scanning enable Route Optimization → BGP Prefix in the NetRoute options — the file then carries the announced subnets, which survive address rotation at CDNs.

Step 2. Import the file into AmneziaVPN

Per the AmneziaVPN documentation the list is imported from the split tunneling settings for sites:

  1. Open Split tunneling and go to the split tunneling settings for sites
  2. Tap the ⋮ icon and choose the import: replace the list — when starting from scratch, or add the imported sites to the existing ones — when extending
  3. Pick the downloaded file; the entries appear in the list

Step 3. Turn on the mode and connect

  1. Choose the mode Only the sites listed here will be accessed through the VPN — only the sites from the file go through the tunnel, the rest of the traffic goes direct. The second mode, Addresses from the list should not be accessed via VPN, does the opposite: it excludes the list from the tunnel
  2. Enable split tunneling for sites
  3. Connect to the VPN

Step 4. Check

Open the site the list was built for: it should open through the VPN, sites outside the list direct. If the site opens only partly — some of its domains are missing from the list: check the Domains tab in NetRoute, walk through the site before scanning (sign in, open a video) so the sniffer sees the deferred requests, and import the file again, replacing the list.

Common problems

The file does not import

Per the client’s source code the file must be a JSON array of objects; a plain array of strings is rejected. The NetRoute file already has the right shape — check that it was downloaded completely and not edited in a text editor that replaces quotes.

The site worked, then stopped

The site’s addresses changed. Rebuild the file in NetRoute — with BGP Prefix enabled it carries subnets instead of single addresses — and import it replacing the list.

Unrelated traffic went through the VPN

The AmneziaVPN documentation warns that the wide subnets of large services can capture unrelated traffic. Untick third-party CDNs on the Domains tab in NetRoute or turn the BGP optimization off for such sites.

The connection to your own server was lost

Per the documentation, when the address of your VPN server falls inside one of the added subnets the connection breaks — remove that subnet from the list.

Several sites in one list

Click URL list next to the analyze button and paste the list of sites — NetRoute builds one file for all of them, named bulk_N_rules.json.

DNS and leaks

AmneziaVPN’s split tunneling works by addresses: traffic to the addresses from the list enters the tunnel, while the browser’s DNS queries go wherever its resolver is configured. When that is the ISP’s resolver, it sees the names of the sites even while the traffic itself goes through the VPN. In Chrome turn off “Use secure DNS” or point it at a resolver you trust; the DNS settings of AmneziaVPN itself are described in its documentation.

Check: dnsleaktest.com with the VPN connected shows whose resolver answers your queries.

Example Configuration File

Ready-to-edit template. Replace the example domains and networks with output from NetRoute for your target sites.


[
  {
    "hostname": "api.github.com",
    "ips": [
      "140.82.112.4"
    ],
    "ip": "140.82.112.4"
  },
  {
    "hostname": "avatars.githubusercontent.com",
    "ips": [
      "185.199.108.133"
    ],
    "ip": "185.199.108.133"
  },
  {
    "hostname": "github.com",
    "ips": [
      "140.82.112.3"
    ],
    "ip": "140.82.112.3"
  },
  {
    "hostname": "github.githubassets.com",
    "ips": [
      "185.199.108.154"
    ],
    "ip": "185.199.108.154"
  },
  {
    "hostname": "140.82.112.0/20",
    "ips": [],
    "ip": ""
  },
  {
    "hostname": "185.199.108.0/22",
    "ips": [],
    "ip": ""
  }
]

Hint: the text formats download with a comment header. Untick “Include comments in exported files” in the NetRoute options to get the rules alone; the JSON formats never carry comments.

All example configs on GitHub →

Official Documentation

Ready to try?

NetRoute — a free Chrome extension to generate routes from any website.

Install Extension