Hello everyone
Is it possible to route the traffic of one device (192.168.11.94) with VPN (PPTP client(I know it's not safe just for example)) while the whole router is connected to the IKEV2/IPSec?
Definitely yes, but without seeing the IPsec part, it is impossible to tell you what exactly overrides your policy routing setup. Most likely the IP address assigned to the PPTP tunnel matches to an IPsec policy, but it is not the only possibility. See my automatic signature below for further steps.Is it possible?
It is the "route everything elsewhere (inside the VPN)" kind. yeah it will add a dynamic rule but I got a scheduler which can move the rules around so that dynamic rule is not a problem.Probably yes, but it can possibly conflict with the other vpn, if it's the "route everything elsewhere" kind. If I remember correctly, it adds some dynamic rules, so maybe it's necessary to work around that in some way.
PPTP and IPsec servers are totally different and assigned IPs are very different too.Definitely yes, but without seeing the IPsec part, it is impossible to tell you what exactly overrides your policy routing setup. Most likely the IP address assigned to the PPTP tunnel matches to an IPsec policy, but it is not the only possibility. See my automatic signature below for further steps.
Thanks man I'm looking for a PPTP or L2TP solution.It's doable: viewtopic.php?t=169273
Wow, what an amount of creativity wasted (I have in mind the script moving your static masquerade rule before the one dynamically created by IPsec).My configurations:
/interface bridge
add name=bridge1
/interface ethernet
set [ find default-name=ether1 ] name=ether1-Uplink
set [ find default-name=ether2 ] arp=proxy-arp name=ether2-ToSwitch
set [ find default-name=ether3 ] name=ether3
set [ find default-name=ether4 ] name=ether4
/interface pppoe-client
add add-default-route=yes disabled=no interface=ether1-Uplink name=pppoe-out1 \
password=test user=test
/interface l2tp-server
add name=l2tp-in1 user=vpn
/ip ipsec proposal
set [ find default=yes ] auth-algorithms=sha256,sha1
/ip pool
add name=dhcp_pool0 ranges=192.168.5.2-192.168.5.254
add name=ppptp-pool ranges=192.168.50.1-192.168.50.10
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=bridge1 name=dhcp1
/ppp profile
add change-tcp-mss=yes dns-server=8.8.8.8,8.8.4.4 local-address=ppptp-pool \
name=pptp-profile remote-address=ppptp-pool use-encryption=yes
/interface bridge port
add bridge=bridge1 interface=ether4
add bridge=bridge1 interface=ether3
add bridge=bridge1 interface=wlan1
/ip neighbor discovery-settings
set discover-interface-list=ether2-swtich
/interface l2tp-server server
set enabled=yes ipsec-secret=secret use-ipsec=yes
/interface pptp-server server
set authentication=pap,chap,mschap1,mschap2 default-profile=pptp-profile
/ip address
add address=192.168.5.1/24 interface=bridge1 network=192.168.5.0
add address=10.1.10.10/24 interface=ether2-ToSwitch network=10.1.10.0
/ip dhcp-server network
add address=192.168.5.0/24 gateway=192.168.5.1
/ip dns
set servers=8.8.8.8
/ip firewall nat
add action=masquerade chain=srcnat src-address=192.168.5.0/24
add action=masquerade chain=srcnat out-interface=pppoe-out1 src-address=\
192.168.50.0/24
/ppp secret
add name=testvpn password=vpn profile=pptp-profile service=l2tp
My wild guess is that no routing is set at the SXT, hence it does not know that the route to 192.168.50.x (the L2TP clients) goes via 10.1.10.10.i cannot ping my sxt connected to ether2 of my mikrotik on site while i am connected l2tpvpn to the mikrotik.
Wow, what an amount of creativity wasted (I have in mind the script moving your static masquerade rule before the one dynamically created by IPsec).
but everything is working very goodyou'll replace the action=masquerade dst-address-list=excluded-addresses rule in nat/srcnat by an action=mark-connection new-connection-mark=avoid-ipsec dst-address-list=excluded-addresses rule in nat/prerouting and/or nat/output and retire the scheduled script.
This means the explanation may have been nice but actually it wasn't clear enough. So again.Thanks for the nice explanation
...
I made another scheduler for chain=srcnat PPTP_YD to keep it at #=1
...
I didn't change the action=masquerade dst-address-list=excluded-addresses cause I didn't understand this part completely.
If there is no rule in mangle/output (my way) or in nat/srcnat (your previous way) that would exempt the PPTP transport packets sent by the Mikrotik itself from being src-nated to match the dynamically generated IPsec policy, it means that the PPTP transport packets to the remote PPTP server are sent via the IPsec policy. So when the Security Association (SA) linked to that policy is down, but the policy itself still exists, the PPTP transport packets get nowhere, as the policy diverts them but cannot actually deliver them.when the IPSec is down PPTP is not connecting (if connected it will got terminating) when the "IPSec is killing ike2 SA" before it's get a "new ike2 SA (I)" for about 120 seconds PPTP is just trying to connect and if you remember I had a "IPsec-SA expired before finishing rekey" problem before you told me on another topic to set /ip ipsec proposal to pfs-group=none and it's fixed that "IPsec-SA expired before finishing rekey" problem but still there is "IPSec is killing ike2 SA" and I got a feeling this is a server configuration problem (Linux Ubuntu StrongSwan).
It indeed looks like some incompatibility between the initiator and the responder, or maybe it indicates a huge data loss causing the rekey procedure to fail, ot maybe it's the refresh of the "control SA" (the one the peers use to negotiate and control establishment of the SAs carrying the payload) that fails. To say more, I would have to see the logs from both peers, including about 5 minutes before the "killing ike2 SA" messages appear in the log.2. Is this normal to having "IPSec is killing ike2 SA"? It's not very frequent though it's like at three days once or every other day.
Thank you very much, I change it all and all those excluded-addresses is working great but if the dynamically added one is at top (#=0) then the PPTP one is not working in order to make that work I have to move it on top of that. Am I missing something?This means the explanation may have been nice but actually it wasn't clear enough. So again.
Thanks man this one got fixed totally.If there is no rule in mangle/output (my way) or in nat/srcnat (your previous way) that would exempt the PPTP transport packets sent by the Mikrotik itself from being src-nated to match the dynamically generated IPsec policy, it means that the PPTP transport packets to the remote PPTP server are sent via the IPsec policy. So when the Security Association (SA) linked to that policy is down, but the policy itself still exists, the PPTP transport packets get nowhere, as the policy diverts them but cannot actually deliver them.
I will try to clean and setup everything on the server side again to see if it's going to fix it.It indeed looks like some incompatibility between the initiator and the responder, or maybe it indicates a huge data loss causing the rekey procedure to fail, ot maybe it's the refresh of the "control SA" (the one the peers use to negotiate and control establishment of the SAs carrying the payload) that fails. To say more, I would have to see the logs from both peers, including about 5 minutes before the "killing ike2 SA" messages appear in the log.
You only add a routing-mark, not connection-mark, in mangle/prerouting for src-address=192.168.11.94.if the dynamically added one is at top (#=0) then the PPTP one is not working in order to make that work I have to move it on top of that. Am I missing something?
Since it doesn't happen regularly, I doubt it is a plain configuration issue, rather a timing issue in one of the the protocol stack or packet loss. But audit of configuration is never harmfulI will try to clean and setup everything on the server side again to see if it's going to fix it.
Thanks man./ip firewall mangle
add chain=prerouting connection-state=new action=jump jump-target=mark-connections-prerouting
add chain=prerouting connection-mark=PPTP_YD_GAMING50 action=mark-routing new-routing-mark=PPTP_YD_GAMING50 passthrough=no
add chain=mark-connections-prerouting dst-address-list=excluded-addresses action=mark-connection new-connection-mark=avoid-ipsec passthrough=yes comment="for excluded-addresses bypassing the IPsec IKEV2 OVH20"
add chain=mark-connections-prerouting src-address=192.168.11.94 connection-mark=no-mark action=mark-connection new-connection-mark=PPTP_YD_GAMING50 passthrough=yes comment=PPTP_YD_GAMING50
I'm sorry I think I don't understand what should I do.In your rules, the jump-target in the first rule is mark-connections-prerouting, whereas the last two rules are in chain mark-connections. Unify that one way or the other. Currently, both functionalities that depend on connection-mark should not work as no connection marks are assigned due to this difference.
Yeah it's disabled.Is the action=fasttrack-connection rule in filter disabled?
nothingSo what does /ip firewall mangle print chain=output say?
I'm sorry I forgot this chain=output one./ip firewall mangle
add action=mark-connection chain=output dst-address-list=excluded-addresses new-connection-mark=avoid-ipsec passthrough=yes
add action=mark-connection chain=output dst-address-list=excluded-addresses new-connection-mark=\
avoid-ipsec passthrough=yes
add action=jump chain=prerouting connection-state=new jump-target=mark-connections-prerouting
add action=mark-routing chain=prerouting connection-mark=PPTP_YD_GAMING50 new-routing-mark=\
PPTP_YD_GAMING50 passthrough=no src-address=192.168.11.94
add action=mark-connection chain=mark-connections-prerouting comment=\
"for excluded-addresses bypassing the IPsec IKEV2 OVH20" dst-address-list=excluded-addresses \
new-connection-mark=avoid-ipsec passthrough=yes
add action=mark-connection chain=mark-connections-prerouting comment=PPTP_YD_GAMING50 connection-mark=\
no-mark new-connection-mark=PPTP_YD_GAMING50 passthrough=yes src-address=192.168.11.94
So once you add the mangle/output rule above and establish both the PPTP and the IPsec, I'd like to see the output of
/ip firewall connection print detail where dst-address~"ip.of.the.pptp.server"
Results with this mangle :Then, while pinging 9.9.9.9 from 192.168.11.95, run another command:
/ip firewall connection print detail where src-address~"192.168.11.94" dst-address~"9.9.9.9"
add action=mark-connection chain=output dst-address-list=excluded-addresses new-connection-mark=\
avoid-ipsec passthrough=yes
add action=jump chain=prerouting connection-state=new jump-target=mark-connections-prerouting
add action=mark-routing chain=prerouting connection-mark=PPTP_YD_GAMING50 new-routing-mark=\
PPTP_YD_GAMING50 passthrough=no
add action=mark-connection chain=mark-connections-prerouting comment=\
"for excluded-addresses bypassing the IPsec IKEV2 OVH20" dst-address-list=excluded-addresses \
new-connection-mark=avoid-ipsec passthrough=yes
add action=mark-connection chain=mark-connections-prerouting comment=PPTP_YD_GAMING50 connection-mark=\
no-mark new-connection-mark=PPTP_YD_GAMING50 passthrough=yes src-address=192.168.11.94
So once you add the mangle/output rule above and establish both the PPTP and the IPsec, I'd like to see the output of
/ip firewall connection print detail where dst-address~"ip.of.the.pptp.server"
Difference is that in the first one action=mark-routing rule have src-address=192.168.11.94 but in second one don't.Then, while pinging 9.9.9.9 from 192.168.11.95, run another command:
/ip firewall connection print detail where src-address~"192.168.11.94" dst-address~"9.9.9.9"
Rules in chain output are only used for traffic originating on the Mikrotik itself; when you "visit sites", I assume you visit them from a PC, and traffic from PC to internet takes chains forward and prerouting (other ones as well, but not output).I'm sorry I forgot this chain=output one./ip firewall mangle
add action=mark-connection chain=output dst-address-list=excluded-addresses new-connection-mark=avoid-ipsec passthrough=yes
but it's never had a packet even I was visiting sites which are listed in "excluded-addresses" list:
I supposed that the address of the PPTP server is on the excluded-addresses list. But it either isn't or the mangle/output rule is wrong. Or maybe you actually want the PPTP transport packets to be sent to the server via the IPsec VPN? What's the intention?Thanks man this one got fixed totally.If there is no rule in mangle/output (my way) or in nat/srcnat (your previous way) that would exempt the PPTP transport packets sent by the Mikrotik itself from being src-nated to match the dynamically generated IPsec policy, it means that the PPTP transport packets to the remote PPTP server are sent via the IPsec policy.
Got it thanks.Rules in chain output are only used for traffic originating on the Mikrotik itself; when you "visit sites", I assume you visit them from a PC, and traffic from PC to internet takes chains forward and prerouting (other ones as well, but not output).
Yeah exactly the IP of the PPTP server is not on that list so I added another chain output: add action=mark-connection chain=output connection-state=new disabled=yes dst-address="ip.of.the.pptp.server" \As you wroteI supposed that the address of the PPTP server is on the excluded-addresses list. But it either isn't or the mangle/output rule is wrong. Or maybe you actually want the PPTP transport packets to be sent to the server via the IPsec VPN? What's the intention?
Thanks man this one got fixed totally.
It worked and I can ping but can not open websites or they are very slow.Regarding the need to add src-address=192.168.11.94 to the action=mark-routing rule in order to make it work, it smells like a bug to me. What happens if you replace the address to get src-address=128.0.0.0/1 in the rule and try to ping again?
PPTP is definitely not secure by nowaday's measures, so not only to hide the fact that it is PPTP from the ISP but also to cipher the payload by a contemporary encryption algorithm you need an external encryption (like IPsec). Plus PPTP has also other limitations, so better to use L2TP/IPsec or bare IPsec, depending on the server capabilities.Is it better to send PPTP transport packets via the IPsec VPN (in this way ISP is just see IPsec not the PPTP, right?) or not? in terms of security and performance?
I started writing an explanation why I suspect it is a bug and how to check that, and during that writing I've realized what is the actual issue. So remove the src-address=128.0.0.0/1 from the action=mark-routing rule and instead place in-interface-list=LAN to it. What was happening was that packets that arrived from the PPTP tunnel were getting the routing-mark too, and since there is only a defaut route in the routing table PPTP_YD_GAMING50, they got routed out the tunnel again rather than to the LAN host. The 9.9.9.9 doesn't fit into 128.0.0.0/1, so the src-address=128.0.0.0/1 prevented the responses from there from being misrouted, but the in-interface-list=LAN is one of several proper solutions.It worked and I can ping but can not open websites or they are very slow.
Thanks a lot man, all working just fine now and in fact I change PPTP to L2TP/IPsec. I really appreciate all your effort and guidance.I started writing an explanation why I suspect it is a bug and how to check that, and during that writing I've realized what is the actual issue. So remove the src-address=128.0.0.0/1 from the action=mark-routing rule and instead place in-interface-list=LAN to it.