Hello,
I’m trying to figure out how to successfully route a particular set of web addresses through a VPN service on my Mikrotik CCR1009 running the latest stable version of RouterOS (6.40.2)
I am using the IPVanish VPN service to try and accomplish moving game packets closer to the game’s service datacenter. My ISP here has a problem with the route and it’s causing massive game lag. As much as I’ve tried to remedy the issue, I think my best option is to VPN tunnel around the issue, and it has the potential side benefit of getting me better ping/latency times. IPVanish does not specifically have instructions for RouterOS, however it does seem to support PPTP in addition to it’s preferred OpenVPN method (which is impossible due to the lacking implementation of OpenVPN on RouterOS). So I’m using PPTP.
So basically I want all my normal internet traffic routed out through my cable broadband ISP as normal. I want a certain set of packets (identified by Layer 7) to be routed out the VPN tunnel (via PPTP Client) instead.
I’ve reviewed a few “how to” pages here on the wiki, some forum posts, and other VPN providers’ instructions. I have also emailed the IPVanish customer support, but I have a feeling they’re going to tell me I’m on my own. (I do have success using their VPN app on my iPhone, as well as OpenVPN implementation on an dedicated OpenELEC/LibreELEC Kodi media PC-- however I need this to be network-wide, not tunneled on each device as I am subjected to concurrent connection limits)
I have created a Mangle rule to identify and mark the packets that need to be redirected using Layer7 RegEx’s. This seems to be working fine as I can see the marks.
I have created a NAT masquerade rule for the VPN client interface.
I have created a route entry to push all marked packets through the VPN interface.
I have created a VPN PPTP client with all the pertaining info. It seems to connect and get an IP address endpoint (“remote address”) from the VPN provider.
When I try to use the Tools->Ping, and select the VPN interface the ping responds just fine. I can see the ping traffic going out/in via the “Traffic” tab on the PPTP Client.
However, when I try to browse a webpage (I used “whatsmyip.com” as my test mule in the Layer7 RegEx) the (Firefox) web browser just shows “Performing a TLS handshake to whatsmyip.com…” and eventually times out and displays an error.
I see a connection made to the host I’m trying to reach in the connections tab of the Firewall section. If I run Torch on the VPN interface I see a source IP of the remote web server on port 443, and a destination IP of my public ISP-Assigned IP. For some odd reason I feel like the NAT isn’t working right with the return response, but I could be very wrong.
In the following configs, my LAN is 10.2.0.0/24, and my Internet ISP WAN is 98.229.234.93 (DHCP Assigned).
Configs:
[admin@CCR1009] > /interface pptp-client print
Flags: X - disabled, R - running
0 R ;;; INTERNET (Protected VPN)
name="IPVanish-VPN" max-mtu=1396 max-mru=1396 mrru=disabled
connect-to=nyc-a10.ipvanish.com user="xxxxxxxxxxxxxx"
password="yyyyyyyyyyyyy" profile=IPVanish keepalive-timeout=600
add-default-route=no dial-on-demand=yes allow=pap,chap,mschap1,mschap2
[admin@CCR1009] > /ppp profile print
Flags: * - default
0 * name="default" use-mpls=default use-compression=default
use-encryption=default only-one=default change-tcp-mss=yes
use-upnp=default address-list="" on-up="" on-down=""
1 name="IPVanish" use-mpls=default use-compression=default use-encryption=yes
only-one=yes change-tcp-mss=yes use-upnp=default address-list="" on-up=""
on-down=""
2 * name="default-encryption" use-mpls=default use-compression=default
use-encryption=yes only-one=default change-tcp-mss=yes use-upnp=default
address-list="" on-up="" on-down=""
[admin@CCR1009] > /ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
# DST-ADDRESS PREF-SRC GATEWAY DISTANCE
0 A S 0.0.0.0/0 IPVanish-VPN 1
1 ADS 0.0.0.0/0 98.229.232.1 1
2 ADC 10.2.0.0/24 10.2.0.1 BRIDGE-LAN 0
3 ADC 10.112.112.238/32 172.20.0.7 IPVanish-VPN 0
4 ADC 98.229.232.0/21 98.229.234.93 wan-sfp1 0
[admin@CCR1009] > /ip firewall mangle print
Flags: X - disabled, I - invalid, D - dynamic
0 ;;; Routing Mark for IPVanish (Secure VPN Web Service) - Dest URL
chain=prerouting action=mark-routing new-routing-mark=IPVanish
passthrough=yes connection-nat-state=""
layer7-protocol=IPVanish_Destination log=yes log-prefix="IPVMark"
1 chain=prerouting action=mark-connection new-connection-mark=IPV_CONN
passthrough=no routing-mark=IPVanish log=no
(I add the connection mark simply to be able to see it easily in the Connections tab)
[admin@CCR1009] > /ip firewall nat print
Flags: X - disabled, I - invalid, D - dynamic
0 chain=srcnat action=masquerade routing-mark=IPVanish
out-interface=IPVanish-VPN log=yes log-prefix="IPVanish"
1 chain=srcnat action=masquerade src-address=10.2.0.0/24
out-interface=wan-sfp1 log=no log-prefix=""
2 chain=srcnat action=masquerade src-address=10.2.0.0/24
out-interface=BRIDGE-LAN log=no log-prefix=""
I read elsewhere someone added these, so I tried them (it didn’t seem to help):
[admin@CCR1009] > /ip route rule print
Flags: X - disabled, I - inactive
0 routing-mark=IPVanish action=lookup table=IPVanish
1 action=lookup table=main
Any help that’s provided is extremely appreciated. I’ve truly tried to puzzle this one out as much as I could before asking the community.