lab_ipsec_2425_v1
lab_ipsec_2425_v1
1 Objectives
The aim of this laboratory work is to study IPSec and DMVPN.
2 Preparation
This topic is partially covered in module 18 “VPNs” and module 19 “Implementing Site-to-
Site IPSec VPNs” of NetAcad’s Network Security course. See also the slides “IPSec and
DMVPN” and the videos recommended in the SAAR roadmap.
3 Equipment
These exercises are performed using GNS3, equipped with Cisco routers (3725, 7200, and
IOSv).
4 GRE tunneling
Consider the network of Figure 1, comprising a public network connecting two sites of one
organization. The public network (representing the Internet) includes subnets 200.1.1.0/24
and 200.2.2.0/24. The organization has subnets 192.168.1.0/24 and 192.168.2.0/24 on the
left site, and subnets 192.168.3.0/24 and 192.168.4.0/24 on the right site. Both the
organization and the public networks use OSPF as the routing protocol. The goal of this
exercise is to establish a GRE tunnel between the two organization sites, i.e., between R1
and R2.
Routers R1 and R2 must be IOSv Cisco routers, router RA must be a 7200 Cisco router, and
routers R3 and R4 must be 3725 Cisco routers. For the PCs we suggest the use of Alpine
Linux containers since they are very lightweight; another good alternative is to use 3725
routers configured as hosts (with the no ip routing option).
R3 R4
f0/1 f0/1
.3 192.168.1.0/24 192.168.4.0/24 .4
f0/0 f0/0
.100 .100
PC1 PC2
int Tunnel0
ip unnumbered g0/1
tunnel source l0
tunnel destination 2.2.2.2
ip ospf 2 area 0
Note that this configuration includes loopback interfaces. Configure the remaining network
elements using the information above. To test the network, ping from PC1 to PC2. You can
use show ip interface brief to check the state of all interfaces and show interfaces tunnel 0
to have a detailed view of the tunnel 0 state.
1. View the routing tables of R3 and R4. Explain why these tables include all four
subnets of the organization network but none of the public network.
2. View the routing table of RA. Explain why this table includes the two subnets of the
public network but none of the organization network.
3. While performing ping from PC1 and PC2, capture and analyze an ICMP Echo
Request packet at the public network. In this packet, identify the IP protocol type,
the addresses of the outer and inner IP headers, and the GRE field. Based on this
information, explain the operation of GRE tunneling.
• Explain the operation of GRE tunneling using Wireshark captures and Cisco IOS show
commands.
• Explain the contents of the OSPF Link State Database at the various routers. Why
was there the need to configure two different OSPF processes at R1 and R2? What
are the processes used in the underlay and the overlay?
• Does GRE support multitenancy?
Configure R2 using the information above. If the configurations are correct, you must be
able to ping from PC1 to PC2.
The following show commands may be useful to debug the IPSec configuration: show crypto
isakmp policy, show crypto isakmp sa, show crypto ipsec sa, and show crypto engine
connection active. The show crypto isakmp sa command allows checking if the ISAKMP SA is
active. The show crypto ipsec sa command includes several statistics, e.g., number of
encrypted/decrypted packets.
1. While performing ping from PC1 and PC2, capture and analyze an ICMP Echo
Request packet at the public network. In this packet, identify the IP protocol type,
the addresses of the outer and inner IP headers, and the AH header. Is the
information cyphered? What is the role of the AH Sequence and AH ICV fields of the
Authentication Header?
2. Analyze the OSPF packets seen at the public network. Identify the two types of OSPF
Hello packets and explain their role.
3. While capturing traffic at the public network, clear the SA by running clear crypto
session. Analyze the ISAKMP messages that are exchanged to delete the tunnel and
establish a new one. What ISAKMP messages are exchanged to establish the IKE
phase 1 and IKE phase 2 tunnels? Explain the role of each message, and the role of
their most important fields. In the messages exchanged during the Diffie-Hellman
phase, what is the role of the Key Exchange payload?
4. Observe the differences in the exchanged messages when there is no agreement
between the peers, e.g., in some cryptographic algorithm or IPSec protocol (ESP
versus AH).
5. Now, change the IPSec protocol to ESP. To do that replace the transform set by
crypto ipsec transform-set myTSet esp-aes esp-sha-hmac. While performing ping
from PC1 and PC2, capture and analyze the corresponding ESP packets. Analyze also
the OSPF exchanges. What are the differences in relation to the AH protocol?
6. What is the requirement of a firewall to let an IPSec tunnel being established?
3. Use show crypto pki server to view information on the PKI server. Use show crypto
ca certificate and show crypto ca certificate verbose to view information on the CA
certificate. To view the public key that was created for the CA run show crypto key
mypub rsa.
4. R1 and R2 (the PKI clients) must now be configured to obtain a certificate from the
CA. You will use SCEP-based enrollment. To view the exchange of HTTP messages
related to SCEP, install a Wireshark probe between R1 and RA before starting the
configuration. The configuration has three steps. First, configure the each router for
SCEP enrollment:
crypto pki trustpoint myTrustpoint
enrollment url http://200.1.1.10:80
exit
Check that the certificate was installed at each router using show crypto ca
certificate.
6. Finally, at each router, fetch the router certificate:
crypto ca enroll myTrustpoint
Check that the certificate was installed at the router using show crypto pki
certificates. Additional details of the certificates can be viewed using show crypto
pki certificates verbose. Run show crypto key mypub rsa at R1 and R2 to view their
public keys.
9. After configuring all network elements, you must be able to ping from PC1 to PC2.
Do that while capturing traffic at the public network. Analyze the encrypted ICMP
messages that were triggered by the ping. Are there any differences in relation to
what you observed in section 5.1?
10. While capturing traffic at the public network, clear the SA by running clear crypto
session. Now, analyze the ISAKMP messages that are exchanged to delete the SA
and establish a new one. What are the main differences in relation to IPSec with pre-
shared keys?
11. Using the command show crypto key pubkey-chain rsa name R2 at R1 view the
public key of R2.
12. Stop all nodes, then restart all nodes and, a few seconds later, install a Wireshark
probe at the public network. Analyze the HTTP messages related to SCEP exchanged
with the CA. What is the purpose of these messages?
!IKEv2 policy
crypto ikev2 policy myIKEv2Policy
proposal myProposal
!IKEv2 keyring
crypto ikev2 keyring myKeyring
peer R2
address 2.2.2.2
pre-shared-key saar
!IKEv2 profile
!IPSec profile
crypto ipsec profile myIPSecProfile
set transform-set myTSet
set ikev2-profile myIKEv2Profile
!Tunnel interface
interface Tunnel0
ip unnumbered g0/1
tunnel source l0
tunnel destination 2.2.2.2
tunnel mode ipsec ipv4
tunnel protection ipsec profile myIPSecProfile
ip ospf 2 area 0
Then, after saving the configuration, clear the IKEv2 SA (clear crypto session) and let
a new IKEv2 SA be created. Using Wireshark, observe the messages exchanged
during this process. Using show crypto ikev2 sa detailed, check the evolution of the
SA lifetime and of the local and remote SPIs.
5. To explore the process of IPSec SA rekeying, set the IPSec SA lifetime to 120 seconds
at R1. To do this, enter the following commands at R1:
crypto ipsec profile myIPSecProfile
set security-association lifetime seconds 120
• With the help of Wireshark captures, explain the contents of the IKE_AUTH
messages. Are they cyphered?
• With the help of Wireshark captures and Cisco IOS commands explain the process of
rekeying the IKEv2 and IPSec SAs. Does the process start from scratch, with an
IKE_SA_INIT exchange? What messages are exchanged in the rekeying? Do the SPIs
change? What are the main differences between the rekeying of the IKEv2 and IPSec
SAs?
7 DMVPN
Consider the network of Figure 2. Now the organization’s network includes three sites. You
will have to configure DMVPN solutions for communications between sites, and compare the
three alternatives: DMVPN Phase 1, Phase 2, and Phase 3.
In the DMVPN exercises the hub and spoke routers should be Cisco IOSv routers and the RA
router can be a Cisco 3725 or 7200.
192.168.3.0/24
f0/0
.100
PC3
Configure now RIPv2 at the remaining routers where it should be configured. The
configuration of the tunnel interface at R1 is:
int Tunnel0
ip add 10.10.10.1 255.255.255.0
tunnel source Lo0
tunnel mode gre multipoint
ip nhrp network-id 1
ip nhrp map multicast dynamic
ip nhrp redirect
ip summary-address rip 0.0.0.0 0.0.0.0
• If you still cannot ping between the PCs, check the connectivity in the public
network. Nothing works if the public network doesn’t work! Ping between the
physical and the loopback interfaces of the hub and the spokes. For example, to ping
between the loopback interfaces of R2 and R3 run ping 3.3.3.3 source 2.2.2.2 at R2.
Note that, if there is connectivity between all loopback interfaces, there will surely
be between all physical interfaces.
• If you are not successful, check the routing tables of the hub, the two spokes, and of
router RA, using show ip route. For example, RA should have learned all three
loopback addresses (1.1.11/32, 2.2.2.2/32, and 3.3.3.3/32) through OSPF (and
should not have learned any of the subnets of the organization). Moreover, R1
should have learned through OSPF the loopback addresses of the spokes (2.2.2.2/32
and 3.3.3.3/32) and the subnet addresses of the links between the spokes and RA
(200.2.2.0/24 and 200.3.3.0/24).
• You can also do a Wireshark capture at the three links of the public network and
check if both sides of each link are transmitting periodic OSPF Hello packets. Using
show ip ospf neighbor check that the two sides have established neighborhood
relationships. Finally, inspect the Link State Database of the hub, the two spokes and
of router RA using show ip ospf database. Do they have all the LSAs they were
supposed to have?
• The Cisco IOS CLI signals, through a warning message, the establishment of OSPF
neighborhood relationships. Not having them indicates the existence of problems.
• If there is full connectivity in the public network, the problem may reside in the RIP
configuration. Do a Wireshark capture in the R1-RA link and check if periodic RIP
Response messages (encapsulated in GRE) are being transmitted. At this link, you
should see RIP Response messages transmitted by the loopback interfaces of the
hub and the two spokes. If one of the spokes is not sending RIP Response messages
the problem may be in that spoke.
• Check the RIP entries of the hub and of the two spokes. At R1, you should see the
subnet addresses of the two spokes (192.168.2.0/24 and 192.168.3.0/24) and at
both spokes you should see the default route 0.0.0.0/0, which was installed by the
hub.
The configuration is for the AH protocol. You must also analyze the ESP protocol.
1. Are there any differences in the routing tables and in the NHRP caches?
2. What packets are protected by IPSec (both ESP and AH)?
3. Why is the transport mode preferred over the tunnel mode?
4. How many SAs are there between each pair of routers?
• Explain the impact of adding IPSec to DMVPN Phase 3 in the routing tables and in
the NHRP caches.
• Indicate which packets are protected by IPSec and what is the preferred mode of
operation.
9 Report guidelines
In the report, you need only to address the following exercises:
10 Additional exercises
Additional exercises, related to this lab guide, that can be performed as a project are
indicated in the SAAR project guide. They are: