Then I made a discovery on the windows 10 client side !
I added a bridge in the vpn router and added to it ip address 10.10.30.130,
I could ping it from the windows 10 client with the connected vpn tunnel.
Still on windows 10 client I tried to ping the vpn router ip address 172.16.1.129, it failed off course, like before.
After that I went back to the windows 10 client, checking routes:
If there is not any IP magics engaged I can not see that the windows 10 client has any route telling where 172.16.1.0/24 is.
So I as user admin added routes in the windows 10 client:
c:> route add 172.16.1.0 mask 255.255.255.0 10.10.30.124
c:> ping 172.16.1.129
Pinging 172.16.1.129 with 32 bytes of data:
Reply from 172.16.1.129: bytes=32 time=63ms TTL=64
Reply from 172.16.1.129: bytes=32 time=75ms TTL=64
Reply from 172.16.1.129: bytes=32 time=74ms TTL=64
Reply from 172.16.1.129: bytes=32 time=61ms TTL=64
Ping statistics for 172.16.1.129:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 61ms, Maximum = 75ms, Average = 68ms
Now remote desktop to 172.16.1.130, 172.16.1.132 and so on now works as they should.
Bringing down the vpn tunnel also clears the routing table, bringing it up and you have to add routes to 172.16.1.0/24 as admin to make it work.
That raises the question, why has windows 10 not added the routes or what is missing in the magics ?
The point is that the packet decrypted and de-encapsulated from an IPsec packet is seen by the firewall as coming in via the interface through which the IPsec transport packet carrying it came in. So unless you make an ****
action=accept
exception for packets coming in through vlan112 for packets with
ipsec-policy=in,ipsec
(which is not the same like permitting ipsec-esp and ipsec-ah), you have to accept them based on their IP addresses. Otherwise it should not work even with your added route.
The above should be done in ****
/ip firewall filter chain=input
to get to the Mikrotik itself and in
/ip firewall filter chain=forward
to get to other devices.
Then I made a discovery on the windows 10 client side !
I added a bridge in the vpn router and added to it ip address 10.10.30.130,
I could ping it from the windows 10 client with the connected vpn tunnel.
Still on windows 10 client I tried to ping the vpn router ip address 172.16.1.129, it failed off course, like before.
After that I went back to the windows 10 client, checking routes:
>
> If there is not any IP magics engaged I can not see that the windows 10 client has any route telling where 172.16.1.0/24 is.
>
> That raises the question, why has windows 10 not added the routes or what is missing in the magics ?
The magics should have been in the ****
```text
/ip ipsec mode-config
part, which is used to tell the client what IPsec policy to use. Your generated policy suggests that it worked:
AFAIK this policy at server side is not generated from the mode-config directly locally but is requested by the client as a mirror of its local policy which is based on the received mode-config. So the fact that src-address in the server-side policy is 0.0.0.0/0 would indicate that the Windows machine has understood the mode-config properly. Nevertheless, the Windows machine has not transformed the policy into its local routing table properly, creating only a route for 10.0.0.0/8, not for 0.0.0.0/0 suggested by the mode-config (implicitly, by absence of a list of subnets to be made available using individual policies).
If you feel like that, you may try to modify your mode-config the following way:
/ip ipsec mode-config set [find name=cfg1] split-include=10.0.0.0/8,172.16.0.0/12
But it is just a theory, it may actually get worse (even the 10.0.0.0/8 you can now see in the routing table of the Windows client may be missing after the change).
VPN and routes are notorious PITA. It seems like almost everyone expects VPN clients to route all their traffic through remote server. If you do that, everything is fine. But when you want to reach only few remote subnets and use own default gw for the rest, the trouble begins. Even though some options for routes exists in different protocols, the state of interoperability is really sad. I’m still looking for automatic and reliable solution for RouterOS ↔ Windows VPN, and haven’t found anything that would completely satisfy me.
The two firewall rules I first added but they did not make any difference so I disabled them during all tests here and there.
/ip firewall filter
…
add action=accept chain=forward disabled=yes dst-address=0.0.0.0/0 src-address=10.10.30.0/24
add action=accept chain=forward disabled=yes dst-address=10.10.30.0/24 src-address=0.0.0.0/0
I had the two submets in the mode-config from the beginning, but it did not make any differences, also mikrotik write in documentation windows does ignore the setttings.
I realise this windows support vary, on server 2016 it worked perfectly, windows 10 does not.
Having no idea what happens under the hood of Windows, I can only suggest you to use the ****
netmap
flavour of NAT to make 172.16.1.0/24 and 192.168.2.0/24 subnets visible to the Windows clients as 10.x.x.0/24 and 10.y.y.0/24, with all the notorious issues of NAT of course.
Or if the config is going to be static, i.e. you won’t change the subnets on server side, you can manually add routes on client side (Windows 10, not older) with:
Big thanks for all of you having pation to engage you so much in my tedious VPN problems, this was worth much!
Thanks for the powershell oneliner and all hints and tips, leading to something that works at least partly.
Our developers will write some code, connected to AD and some vpn role, that will automatically generate the necessary certificates and provide to our users.
We think about some small program with embedded certificate that users will execute that will install the certificate and add the routes if needed, when needed.
So far we managed get mikrotik IKEv2 road warrior VPN working for:
server 2016 out of the box, no hacks, just to follow MT instruction and you are home, end users can handle it.
windows 10, need some hacking, manually adding routes to subnets in the windows 10 client, could be handled by power user.
macOS High Sierra, need lots of hacking including installing some obscure “mac configurator”, no comments.
IOS, not working and have not been investigated why.
Android, not yet tested.
We really want to be able replacing our Cisco VPN solution, which works for almost all platforms without bigger hassle, to the level that endusers easily can handle it.
I will do some more tests and add the results of them here and also present the full solution so others can follow it as well.
I want to keep it simple and as much standard as possible.
The IPSEC mode-config in mikrotik router with split routes did work with windows 10 no matter the settings, so I left them empty till further.
I added back:
/ip firewall filter
add action=accept chain=forward disabled=no dst-address=0.0.0.0/0 src-address=10.10.30.0/24
add action=accept chain=forward disabled=no dst-address=10.10.30.0/24 src-address=0.0.0.0/0
On windows 10 client side I setup the ikev2 tunnel per mikrotik instruction. As I understand it, one could add the whole ikev2 tunnel in powershell, but I have not figured that out yet.
Then I have a few options, manually add routes to 172.16.1.0/24 and 192.168.2.0/24 or doing it via powershell(yet not tested).
or
Change the properties on the “WAN Miniport (IKEv2)” -device → Network menu → Double click on TCP/IPv4 → click on Advanced → “Check Use standard gateway on the remote network” → OK
The first option I think is the better, because it does not affect any else routes.
The second option could lead to “undefined” traffic over the IKEv2 tunnel.
Second option (VPN as default gateway) is easier, in Windows it seems to be default way that “just works”. But it’s not very practical in many cases. If as user I want to connect to more than one remote network at the same time (and I do), I can’t have them both as default gateway. I guess it might not be a problem for most users. But then there’s another one. If as admin I want users to access just few remote servers in company LAN from outside, I’m not interested in all their Youtube streaming and such getting routed though VPN. So the first option (only selected subnets routed through VPN) is almost always the right one for me.
But it’s easier said than done. Windows built-in VPN clients have three options what routes to add (everything, nothing, class-based). I don’t want everything, nothing is not useful either and class-based adds route to only one subnet, and e.g. 10.0.0.0/8 is also little too much. In theory, there are other options. Windows L2TP client should be able to get routes using DHCP (mentioned here), but RouterOS doesn’t support that. IKEv2 can set split networks, but Windows don’t care about that. Then there’s IPSec + modeconf, but it seems completely unsupported by Windows, unless you install third-party client. OpenVPN has support for pushing routes as standard feature, but MikroTik decided to not implement it in RouterOS. SSTP doesn’t seem to offer anything either.
So I don’t really see any simple & no compromises way how to have split tunnelling between RouterOS and Windows with everything controlled from server side.
So far all seems to work, off course the clients find it difficult to get their vpn tunnels working properly compared to cisco vpn solution that just works.
For some users I got lots of this in the log files:
19:28:27 ipsec,error no proposal chosen
As far I know, the tunnel works for the user, at least he told me so, but what is this and can it harm in some way, and how can I fix it ?
That sounds dangerous, not just annoying, to me to see this in the logs and still have the connection established for the users. I may be wrong but I’m afraid that it indicates that your L2TP server settings say “use-ipsec=yes” instead of “use-ipsec=required”, therefore the L2TP tunnel is established even though the IPsec transport securing it has failed to establish.
The softer explanation why the clients connect successfully although no proposal has been chosen could be that the client retries with a different proposal if the initial attempt has failed but that seems unlikely to me.
Hmm the l2tp server is disabled. I don’t get it the I connect my tunnel, so maybe there is something weird with one users windows vpn configuration, have to check that out.
Sorry, doing several times at a time is never good. I’ve forgotten that you don’t use L2TP/IPsec but plain IPsec so the L2TP catch came immediately to my mind. Ignore that idea.
In the light of another topic, I can suppose that the client may use several connection attempts with different proposals to prevent exceeding the server’s handling capacity by a single proposal containing too many encryption protocols. Excluding packet bytes from the debug (****
/system logging set [find topics=ipsec] topics=ipsec,!packet
) should give you a compact enough log to confirm this speculation.
One windows 10 client causes this an the user also experience frequent kick outs and has to dissconnect and connect again. It is unclear at time of writing if the user has missed something in the settings.
I have the same setup, with respekt to the other user might have missed something, in my case there is nothing in the logs at all.
OK, I was too brief, I try that from time to time and it always causes more bad than good
What I had in mind was whether this ****
ipsec,error no propsal chosen
was systematically immediately followed by a successful attempt from the same client, indicating that the client uses several establihment attempts, each with a different proposal, in a row.
Here is what is in the log, when this user have the vpn up. User windows 10 vpn client configuration yet unknown. I will connect my vpn tunnel to and see what I got, at least I had no errors at all in my vpn logs. But this poor user has.
The only difference I am aware about is that this customer sit behind NAT-router of some kind with his windows 10 pro.
But I am also behind NAT, because I have my windows 10 home in a parallels virtual session which also natted to my mac-os host which is connected via mobile phone (natted again) or my NAT router.
I just touch and go today, so I have not had any time analyzing this properly yet.