Presentation 7168 1572420263
Presentation 7168 1572420263
Presentation 7168 1572420263
MTCRE 95%
MTCUME 90%
Certified network engineer
MikroTik PRO, Russia MTCSE 94%
MTCIPv6E 74%
Find me in Facebook:
Nikita Tarikin
Telegram t.me/tarikin
Messenger Nikita Tarikin
Protocol UDP UDP over UDP/ESP TCP GRE TCP UDP, ESP
Connection
Medium Slow Slow Medium Medium Very fast
establishment
Requires strong
CPU for No Yes Yes No Yes Yes
encryption
Multicore CPU
Yes Yes No Yes Yes Yes
load balance
Nikita
Nikita Tarikin / [email protected]
Network diagram
RouterOS VPN
Router
https://mum.mikrotik.com/2019/MY/agenda/EN#475_7008
Nikita Tarikin / [email protected]
Network diagram
Internet
ISP NAT
HQ Office
Branch office
Nikita
Nikita Tarikin / [email protected]
Before you 1. MTCNA knowledge (recommended)
2. RouterOS 6.45 or newer
start 3. Lab environment (recommended)
4. Default configuration 6.45+
Nikita
Nikita Tarikin / [email protected]
Upgrade RouterOS to 6.45+
settings 2.
3.
Timezone
Date/time via NTP
4. Loopback bridge
5. IP pool
Nikita
Nikita Tarikin / [email protected]
WAN IP and DNS addresses for IKE2 VPN server
Nikita
Nikita Tarikin / [email protected]
Generate CA SSL certificate
/certificate sign
[email protected] ca=CA.ike2.xyz
/certificate export-certificate
[email protected] type=pkcs12
export-passphrase=keepinsecret
/certificate
export-certificate CA.ike2.xyz
type=pem
IPSec 6.
7.
Setup Policy Template
Setup Identities
Nikita
Nikita Tarikin / [email protected]
What's new in 6.44
*) ipsec - added account log message when user is successfully *) ike2 - added option to specify certificate chain;
authenticated; *) ike2 - added peer identity validation for RSA auth (disabled after
*) ipsec - added basic pre-shared-key strength checks; upgrade);
*) ipsec - added new "remote-id" peer matcher; *) ike2 - allow to match responder peer by "my-id=fqdn" field;
*) ipsec - allow to specify single address instead of IP pool under *) ike2 - fixed local address lookup when initiating new connection;
"mode-config"; *) ike2 - improved subsequent phase 2 initialization when no childs
*) ipsec - fixed active connection killing when changing peer exist;
configuration; *) ike2 - properly handle certificates with empty "Subject";
*) ipsec - fixed all policies not getting installed after startup (introduced *) ike2 - retry RSA signature validation with deduced digest from
in v6.43.8); certificate;
*) ipsec - fixed stability issues after changing peer configuration *) ike2 - send split networks over DHCP (option 249) to Windows
(introduced in v6.43); initiators if DHCP Inform is received;
*) ipsec - hide empty prefixes on "peer" menu; *) ike2 - show weak pre-shared-key warning;
*) ipsec - improved invalid policy handling when a valid policy is
uninstalled;
*) ipsec - made dynamic "src-nat" rule more specific;
*) ipsec - made peers autosort themselves based on reachability status;
*) ipsec - moved "profile" menu outside "peer" menu;
*) ipsec - properly detect AES-NI extension as hardware AEAD;
*) ipsec - removed limitation that allowed only single "auth-method"
with the same "exchange-mode" as responder;
*) ipsec - require write policy for key generation;
Nikita Tarikin / [email protected]
Key ipsec changes in RouterOS 6.44
After 6.44
[email protected] generate-
7. Carefully assembling IPSec identities for each client
[email protected] generate-
123.45.67.8" policy-template-group="group
vpn.ike2.xyz" remote-id=user-
fqdn:[email protected]
[email protected] generate-policy=port-strict
match-by=certificate mode-config="modeconf
fqdn:[email protected]
UT
UT
P
TP
IN
OU
src-nat
D
AR
RW
EMPTY FIRELWALL = ALLOW ALL 123.45.67.8/24
FO
RouterOS Router
OUTPUT
192.168.88.1/24
PUT
IN
LAN
192.168.88.0/24
Setting up Accept
D
Drop AR
Firewall FO
RW
ICMP
UT
UT
DST-NAT
P
TP
IN
OU
src-nat
D
AR
RW
123.45.67.8/24
FO
1. Default firewall RouterOS Router
overview OUTPUT
192.168.88.1/24
UT
2. Allow IPSec IN
P
LAN
192.168.88.0/24
Nikita
Nikita Tarikin / [email protected]
Allow IPSec WAN
Setting up
Firewall INPUT:
+ IPSec-esp
+ UDP 500
UT
+ UDP 4500
P
src-nat
IN
123.45.67.8/24
1. Default firewall RouterOS Router
overview
192.168.88.1/24
2. Allow IPSec
LAN
192.168.88.0/24
Nikita
Nikita Tarikin / [email protected]
Firewall filter rules for IPSec packets (defconf)
INPUT chain
+ UDP 500
+ UDP 4500
dynamic private IP
LTE
🔌 Client 🎯 Server
Nikita Tarikin / [email protected]
Setting up client RouterOS 🔌
🎯 Server 🔌 Client
Active peers
state: established
Dynamic Active(DA)
IPSec policy
generated from
Template (T)
PH2 state:
established
Peer: authorized
Address: acquired
IP address 10.0.88.254
Interface ether1
WAN
10.0.88.254
(dynamic) NAT
NAT
Office-01 HQ office
IKEv2
VPN
10.0.88.254
(dynamic)
LAN HQ
192.168.88.0/24
Option 1 (easy)
<interface> over ipsec ike2
Cons:
Decreased MTU due to extra Takes longer
encapsulation overhead to connect and
reconnect
Don
’t
to for
<EoIP> a
tra llow
ffi
get
thi
the c o s
n
(bo firew
<IPIP> th a
sid ll
es)
<GRE>
192.168.199.0/24 192.168.88.0/24
10.0.88.3
/ip ipsec add
name="modeconf [email protected]"
address=10.0.88.3 address-prefix-
length=32 split-
include=0.0.0.0/0 system-dns=no
IP address 10.0.88.3
Interface ether1
10.0.88.3
Dynamic private
WAN IP
<gre,ipip,eoip>
192.168.199.0/24 192.168.88.0/24
🔌 Client 🎯 Server
<ipip>
🔌 Client 🎯 Server
Option 2 (advanced)
100% policy based ipsec ike2
IPSec policy
192.168.199.0/24 192.168.88.0/24
192.168.88.0/24
192.168.199.0/24
/ip ipsec policy
add peer="peer vpn.ike2.xyz" src-
address=192.168.199.0/24 dst-
address=192.168.88.0/24 proposal="pro
posal vpn.ike2.xyz" tunnel=yes level=
unique
192.168.199.0/24
192.168.88.0/24
/ip ipsec policy
add peer="peer vpn.ike2.xyz" src-
address=192.168.199.0/24 dst-
address=192.168.88.0/24 tunnel=yes
proposal="proposal vpn.ike2.xyz"
🔌 Client 🎯 Server
IPSec policy
192.168.199.0/24 192.168.88.0/24
/ip firewall mangle add action=change-
mss chain=forward new-mss=1360 src-
address=192.168.88.0/24 dst-
address=192.168.199.0/24 protocol=tcp t
cp-flags=syn tcp-mss=!0-1360 ipsec-
policy=in,ipsec passthrough=yes comment
="IKE2: Clamp TCP MSS from office-
main to office-01"
/ip firewall mangle add action=change-
mss chain=forward new-mss=1360 src-
address=192.168.199.0/24 dst-
address=192.168.88.0/24 protocol=tcp tc
p-flags=syn tcp-mss=!0-1360 ipsec-
policy=in,ipsec passthrough=yes comment
="IKE2: Clamp TCP MSS from office-01 to
office-main"
Nikita
Nikita Tarikin / [email protected]
Demo lab 1. Request certificate via form
2. Receive certificates
Free live demo is 3. Connect to VPN server
available 4. Access via Winbox
Nikita
Nikita Tarikin / [email protected]
Request your certificate via form
https://forms.gle/TTmKeHe8W2u9YZ3c7
Demo lab
1. Request certificate
via form
2. Receive certificates
3. Connect to VPN
server
4. Access via Winbox
Nikita
Nikita Tarikin / [email protected]
Demo lab
Wait for your certificate
1. Request certificate via Manual processing for this LAB, sorry :)
form
2. Receive certificates
3. Connect to VPN
server
4. Access via Winbox
Nikita
Nikita Tarikin / [email protected]
IKE2 VPN Server address
Demo lab
vpn.ike2.xyz
1. Request certificate via
form
2. Receive certificates
3. Connect to VPN
server
4. Access via Winbox
Nikita
Nikita Tarikin / [email protected]
Demo lab Access LAB router via Winbox
Address
1. Request certificate via 10.0.88.1
form
Login lab
2. Receive certificates
Password lab
3. Connect to VPN
server
4. Access via Winbox
Nikita
Nikita Tarikin / [email protected]
Hack me
if you
c
💋
an
IPSec quiz time!
“ Hack the princess ”
Will be open until 31 December 2019
10.0.88.2 10.0.88.1
Филиал vpn.ike2.xyz
IKEv2
VPN
192.168.88.0/24
192.168.XX.0/24
💋 Winbox, SSH
192.168.XX.YY
/system identity ???
192.168.XX.0/24
😎💋 192.168.XX.YY
Find me in Facebook:
Nikita Tarikin
Telegram t.me/tarikin
Messenger Nikita Tarikin