MTCSE
MTCSE
(MTCSE)
Guayaquil, Ecuador
Mayo 13 - 14, 2019
Agenda
2
INTRODUCE
YOURSELF
3
Presentación Personal
4
LAB SETUP
5
Laboratorio Inicial
SSID : AP-MTCSE
KEY : MikroTikLab
AP
R1 R2 Rn
Conexión Inalámbrica
Conexión Cableada
6
INTRODUCCIÓN A LA
SEGURIDAD
7
¿De qué trata la seguridad?
8
¿De qué trata la seguridad?
9
Ataques de Seguridad, Mecanismos & Servicios
10
Amenazas de Seguridad / Ataques
FLUJO NORMAL
Fuente de Destino de
Información Información
11
Amenazas de Seguridad / Ataques
INTERRUPCIÓN
Fuente de Destino de
Información Información
12
Amenazas de Seguridad / Ataques
INTERCEPCIÓN
Fuente de Destino de
Información Información
Atacante
“Un sujeto no autorizado ha obtenido acceso a un objeto, para robar datos y/o
escuchar a otros en la comunicación, etc.”
13
Amenazas de Seguridad / Ataques
MODIFICACIÓN
Fuente de Destino de
Información Información
Atacante
14
Amenazas de Seguridad / Ataques
FABRICACIÓN
Fuente de Destino de
Información Información
Atacante
“Se generan datos o actividades que normalmente no existían, como agregar una
contraseña a un sistema, reproducir mensajes enviados anteriormente, etc.”
15
Tipos de Amenazas / Ataques
Interrupción
Ataques / Amenazas
Modificación
Activos
Ataques / Amenazas
Intercepción
Pasivos
16
Mecanismos de Seguridad
17
AMENAZAS COMUNES
18
Amenazas comunes de seguridad
Botnet
“Colección de robots de software, o bots que crean un
ejército de computadoras infectadas (conocidas como zombies)
que son controladas remotamente por el creador”
19
Amenazas comunes de seguridad
20
Amenazas comunes de seguridad
Hackear
“Hackear es un término usado para describir las
acciones tomadas por alguien par obtener acceso no autorizado a
una computadora o sistema.”
21
Amenazas comunes de seguridad
Malware
“Malware es una de las formas más comunes de infiltrarse
o dañar su computadora, es un software que infecta su
computadora, como virus, gusanos, caballos de troya, spyware y
adware.”
22
Amenazas comunes de seguridad
23
Amenazas comunes de seguridad
Ransomware
“Ransomware es un tipo de malware que restringe el
acceso a su computadora o sus archivos y muestra un mensaje que
exige pago para que se elimine la restricción.”
24
Amenazas comunes de seguridad
Spam
“El Spam es uno de los métodos más comunes para enviar y
recopilar información de personas confiadas.”
25
Amenazas comunes de seguridad
Falsificación (Spoofing)
“Esta técnica se usa a menudo junto con el Phishing en
un intento de robar su información.”
26
Amenazas comunes de seguridad
27
Amenazas comunes de seguridad
Caballo de Troya
“Un programa malicioso que está disfrazado como, o
incrustado dentro, de software legítimo. Es un archivo ejecutable que se
instalará y ejecutará automáticamente una vez que se descargue.”
28
Amenazas comunes de seguridad
Virus
“Programas informáticos maliciosos que a menudo se envían
como un archivo adjunto de correo electrónico o una descarga con la
intención de infectar su computadora.”
29
Amenazas comunes de seguridad
Worm
“Un gusano, a diferencia de un virus, va a trabajar solo
sin adjuntarse a los archivos o programas. Vive en la memoria de
su computadora, no daña ni altera el disco duro y se propaga al
enviarse a otras computadoras en una red.”
30
DESPLIEGUE DE SEGURIDAD
CON MIKROTIK
31
Router MikroTik: Firewall Principal
DATA CENTER
OFICINAS
INTERNET
INVITADOS
32
Router MikroTik: Firewall Principal
Ventajas
• Topología simple.
• Fácil de administrar.
'
Desventajas
• Concentrarse en un único punto de falla.
• Demanda altos recursos.
33
Router MikroTik: Firewall Dedicado
DATA CENTER
OFICINAS
INTERNET
INVITADOS
34
Router MikroTik: Firewall Dedicado
Ventajas
• Menor consumo de recursos en cada router.
• Seguridad enfocada en cada red.
Desventajas
• Diferentes segmentos de red, diferentes tratamientos.
• Necesidad de configurar un Firewall diferente en cada router.
• Posibilidad de configurar reglas de Firewall dobles en los
otros routers.
35
Router MikroTik como IPS
DATA CENTER
OFICINAS
INTERNET
INVITADOS
36
Router MikroTik como IPS
Ventajas
• Limpiar todas las configuraciones de Firewall en el router,
porque todas las configuraciones ya están definidas en el IPS.
Desventajas
• Necesita un dispositivo de alto recurso en MikroTik como IPS.
37
Router MikroTik con IDS (Trigger)
DATA CENTER
OFICINAS
INTERNET
IDS SERVER
INVITADOS
38
Router MikroTik con IDS (Trigger)
Ventajas
• Todas las reglas de Firewall son creadas automáticamente por
el API desde el servidor IDS.
Desventajas
• Necesita un dispositivo adicional como disparador del tráfico
malo.
• Necesita un dispositivo potente para reflejar todo el tráfico de
las redes.
• Necesita scripts especiales para enviar información al router.
• Costoso
39
ATAQUES A LAS CAPAS
DEL MODELO OSI
40
Protocolo MikroTik Neighbor Discovery
41
Ataque MNDP
42
Ataque MNDP
43
Ataque MNDP
44
Prevención: Ataque MNDP
45
Prevención: Ataque MNDP
46
Prevención: Ataque MNDP
47
Ataque DHCP Starvation
48
Ataque DHCP Starvation
49
Ataque DHCP Starvation
50
Prevención: Ataque DHCP Starvation
port-security
Router max 1 MAC
port-security
max 1 MAC
51
Servidor DHCP Falso (Rogue)
52
Servidor DHCP Falso (Rogue)
53
Servidor DHCP Falso (Rogue)
54
Prevención: DHCP Falso (Rogue)
• Habilitar DHCP Snooping en el Swtich.
• Configurar el puerto del router como “DHCP Snooping Trusted”
• Direcciones IP y MAC de clientes conocidos.
• La alerta DHCP de RouterOS solo envía información, no
detiene o evita un ataque.
DHCP Snooping enabled
[Link]
55
Ataque TCP SYN
SYN
SYN-ACK
56
Ataque TCP SYN
57
Ataque TCP SYN
58
Ataque TCP SYN
• “IP > Firewall > Connections” por favor observar los paquetes
“syn sent” desde direcciones de origen aleatorias.
59
Ataque TCP SYN
60
Ataque TCP SYN
61
Prevención: Ataque TCP SYN
62
Prevención: Ataque TCP SYN
63
Prevención: Ataque TCP SYN
64
Ataque TCP SYN
65
Preventing TCP SYN Attack
66
Ataque: UDP Flood
67
Ataque: UDP Flood
68
Ataque: UDP Flood
69
Ataque: UDP Flood
• “IP > Firewall > Connections” por favor observar los paquetes
“udp” desde direcciones de origen aleatorias.
70
Ataque: UDP Flood
71
Ataque: UDP Flood
72
Prevención: Ataque UDP Flood
73
Prevención: Ataque UDP Flood
74
Prevención: Ataque UDP Flood
75
Prevención: Ataque UDP Flood
76
Ataque: ICMP Smurf
77
Ataque: ICMP Smurf
78
Ataque: ICMP Smurf
79
Ataque: ICMP Smurf
80
Ataque: ICMP Smurf
81
Prevención: Ataque ICMP Smurf
82
Prevención: Ataque ICMP Smurf
83
Ataque: Contraseñas por Fuerza Bruta
84
Ataque: Contraseñas por Fuerza Bruta
85
Ataque: Contraseñas por Fuerza Bruta
86
Prevención: Ataque de fuerza bruta
87
Prevención: Ataque de fuerza bruta
88
Prevención: Ataque de fuerza bruta
89
Detección de Escaneo de Puertos
90
Detección de Escaneo de Puertos
91
Prevención: Escaneo de Puertos
92
Prevención: Escaneo de Puertos
93
ASEGURANDO TU
ROUTER
94
PORT KNOCKING
95
Qué es Port Knocking
96
Cómo funciona: Port Knocking
97
Cómo funciona: Port Knocking
98
Cómo funciona: Port Knocking
99
CONEXIONES
SEGURAS
100
Qué es una conexión segura
101
Certificados Auto-Firmados
102
Certificados Auto-Firmados
103
Certificados Auto-Firmados
104
Certificados Válidos Gratuitos
105
Certificados Válidos Gratuitos
106
PUERTOS POR
DEFECTO PARA
LOS SERVICIOS
107
Puertos por Defecto para Servicios
108
Puertos por Defecto para Servicios
NB: Obscurity is not security - you should also use firewall rules
109
TUNNELING A
TRAVÉS DE SSH
110
Qué es Túnel SSH
111
Cómo funciona SSH ?
112
Configurando un Túnel SSH
113
Configurando un Túnel SSH
114
FIREWAL
CON ESTADOS
115
RouterOS implementa un firewall con estado.
Un firewall con estado es un firewall capaz de
rastrear conexiones ICMP, UDP y TCP.
116
Connection Tracking
117
Connection Tracking
118
Connection Tracking
119
Laboratorio: ICMP Tracking
/interface ethernet
set [ find default-name=ether1 ] comment="To Internet"
name=ether1-internet
set [ find default-name=ether2 ] comment="To Lan" name=ether2-Lan
/ip pool
add name=dhcp_pool0 ranges=[Link]-[Link]
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=ether2-Lan
name=dhcp1
120
Laboratorio: ICMP Tracking
/ip address
add address=[Link]/24 interface=ether2-Lan network=[Link]
/ip dhcp-client
add dhcp-options=hostname,clientid disabled=no interface=ether1-
internet
/system identity
set name=R1
121
Laboratorio: ICMP Tracking
122
Laboratorio: ICMP Tracking
123
Laboratorio: ICMP Tracking
124
Laboratorio: ICMP Tracking
125
Laboratorio: ICMP Tracking
126
Laboratorio: ICMP Tracking
127
Laboratorio: ICMP Tracking
128
Laboratorio: ICMP Tracking
129
Laboratorio: ICMP Tracking
130
Laboratorio: ICMP Tracking
131
Laboratorio: Áreas Seguras
132
Laboratorio: Áreas Seguras
/interface bridge
add fast-forward=no name=Lan
/interface ethernet
set [ find default-name=ether1 ] name=E1-ToInternet
/interface list
add name=WAN
add name=LAN
133
Laboratorio: Áreas Seguras
/ip pool
add name=dhcp_pool0 ranges=[Link]-[Link]
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=Lan name=dhcp1
134
Laboratorio: Áreas Seguras
/ip address
add address=[Link]/24 interface=Lan network=[Link]
/ip dhcp-client
add dhcp-options=hostname,clientid disabled=no interface=E1-
ToInternet
/system identity
set name=R1
135
FLUJO DE
PAQUETES
136
Flujo de Paquetes
137
Flujo de Paquetes
138
Flujo de Paquetes
139
Flujo de Paquetes
140
Flujo de Paquetes
141
TABLA
RAW
142
Tabla RAW
143
Tabla RAW: Chains
144
Tabla RAW
145
Tabla RAW: Paquetes Descartados
146
Tabla RAW: Paquetes Descartados
147
Tabla RAW: Ataque Synflood
148
Tabla RAW: Ataque Synflood
149
Tabla RAW: Ataque Synflood
150
Tabla RAW: Ataque Synflood
151
Tabla RAW: Ataque Synflood
Pruébalo en tu router!
152
DEFAULT
CONFIGURATION
153
MikroTik Default Configuration
• All RouterBOARDs from factory come with a default configuration.
There are several different configurations depending on the board
type:
• CPE router
• LTE CPE AP router
• AP router (single or dual band)
• PTP Bridge (AP or CPE)
• WISP Bridge (AP in ap_bridge mode)
• Switch
• IP only
• CAP (Controlled Access Point)
• When should you remove the default-configuration and set up the
router from scratch?
154
CPE Router
• In this type of configurations router is configured as wireless client
device.
• WAN interface is Wireless interface.
• WAN port has configured DHCP client, is protected by IP firewall
and MAC discovery/connection is disabled.
155
CPE Router
• List of routers using this type of configuration:
• RB711, 911, 912, 921, 922 - with Level3 (CPE) license
• SXT
• QRT
• SEXTANT
• LHG
• LDF
• DISC
• Groove
• Metal
156
LTE CPE AP router
• This configuration type is applied to routers that have both an LTE
and a wireless interface.
• The LTE interface is considered as a WAN port protected by the
firewall and MAC discovery/connection disabled.
• IP address on the WAN port is acquired automatically. Wireless is
configured as an access point and bridged with all available
Ethernet ports.
• List of routers using this type of configuration:
• wAP LTE kit
• LtAP mini kit
157
AP Router (single or dual band)
• This type of configuration is applied to home access point routers to be
used straight out of the box without additional configuration (except
router and wireless passwords)
• First Ethernet port is configured as a WAN port (protected by firewall,
with a DHCP client and disabled MAC connection/discovery)
• Other Ethernet ports and wireless interfaces are added to local LAN
bridge with an IP [Link]/24 and a DHCP server
• In case of dual band routers, one wireless is configured as 5 GHz access
point and the other as 2.4 GHz access point.
• List of routers using this type of configuration:
• RB450, 751, 850, 951, 953, 2011, 3011, 4011
• mAP, wAP, hAP, OmniTIK
158
PTP Bridge (AP or CPE)
• Bridged ethernet with wireless interface
• Default IP address [Link]/24 is set on the bridge interface
• There are two possible options - as CPE and as AP
• For CPE wireless interface is set in "station-bridge" mode.
• For AP "bridge" mode is used.
• List of routers using this type of configuration:
• DynaDish - as CPE
159
WISP Bridge
• Configuration is the same as PTP Bridge in AP mode, except that
wireless mode is set to ap_bridge for PTMP setups.
• Router can be accessed directly using MAC address.
• If device is connected to the network with enabled DHCP server,
configured DHCP client configured on the bridge interface will get
the IP address, that can be used to access the router.
• List of routers using this type of configuration:
• RB 911,912,921,922 - with Level4 license
• cAP, Groove A, Metal A, RB711 A
• BaseBox, NetBox
• mANTBox, NetMetal
160
Switch
• This configuration utilises switch chip features to configure
dumb switch.
161
IP Only
• When no specific configuration is found, IP address
[Link]/24 is set on ether1, or combo1, or sfp1.
• List of routers using this type of configuration:
• RB 411,433,435,493,800,M11,M33,1100
• CCR
162
CAP
• This type of configuration is used when device is to be used as a
wireless access point which is controlled by the CAPsMAN
• When CAP default configuration is loaded, ether1 is considered as a
management port with a DHCP client
• All other Ethernet interfaces are bridged and all wireless interfaces are
set to be managed by the CAPsMAN
• None of the current boards come with the CAP mode enabled from
the factory. The above mentioned configuration is applied to all
boards with at least one wireless interfaces when set to the CAP mode
163
IPv6
• Note. The IPv6 package by default is disabled on RouterOS v6. When
enabled, after the first reboot, default configuration will be applied to
the IPv6 firewall as well.
164
Print the factory default-configuration
• /system default-configuration print
165
IP firewall to a router
• Work with new connections to decrease load on a router;
• Create address-list for IP addresses that are allowed to access your
router;
• Enable ICMP access (optionally);
• Drop everything else, log=yes might be added to log packets that hit
the specific rule;
166
IP firewall for clients
• Established/related packets are added to fasttrack** for faster data
throughput
• firewall will work with new connections only;
• Drop invalid connection and log them with prefix invalid;
• Drop attempts to reach non public addresses from your local network
(rfc1918) ([Link]/8, [Link]/12, [Link]/16)
• drop forward dst-address-list=not_in_internet
• bridge1 is local network interface
• log attempts with prefix="!public_from_LAN";
167
IP firewall for clients
• Drop incoming packets that are not NATed,
• ether1 is public interface, log attempts with !NAT prefix;
• Drop incoming packets from Internet, which are not public IP
addresses (rfc1918),
• ether1 is public interface,
• log attempts with prefix="!public";
• Drop packets from LAN that does not have LAN IP,
• [Link]/24 is local network used subnet;
168
MANAGEMENT
ACCESS
169
RouterOS services
• /ip service disable telnet,ftp,www,api,api-ssl
170
Change default ports
• /ip service set ssh port=2200
171
Restrict access by ip
• /ip service set winbox address=[Link]/24
172
Mac-server
RouterOS has built-in options for easy management access to network
devices even without IP configuration. On production networks the
particular services should be set to restricted access (e.g. only internal
interfaces) or disable entirely!
173
Bandwidth Test
Bandwidth test server is used to test throughput between two
MikroTik routers. It is recommended to disable it on a production
environment.
/tool bandwidth-server set enabled=no
174
DNS Cache
DNS cache facility can be used to provide domain name resolution for
the router itself as well as for the clients connected to it.
In case the DNS cache is not required on your router or if another router
is used for such purposes, DNS cache should be disabled:
/ip dns set allow-remote-requests=no
175
Other Client Services
/ip proxy set enabled=no
/ip socks set enabled=no
/ip upnp set enabled=no
/ip cloud set ddns-enabled=no update-time=no
176
More Secure SSH - Strong-Crypto=Yes
Introduces following changes in the SSH configuration:
• Prefer 256 and 192 bit encryption instead of 128 bits
• Disable null encryption
• Prefer sha256 for hashing instead of sha1
• Disable md5
• Use 2048bit prime for Diffie Hellman exchange instead of
1024bit
177
Unused interfaces
In order to protect from unauthorised access, it is considered good
practice to disable all unused interfaces on the router
178
BRIDGE
FIREWALL
179
Bridge Firewall
180
Bridge Firewall
181
Bridge Firewall
182
Lab. Only PPPoE Traffic
183
Lab. Only PPPoE Traffic
/interface ethernet
set [ find default-name=ether1 ] name=E1-ToBridge
/ip address
add address=[Link]/30 interface=E1-ToBridge
network=[Link]
184
Lab. Only PPPoE Traffic
/ppp secret
add local-address=[Link] name=test password=test \
remote-address=[Link] service=pppoe
/system identity
set name=R1
185
Lab. Only PPPoE Traffic
/interface ethernet
set [ find default-name=ether1 ] name=E1-ToBridge
/interface pppoe-client
add disabled=no interface=E1-ToBridge name=test password=test \
user=test
/ip address
add address=[Link]/30 interface=E1-ToBridge \
network=[Link]
186
Lab. Only PPPoE Traffic
Bridge Setup
/interface bridge
add name=bridge1
/interface ethernet
set [ find default-name=ether2 ] name=E2-ToR1
set [ find default-name=ether3 ] name=E3-ToR3
187
Lab. Only PPPoE Traffic
/system identity
set name=Bridge
188
ICMP FILTERING
189
What is ICMP Filtering
• ICMP helps networks to cope with communication problems
• No authentication method; can be used by hackers to crash
computers on the network
• Firewall/packet filter must be able to determine, based on its
message type, whether an ICMP packet should be allowed to pass
190
ICMPv4 FILTERING
191
Table Filtering Recommendations
192
Table Filtering Recommendations
193
Table Filtering Recommendations
194
Table Filtering Recommendations
195
ICMPv4 Error Messages
• Echo Reply (Type 0, Code 0)
• Destination Unreachable (Type 3)
• Net Unreachable (Code 0)
• Host Unreachable (Code 1)
• Protocol Unreachable (Code 2)
• Port Unreachable (Code 3)
• Fragmentation Needed and DF Set (Code 4)
• Source Route Failed (Code 5)
• Destination Network Unknown (Code 6) (Deprecated)
• Destination Host Unknown (Code 7)
• Source Host Isolated (Code 8) (Deprecated)
• Communication with Destination Network Administratively
Prohibited (Code 9) (Deprecated)
196
ICMPv4 Error Messages
• Destination Unreachable (Type 3)
• Communication with Destination Host Administratively
Prohibited (Code 10) (Deprecated)
• Network Unreachable for Type of Service (Code 11)
• Host Unreachable for Type of Service (Code 12)
• Communication Administratively Prohibited (Code 13)
• Host Precedence Violation (Code 14)
• Precedence Cutoff in Effect (Code 15)
197
ICMPv4 Error Messages
198
ICMPv4 Error Messages
• Parameter Problem (Type 12)
• Pointer Indicates the Error (Code 0)
• Required Option is Missing (Code 1)
199
ICMPv4 Informational Messages
• Echo or Echo Reply Message
• Echo Message (Type 8, Code 0)
• Echo Reply Message (Type 0, Code 0)
• Router Solicitation or Router Advertisement message
• Router Solicitation Message (Type 10, Code 0)
• Router Advertisement Message (Type 9, Code 0)
• Timestamp or Timestamp Reply Message
• Timestamp Message (Type 13, Code 0)
• Timestamp Reply Message (Type 14, Code 0)
200
ICMPv4 Informational Messages
• Information Request or Information Reply Message (Deprecated)
• Information Request Message (Type 15, Code 0)
• Information Reply Message (Type 16, Code 0)
• Address Mask Request or Address Mask Reply
• Address Mask Request (Type 17, Code 0)
• Address Mask Reply (Type 18, Code 0)
201
How the ICMP Filtering Works
202
How the ICMP Filtering Works
203
ENCRYPTED TUNNELS
ON ROUTEROS
204
L2TP/IPsec
205
What is L2TP/IPsec
• L2TP stands for Layer 2 Tunnelling Protocol. L2TP was first proposed
in 1999 as an upgrade to both L2F (Layer 2 Forwarding Protocol) and
PPTP (Point-to-Point Tunnelling Protocol)
• Because L2TP does not provide strong encryption or authentication by
itself, another protocol called IPsec is most often used in conjunction
with L2TP
• Used together, L2TP and IPsec is much more secure than PPTP
(Point-to-Point Tunnelling Protocol), but also slightly slower
206
What is L2TP/IPsec
• L2TP/IPSec offers high speeds, and high levels of security for
transmitting data
• It generally makes use of AES ciphers for encryption
• L2TP sometimes has problems traversing firewalls due to its use of
UDP port 500 which some firewalls have been known to block by
default
207
Lab Setup
INTERNET
R1
L2TP/IPsec
208
Setup L2TP/IPsec Server
209
Setup L2TP/IPsec Server
210
Setup L2TP/IPsec Client
211
Setup L2TP/IPsec Client
212
Setup L2TP/IPsec Client
213
Setup L2TP/IPsec Client
214
Setup L2TP/IPsec Client
215
SSTP
216
What is SSTP
• Microsoft introduced Secure Socket Tunnelling Protocol (SSTP) in
Windows Vista and it still considered to be a Windows-only platform
even though it is available on a number of other operating systems.
• It has very similar advantages as OpenVPN as SSTP uses SSLv3 and it
has greater stability as it is included with Windows which also makes it
simpler to use.
• It uses the same port used by SSL connections; port 443.
• It uses 2048 bit encryption and authentication certificates.
• SSTP uses SSL transmissions instead of IPsec because SSL supports
roaming instead of just site-to-site transmissions.
• RouterOS has both the SSTP server and client implementation
217
How the SSTP works
tcp connection
ssl negotiation
IP binding
SSTP tunnel
218
How the SSTP works
• TCP connection is established from client to server (by default on
port 443)
• SSL validates server certificate. If certificate is valid connection is
established otherwise connection is torn down. (But see note below)
• The client sends SSTP control packets within the HTTPS session
which establishes the SSTP state machine on both sides
219
How the SSTP works
• PPP negotiation over SSTP. Client authenticates to the server and
binds IP addresses to SSTP interface
• SSTP tunnel is now established and packet encapsulation can begin.
• Note: Two RouterOS devices can establish an SSTP tunnel even
without the use of certificates (not in accordance with Microsoft
standard)
• It is recommended to use the certificates at all times!
220
Lab Setup
INTERNET
R1
SSTP
221
Self-signed Certificate
222
Lab Setup
223
Setup SSTP Server
sstp
224
Setup SSTP Server
SSTP Server
225
Setup SSTP Client
226
Setup SSTP Client
227
Setup SSTP Client
228
IPsec
229
What is IPsec
Internet Protocol Security (IPsec) is a set of protocols defined by the
Internet Engineering Task Force (IETF) to secure packet exchange
over unprotected IPv4 or IPv6 networks such as Internet. Provides
Layer 3 security (RFC 2401)
230
What is IPsec
231
The Benefits of IPsec
Confidentiality
• By encrypting data
Integrity
• Routers at each end of a tunnel calculate the checksum or hash value
of the data
Authentication
• Signatures and certificates
• All these while still maintaining the ability to route through existing
IP Networks
232
The Benefits of IPsec
Data integrity and source authentication
• Data “signed” by sender and “signature” is verified by the recipient
• Modification of data can be detected by signature “verification”
• Because “signature” is based on a shared secret, it gives source
authentication
Anti-replay protection
• Optional; the sender must provide it but the recipient may ignore
233
The Benefits of IPsec
Key management
• IKE – session negotiation and establishment
• Sessions are rekeyed or deleted automatically
• Secret keys are securely established and authenticated
• Remote peer is authenticated through varying options
234
IPsec Modes
Transport Mode
• IPsec header is inserted into the IP packet
• No new packet is created
• Works well in networks where increasing a packet’s size could cause an
issue
• Frequently used for remote-access VPNs
235
IPsec Modes
Tunnel Mode
• Entire IP packet is encrypted and becomes the data component of a new
(and larger) IP packet.
• Frequently used in an IPsec site-to-site VPN
236
IPsec Architecture
237
Authentication Header (AH)
AH is a protocol that provides authentication of either all or part of
the contents of a datagram through the addition of a header that is
calculated based on the values in the datagram.
What parts of the datagram are used for the calculation, and the
placement of the header, depends whether tunnel or transport mode is
used.
238
Authentication Header (AH)
• Operates on top of IP using protocol 51
• In IPv4, AH protects the payload and all header fields except
mutable fields and IP options (such as IPsec option)
239
Encapsulating Security Payload (ESP)
Encapsulating Security Payload (ESP) uses shared key encryption to
provide data privacy. ESP also supports its own authentication scheme like
that used in AH, or can be used in conjunction with AH.
ESP packages its fields in a very different way than AH. Instead of having
just a header, it divides its fields into three components:
ESP Header : Comes before the encrypted data and its placement depends on
: whether ESP is used in transport mode or tunnel mode.
ESP Auth Data : This field contains an Integrity Check Value (ICV), computed
: in a manner similar to how the AH protocol works, for
: when ESP's optional authentication feature is used.
240
Encapsulating Security Payload (ESP)
• Uses IP protocol 50
• Provides all that is offered by AH, plus data confidentiality
• It uses symmetric key encryption
• Must encrypt and/or authenticate in each packet
• Encryption occurs before authentication
• Authentication is applied to data in the IPsec header as well as the
data contained as payload
241
Encapsulating Security Payload (ESP)
Encryption :
DES : 56-bit DES-CBC encryption algorithm;
3DES : 168-bit DES encryption algorithm;
AES : 128, 192 and 256-bit key AES-CBC encryption algorithm;
Blowfish : added since v4.5
Twofish : added since v4.5
Camellia : 128, 192 and 256-bit key Camellia encryption algorithm
: added since v4.5
242
Internet Key Exchanger (IKE)
The Internet Key Exchange (IKE) is a protocol that provides authenticated
keying material for Internet Security Association and Key Management
Protocol (ISAKMP) framework. There are other key exchange schemes that
work with ISAKMP, but IKE is the most widely used one. Together they
provide means for authentication of hosts and automatic management of
security associations (SA).
• “An IPsec component used for performing mutual authentication and
establishing and maintaining Security Associations.” (RFC 5996)
• Typically used for establishing IPSec sessions
• A key exchange mechanism
• Five variations of an IKE negotiation:
• Two modes (aggressive and main modes)
• Three authentication methods (pre-shared, public key encryption, and public key
signature)
• Uses UDP port 500
243
IKE Mode
244
Internet Key Exchanger (IKE)
Phase I
• Establish a secure channel (ISAKMP SA)
• Using either main mode or aggressive mode
• Authenticate computer identity using certificates or pre-shared secret
Phase II
• Establishes a secure channel between computers intended for the
transmission of data (IPsec SA)
• Using quick mode
245
Internet Key Exchanger (IKE)
246
IKE Phase 1 (Main Mode)
247
IKE Phase 1 (Main Mode)
248
IKE Phase 1 (Aggressive Mode)
249
IKE Phase 2 (Quick Mode)
250
IKE Phase 2 (Quick Mode)
251
IKEv2
• Internet Key Exchange Version 2 (IKEv2) is the second-generation
standard for a secure key exchange between connected devices.
• IKEv2 works by using an IPsec-based tunnelling protocol to
establish a secure connection.
• One of the single most important benefits of IKEv2 is its ability to
reconnect very quickly in the event that your VPN connection gets
disrupted.
• Quick reconnections and strong encryption IKEv2 makes an
excellent candidate to use
252
Lab Setup
R1 R2
– Public Address : [Link]/24 – Public Address : [Link]/24
– Local Address : [Link]/24 – Local Address : [Link]/24
253
Lab Setup
INTERNET
R1 R2
IPsec
254
Setup IPsec R1
/ip address
add address=[Link]/24 interface=ether1-to-internet network=[Link]
add address=[Link]/24 interface=ether2-to-local network=[Link]
255
Setup IPsec R1
256
Setup IPsec R1
257
Setup IPsec R1
258
Setup IPsec R1-NEW
258.1
Setup IPsec R1-NEW
258.2
Setup IPsec R1
259
Setup IPsec R1
260
Setup IPsec R2
/ip address
add address=[Link]/24 interface=ether1-to-internet network=[Link]
add address=[Link]/24 interface=ether2-to-local network=[Link]
261
Setup IPsec R2
262
Setup IPsec R2
263
Setup IPsec R2-OLD
264
Setup IPsec R2-NEW
264.1
Setup IPsec R2-NEW
264.2
Lab Setup
265
Lab Setup
266
Lab Setup
267
Lab Setup
268
MTCSE
SUMMARY
269
Certification Test
270
Thank You!
Thank you
José Manuel Román Fernández Checa
and
Fajar Nugroho
for creating and sharing the initial version of
the MTCSE course materials.
271