You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
6.3 KiB

  1. <!-- markdownlint-disable MD013 -->
  2. # VPN Bypass
  3. [![HitCount](http://hits.dwyl.com/stangri/openwrt/vpnbypass.svg)](http://hits.dwyl.com/stangri/openwrt/vpnbypass)
  4. A simple [procd](https://openwrt.org/docs/techref/procd)-based ```vpnbypass``` service for OpenWrt/LEDE Project. This is useful if your router accesses Internet through a VPN client/tunnel, but you want specific traffic (ports, IP ranges, domains or local IP ranges) to be routed outside of this tunnel.
  5. ## Features
  6. - Define local ports so traffic to them is routed outside of the VPN tunnel (by default it routes Plex Media Server traffic (port 32400) outside of the VPN tunnel).
  7. - Define IPs/subnets in local networks so their traffic is routed outside the VPN tunnel (by default it routes traffic from 192.168.1.81-192.168.1.87 outside the VPN tunnel).
  8. - Define remote IP ranges that are accessed outside the VPN tunnel (by default, LogmeIn Hamachi traffic (25.0.0.0/8) is routed outside the VPN tunnel).
  9. - Creates list of domain names which should be accessed outside the VPN tunnel (useful for Netflix, Hulu, etc).
  10. - Does not reside in RAM -- creates `iptables` rules which are automatically updated on WAN up/down events.
  11. - A companion package (`luci-app-vpnbypass`) is provided so all features may be configured from the Web UI.
  12. - Proudly made in Canada, using locally-sourced electrons.
  13. ## Screenshot (luci-app-vpnbypass)
  14. ![screenshot](https://cdn.jsdelivr.net/gh/stangri/openwrt_packages/screenshots/vpnbypass/screenshot02.png "screenshot")
  15. ## Requirements
  16. This service requires the following packages to be installed on your router: ```ipset``` and ```iptables```. Additionally, if you want to use the Domain Bypass feature, you need to install ```dnsmasq-full``` (```dnsmasq-full``` requires you uninstall ```dnsmasq``` first).
  17. To fully satisfy the requirements for both IP/Port VPN Bypass and Domain Bypass features connect via ssh to your router and run the following commands:
  18. ```sh
  19. opkg update; opkg remove dnsmasq; opkg install ipset iptables dnsmasq-full
  20. ```
  21. To satisfy the requirements for just IP/Port VPN Bypass connect to your router via ssh and run the following commands:
  22. ```sh
  23. opkg update; opkg install ipset iptables
  24. ```
  25. ### Unmet dependencies
  26. If you are running a development (trunk/snapshot) build of OpenWrt/LEDE Project on your router and your build is outdated (meaning that packages of the same revision/commit hash are no longer available and when you try to satisfy the [requirements](#requirements) you get errors), please flash either current LEDE release image or current development/snapshot image.
  27. ## How to install
  28. <!---
  29. #### From Web UI/Luci
  30. Navigate to System->Software page on your router and then perform the following actions:
  31. 1. Click "Update Lists"
  32. 2. Wait for the update process to finish.
  33. 3. In the "Download and install package:" field type ```vpnbypass luci-app-vpnbypass```
  34. 4. Click "OK" to install ```vpnbypass``` and ```luci-app-vpnbypass```
  35. If you get an ```Unknown package 'vpnbypass'``` error, your router is not set up with the access to a repository containing these packages and you need to add the custom repository to your router first.
  36. #### From console/ssh
  37. --->
  38. Please ensure that the [requirements](#requirements) are satisfied and install ```vpnbypass``` and ```luci-app-vpnbypass``` from the Web UI or connect to your router via ssh and run the following commands:
  39. ```sh
  40. opkg update
  41. opkg install vpnbypass luci-app-vpnbypass
  42. ```
  43. If these packages are not found in the official feed/repo for your version of OpenWrt/LEDE Project, you will need to add a custom repo to your router following instructions on [GitHub](https://github.com/stangri/openwrt_packages/blob/master/README.md#on-your-router)/[jsDelivr](https://cdn.jsdelivr.net/gh/stangri/openwrt_packages/README.md#on-your-router) first.
  44. These packages have been designed to be backwards compatible with OpenWrt 19.07, OpenWrt 18.06, LEDE Project 17.01 and OpenWrt 15.05. However, on systems older than OpenWrt 18.06.6 and/or a system which has deviated too far (or haven't been updated to keep in-sync) with official OpenWrt release you may get a message about missing ```luci-compat``` dependency, which (and only which) you can safely ignore and force-install the luci app using ```opkg install --force-depends``` command instead of ```opkg install```.
  45. ## Default Settings
  46. The default configuration ships with the service disabled, use the Web UI to enable/start the service or run ```uci set vpnbypass.config.enabled=1; uci commit vpnbypass;```. It routes Plex Media Server traffic (port 32400) and LogmeIn Hamachi traffic (25.0.0.0/8) outside of the VPN tunnel. Internet traffic from local IPs `192.168.1.81-192.168.1.87` is also routed outside the VPN tunnel. You can safely delete these example rules if they do not apply to you.
  47. ## Documentation / Discussion
  48. Please head to [OpenWrt Forum](https://forum.openwrt.org/t/vpn-bypass-split-tunneling-service-luci-ui/1106) for discussions of this service.
  49. ### Bypass Domains Format/Syntax
  50. Domain lists should be in the following format/syntax: ```/domain1.com/domain2.com/vpnbypass```. Please do not forget the leading ```/``` and trailing ```/vpnbypass```. There is no validation if you enter something incorrectly -- it simply will not work. Please see [Notes/Known Issues](#notesknown-issues) if you wish to edit this setting manually, without using the Web UI.
  51. ## What's New
  52. 1.3.0:
  53. - No longer depends on hardcoded WAN interface name (```wan```) works with other interface names (like ```wwan```).
  54. - Table ID, IPSET name and FW_MARK as well as FW_MASK can be defined in config file.
  55. - Uses iptables, not ip rules for handling local IPs/ranges.
  56. - More reliable creation/destruction of VPNBYPASS iptables chain.
  57. - Updated Web UI enables, starts and stops the service.
  58. ## Notes/Known Issues
  59. 1. Domains to be accessed outside of VPN tunnel are handled by dnsmasq and thus are not defined in ```/etc/config/vpnpass```, but rather in ```/etc/config/dhcp```. To add/delete/edit domains you can use VPN Bypass Web UI or you can edit ```/etc/config/dhcp``` manually or run the following commands:
  60. ```sh
  61. uci add_list dhcp.@dnsmasq[-1].ipset='/github.com/plex.tv/google.com/vpnbypass'
  62. uci add_list dhcp.@dnsmasq[-1].ipset='/hulu.com/netflix.com/nhl.com/vpnbypass'
  63. uci commit dhcp
  64. /etc/init.d/dnsmasq restart
  65. ```
  66. This feature requires ```dnsmasq-full``` to work. See the [Requirements](#requirements) section for more details.