Thanks man, The server got static IP but not the client is this a same situation as your first given link?Maybe something like this?
Thank you, but how to set it up for IKEV2?yes, I think you could activate DDNS
https://wiki.mikrotik.com/wiki/Manual:IP/Cloud
/ip cloud set ddns-enabled=yes
and then use the dns-name instead of static IP
Yeah one of them got static ip (server one) but IDK how to set them up for IKEV2, So I would highly appreciate a guide or link to a guide for that.If you've got a static public IP at at least one peer, just make that one a responder only (passive=yes) and that's it. You only need to use dynamic DNS if none of the peers has a static public IP. And if none of them has a public IP, not even a dynamic one, it's yet another challenge which may or may not be resolved using dynamic DNS, depending on the behaviour of the NAT devices between each peer and the internet.
Thanks man, I will try this one as well. Is using passive=yes address=0.0.0.0/0 in the peer properties is safe?Set them exactly as you would if both had a static public IP, using the site to site example from the manual, but set passive=yes address=0.0.0.0/0 in the peer properties at the one with static IP. And set exchange-mode to ike2 rather than main at both. That's all.
Can you link me a guide or manual in beginners level cause I couldn't understand the manual which mikrotik provided.The safer authentification method you use, the less you have to care about the address of the remote peer. With properly generated certificates (CSR generated at the device that will use the certificate to authentify itself to others, signing the CSR by a CA, and importing the signed certificate to the device, so that the private key to the certificate never leaves the device), it's cheaper to bribe a coworker than to break the IPsec security. With a pre-shared secret, if you use a long, randomly generated one, and do not deliver it to the remote device via an open channel, you are still quite safe. Linking the peer to a particular IP or subnet is actually the least safe way, as the IP of the peer can be easily spoofed by a "man in the middle" - anyone controling a router anywhere on the network path between your two peers.
@sindy @erkexzcx
I've done this but no change. maybe Scr or Dst IPs are wrong or maybe it's because the client is connected to a router or server is belind the NATSo I'd say set template=yes for the policy at both devices (which will make the peer and tunnel properties irrelevant) and you should be good - both peers will generate the policy from this template.
On both side now I set it to my group but no change.The group value default is wrong at both, unless you've changed also the policy template group on the identity row to default. According to the configurations you've posted, it should be My group
NAT as such doesn't constitute a problem if there is sufficient port-forwarding (UDP port 4500) at all the routers between the internet and the responder (server).
On the server, run /tool sniffer quick port=4500 while trying to connect from the client. If you can see something to come, the port forwading outside the Mikrotik works fine.How can I check if (UDP port 4500) is open I both side? cause on my client I cannot connect with L2TP to server
Thanks man, but it didn't show anything. After and before adding the firewall rules the results are the same.On the server, run /tool sniffer quick port=4500 while trying to connect from the client. If you can see something to come, the port forwading outside the Mikrotik works fine.
After I added those firewall rules on both side (on the server side there was no WAN in the in-interface-list so I set it to all) there was no change for IPsec IKEV2 or even L2TP.Since I've noticed a configured L2TP with IPsec at the server side, I didn't dive deep into your firewall rules, assuming that whoever wants to set up any kind of VPN should understand how firewalls work first, but now as I look at your rules, there indeed is no rule in chain input of filter that would permit incoming connections to UDP ports 500 and 4500. So add, just before the last action=drop rule in chain input, the following two rules:
chain=input in-interface-list=WAN protocol=udp dst-port=500,4500 action=accept
chain=input in-interface-list=WAN protocol=udp dst-port=1701 ipsec-policy=in,ipsec action=accept
Well I don't know and the guy setup the client (home) and the server (he is the owner(I got the server for 1 month to see if it's any good for sha512 IPsec IKEV2 (he supposed to setup that but since I didn't had the static IP on the client side he refused and said find a way and do it yourself. so here I am ))) and another router in other place, so if there is anything wrong with the firewall and the settings and configurations or there are leaks to fix I would highly appreciate it if you tell me how to fix them.Since I've noticed a configured L2TP with IPsec at the server side, I didn't dive deep into your firewall rules, assuming that whoever wants to set up any kind of VPN should understand how firewalls work first.
About the server side I don't know about the client (home) there is just a TD LTE modem with default settings from ISP (the modem is locked) about my another router which is connected to a ADSL modem (bridge) also with default settings on the modem.Your firewall rules at the initiator side are really leaky, but I assume there is a firewall on the outer router (the one between that Mikrotik and the internet), am I right?
I know I thought since I had problem with that bringing that up might help with the actual topic of the subject.OK, the title says IKEv2 but we've silently moved to L2TP.
Okay I tried it but it shows nothing and then I thought okay what if I try with L2TP again and it shows this things so maybe this is telling us that port forwarding is correct and for some reasons IKEv2 is not initiating from client. is there anything I should've enabled in order for it to initiate? are Src Address & Dst Address are correctly set?OK, the title says IKEv2 but we've silently moved to L2TP. Never mind, just run /tool sniffer quick port=500 on the server, and try connecting from the client. If it shows nothing, the problem is not in the server-side Mikrotik but most likely on the router(s?) standing between that Mikrotik and the internet, where the port forwarding is not configured at all or is configured incorrectly. Another possibility is that you're connecting to a wrong address.
Since the client side is LTE, chances are close to zero you could use pinhole punching to create the "port forwarding" rules dynamically.
So until you manage to set the port forwarding properly, it won't work.
yeah it's 5.xxx.xxx.xxx but on Route List you can see it's also connected to a xx.xx.xx.xx which is a public IP as wellNow wait - the server has a public IP on itself after all? If so, no port-forwarding is necessary at its side. Sorry, too many similar topics.
L2TP client should send packets to port 500 on the server's address; IKEv2 initiator should send packets to port 4500. Both should be shown by the sniffer.
You don't need to set any port forwarding on the client side. Show me /ip firewall filter export from the server, please.
It's on VMwareOK, so I have swapped the roles of the routers when checking the configurations, and the one without a firewall is actually the server one, with the public IP directly on itself. Great. The right thing to do would be to disconnect it from the internet, netinstall it with the default configuration, restore the export there line by line but leaving out the firewall, except if the router is one of the higher models where no firewall is present in the default configuration. If that's the case, you have to create the minimum set of firewall rules first, before connecting it to internet again. And never use any of the passwords used before the netinstall again. The filth from the net is incredibly fast in squatting in if it could collect the credentials using the vulnerability in older RouterOS versions.
Nevertheless, in such a case, if you enable the IKEv2 peer and the identity associated to it on the client, you should see packets to arrive to 5.x.x.x:4500 if you run /tool sniffer quick port=4500. If you don't, something is rotten somewhere outside the server side router.
It may take some time between retries, so sniff for at least two minutes before declaring it a fail.
right now when I run /tool sniffer quick port=4500 on both side I got only sends on client but nothing on server side. I'm worried maybe I should use the other public IP (the one server itself connected to) or different LAN IPs.Nevertheless, in such a case, if you enable the IKEv2 peer and the identity associated to it on the client, you should see packets to arrive to 5.x.x.x:4500 if you run /tool sniffer quick port=4500. If you don't, something is rotten somewhere outside the server side router.
If it's on a VMware you can manage, just delete the VM and deploy it again from the template, but do not connect the internet-facing interface before you set up the basic firewall rules:Should I tell the guy for netinstall or just do it myself, I mean cause it's on the vmware after resetting am I gonna be able to access it?
No all I got is winbox accessIf it's on a VMware you can manage, just delete the VM and deploy it again from the template, but do not connect the internet-facing interface before you set up the basic firewall rules:Should I tell the guy for netinstall or just do it myself, I mean cause it's on the vmware after resetting am I gonna be able to access it?
/interface list
add name=WAN
/interface list member
add list=WAN interface=ether1
/ip firewall filter
add chain=input connection-state=established,related action=accept
add chain=input connection-state=invalid action=drop
add chain=input protocol=icmp action=accept
add chain=input in-interface-list=WAN protocol=udp dst-port=500,4500 action=accept
add chain=input in-interface-list=WAN protocol=udp dst-port=1701 ipsec-policy=in,ipsec action=accept
add chain=input in-interface-list=WAN action=drop
No rules in chain forward as you seem not to use it as an actual router so far.
On the other hand, if the goal is to test sha512, why don't you deploy two CHRs on it and let them establish an IPsec tunnel to each other? It will definitely be a better througphut test than via some LTE overseas...
YesWhen you enable the peer & identity at the client and run the same /tool sniffer quick port=4500 on it, can you see the attempts there?
I managed to screw the server firewall rules so it's not accessible anymore. gonna give that guy a call to reset or fix it. then I will try this. Thanks for all the help man, I really appreciate it.Okay... let's do another thing then, set the port parameter on the /ip ipsec peer row at the client to 500, and sniff at both the server and the client with port=500 (still with IKEv2, not L2TP/IPsec). What's the result?