Monday, May 27, 2013

Configuring Site-to-Site VPN in ASA firewall

VPN is used to create a secure connection over an insecure network (Internet).The internet is an insecure medium, so the data pass through the internet cannot be reliable. We cannot be sure about the security of the data. To provide security of the data through internet, we can use VPN.
There is a wide variety of VPNs available nowadays. The VPN supportedby the appliance include
 IPSec VPN
SSL VPN(web VPN)
PPTP (Point to Point Tunneling Protocol)
L2TP (Layer 2 Tunneling Protocol)



What is a Site-to-Site VPN?
A site-to-site VPN allows offices in multiple fixed locations to establish secure connections with each other over a public network such as the Internet. Site-to-site VPN extends the company's network, making computer resources from one location available to employees at other locations. An example of a company that needs a site-to-site VPN is a growing corporation with dozens of branch offices around the world.

For the Site-to Site VPN we have to configure in both ends (firewalls).

The configuration of VPN is a two step process.

  1. IPSec Phase 1 configuration
  2. IPSec Phase 2 configuration 

Configuration of IPSec Site-to-Site VPN

You can configure the same Site-to-Site VPN using the ASDM. But I prefer to use the CLI.



I hope you already know something about the ISAKMP process and the steps it would take for initiating a connection. So we are not going to discuss that in this scenario.
First we have to set IP and Routing in all these Devices. We will use OSPF protocol for routing.

R2 Router

R2#conf t
R2(config)#interface e1/0
R2(config-if)#ip add 10.0.0.2 255.0.0.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#router ospf 1
R2(config-router)#network 10.0.0.0 255.0.0.0 area 0

R3 Router


R3#conf t
R3(config)#interface e1/0
R3(config-if)#ip add 30.0.0.2 255.0.0.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#router ospf  1
R3(config-router)#network 30.0.0.0 255.0.0.0 area 1

ASA1

Asa#config t
Asa(config)#int e0/0
Asa(config-if)#ip add 10.0.0.1 255.0.0.0
Asa(config-if)#nameif inside
Asa(config-if)#no shut
Asa(config-if)#exit

Asa(config)#int e0/1
Asa(config-if)#ip add 20.0.0.1 255.0.0.0
Asa(config-if)#nameif outside
Asa(config-if)#no shut
Asa(config-if)#exit

Asa(config)#router ospf 1
Asa(config-router)#network 10.0.0.0 255.0.0.0 area 0
Asa(config-router)#network 20.0.0.0 255.0.0.0 area 1
Asa(config-router)#exit

we will add an access list that will permit the ICMP protocol. It would be helpful if we allow the ping request to pass through your appliance.

Asa (config)#access-list  INBOUND_ACL extended permit icmp any any echo
Asa (config)#access-list  INBOUND_ACL extended permit icmp any any echo-reply
Asa (config)#access-list  INBOUND_ACL extended permit icmp any any source-quench
Asa (config)#access-list  INBOUND_ACL extended permit icmp any any time-exceeded
Asa (config)#access-list  INBOUND_ACL extended permit icmp any any unreachable
Asa (config)#access-list  INBOUND_ACL extended permit icmp any any
Asa (config)#access-group  INBOUND_ACL in interface outside

Now we will create an ISAKMP policy 

Asa(config)#crypto isakmp policy 1
Asa(config-isakmp-policy)#authentication pre-share
Asa(config-isakmp-policy)#encryption aes-256
Asa(config-isakmp-policy)#hash sha
Asa(config-isakmp-policy)#group 2
Asa(config-isakmp-policy)#lifetime 86400
Asa(config-isakmp-policy)#exit
Asa(config)#tunnel-group  20.0.0.2  type   ipsec-l2l
Asa(config)#tunnel-group   20.0.0.2  ipsec-attributes
Asa(config-tunnel-ipsec)#pre-shared-key    cisco
Asa(config)#access-list encrypt_acl extended permit ip 30.0.0.0 255.0.0.0   10.0.0.0 255.0.0.0
Asa(config)#nat    (inside)   0   access-list encrypt-acl
Asa(config)#crypto    ipsec   transform-set    myset    esp-aes-256  esp-sha-hmac
Asa(config)#crypto   map   IPSECMAP   10  match   address   encrypt_acl
Asa(config)#crypto   map   IPSECMAP   10  set peer    20.0.0.2
Asa(config)#crypto   map   IPSECMAP   10 set  transform-set  myset
Asa(config)#crypto   map   IPSECMAP   interface outside
Asa(config)#crypto   isakmp  enable  outside

We have to do the same configurations in the second ASA also, make sure you are typing the same pre-shared key and encryption algorithm and also pay attention to the lifetime.
ASA2

Asa#config t
Asa(config)#int e0/1
Asa(config-if)#ip add 30.0.0.1 255.0.0.0
Asa(config-if)#nameif inside
Asa(config-if)#no shut
Asa(config-if)#exit

Asa(config)#int e0/0
Asa(config-if)#ip add 20.0.0.2 255.0.0.0
Asa(config-if)#nameif outside
Asa(config-if)#no shut
Asa(config-if)#exit

Asa(config)#router ospf 1
Asa(config-router)#network 30.0.0.0 255.0.0.0 area 1
Asa(config-router)#network 20.0.0.0 255.0.0.0 area 1
Asa(config-router)#exit

Asa (config)#access-list  INBOUND_ACL extended permit icmp any any echo
Asa (config)#access-list  INBOUND_ACL extended permit icmp any any echo-reply
Asa (config)#access-list  INBOUND_ACL extended permit icmp any any source-quench
Asa (config)#access-list  INBOUND_ACL extended permit icmp any any time-exceeded
Asa (config)#access-list  INBOUND_ACL extended permit icmp any any unreachable
Asa (config)#access-list  INBOUND_ACL extended permit icmp any any
Asa (config)#access-group  INBOUND_ACL extended in interface outside

Asa(config)#crypto isakmp policy 1
Asa(config-isakmp-policy)#authentication pre-share
Asa(config-isakmp-policy)#encryption aes-256
Asa(config-isakmp-policy)#hash sha
Asa(config-isakmp-policy)#group 2
Asa(config-isakmp-policy)#lifetime 86400
Asa(config-isakmp-policy)#exit
Asa(config)#tunnel-group  20.0.0.1  type   ipsec-l2l
Asa(config)#tunnel-group   20.0.0.1  ipsec-attributes
Asa(config-tunnel-ipsec)#pre-shared-key    cisco
Asa(config)#access-list encrypt_acl extended permit ip 10.0.0.0 255.0.0.0   30.0.0.0 255.0.0.0
Asa(config)#nat    (inside)   0   access-list encrypt-acl
Asa(config)#crypto    ipsec   transform-set    myset    esp-aes-256  esp-sha-hmac
Asa(config)#crypto   map   IPSECMAP   10  match   address   encrypt_acl
Asa(config)#crypto   map   IPSECMAP   10  set peer    20.0.0.1
Asa(config)#crypto   map   IPSECMAP   10 set  transform-set  myset
Asa(config)#crypto   map   IPSECMAP   interface outside
Asa(config)#crypto   isakmp  enable  outside

In these commands we set VPN for the IP traffic.

If we need to check the ICMP traffic…then you have to permit ICMP traffic through VPN

For that in each ASA please enter this command

Ciscoasa(config)#access-list   encrypt_acl   extended permit   icmp   any   any



For verifying the VPN use the command

Ciscoasa(config)#debug   crypto   isakmp   127

 After setting all these configuration and if you start a ping from one router to another. It will trigger the VPN tunnel and automatically start the site-to-site VPN.




Wednesday, June 27, 2012

Configuring Active/Standby Failover in cisco ASA

























Failover provides redundancy between the appliances, so if one appliance fails, you can have a redundant appliance take over the failed one.  So most of the companies will implement the failover for network security and redundancy. 

Failover is a Cisco-proprietary feature unique to the security appliance. Failover provides redundancy between paired appliances: one appliance backs up another appliance.  This section will introduce failover concepts.


Failover implementations

There are two implementations that cisco supports for failover. 

Active/Standby
Active/Active

Active/ Standby

The active/standby implementation of failover needs two appliances: primary and Secondary. By default primary unit performs the active role, and the secondary the standby role. Only one appliance will process the traffic. If anything happened to the primary appliance, then the secondary appliance will take place the role of active.

The following is the configuration of Active/Standby failover in cisco ASA.




ASA1

Ciscoasa(config)#hostname   asa1
Asa1(config)#int e0/0
Asa1(config-if)#nameif   inside
Asa1(config-if)#ip add   192.168.2.1    255.255.255.0   standby   192.168.2.2
Asa1(config-if)#no shut

Asa1(config)#int e0/1
Asa1(config-if)#nameif   outside
Asa1(config-if)#ip add   192.168.1.1   255.255.255.0   standby   192.168.1.2
Asa1(config-if)#no shut

Asa1(config)#int e0/2
Asa1(config-if)#no shut
Asa1(config)#int e0/3
Asa1(config-if)#no shut
Asa1(config-if)#exit

Asa1(config)#failover   lan   unit   primary
Asa1(config)#failover   lan   interface   FOControl e0/2
Asa1(config)#failover   interface   ip   FOControl   192.168.20.1   255.255.255.0   standby   192.168.20.2
Asa1(config)#failover   link   FOState   e0/3
Asa1(config)#failover   interface   ip   FOState   192.168.21.1   255.255.255.0   standby   192.168.21.2
Asa1(config)#failover   key   cisco
Asa1(config)#failover   polltime   msec   200   holdtime   msec   800
Asa1(config)#


ASA2


ciscoasa(config)#hostname  asa2
Asa2(config)#int e0/0
Asa2(config-if)#no shut
Asa2(config-if)#int e0/1
Asa2(config-if)#no shut
Asa2(config-if)#int e0/2
Asa2(config-if)#no shut
Asa2(config-if)#int e0/3
Asa2(config-if)#no shut

Asa2(config)#failover   lan   unit   secondary
Asa2(config)#failover   key   cisco
Asa2(config)#failover   lan   interface   FOControl   e0/2
Asa2(config)#failover   interface   ip   FOControl   192.168.20.1   255.255.255.0   standby   192.168.20.2



To verify the failover is working or not…

Use the command   failover    in both appliances




Configuring Active Active Failover in Cisco ASA firewall







    Failover provides redundancy between the appliances, so if one appliance fails, you can have a redundant appliance take over the failed one.  So most of the companies will implement the failover for network security and redundancy. 


    Failover is a Cisco-proprietary feature unique to the security appliance. Failover provides redundancy between paired appliances: one appliance backs up another appliance.  This section will introduce failover concepts.


    Failover implementations


    There are two implementations that cisco supports for failover. 


    Active/Standby
    Active/Active


    Here we are going to learn about Active/Active failover in the ASA



    In the active/active implementation of failover, both appliances will process the traffic. To implement active/active failover, two contexts are needed. Failover can occur if a context is fails or if the entire appliance fails.

    Configuration of Active/Active failover is some simple steps. But when you are doing it in GNS3, you must be careful about the switch configurations.

    Here in the picture you can see both switches are connected with ASA. The connected ports must be in the same vlan (example: vlan 1) and must be in trunk (example: dot1q).

    Now the following steps are the configuration of Active/Active Failover




    ASA1



    Ciscoasa(config)#hostname   asa1
    Asa1(config)#int     e0/0
    Asa1(config-if)#no   shut
    Asa1(config-if)#int   e0/1
    Asa1(config-if)#no   shut
    Asa1(config-if)#int  e0/2
    Asa1(config-if)#no   shut
    Asa1(config-if)#int   e0/3
    Asa1(config-if)#no   shut

    Creating virtual interfaces for contexts

    Asa1(config)#int   e0/0.1
    Asa1(config-if)#vlan   3
    Asa1(config-if)#no    shut
    Asa1(config-if)#int   e0/0.2
    Asa1(config-if)#vlan  5
    Asa1(config-if)#no   shut
    Asa1(config-if)#int   e0/1.1
    Asa1(config-if)#vlan    2
    Asa1(config-if)#no   shut
    Asa1(config-if)#int  e0/1.2
    Asa1(config-if)#vlan   4
    Asa1(config-if)#no   shut
    Asa1(config-if)#exit

    Create two failover groups for adding the contexts

    Asa1(config)#failover   group    1
    Asa1(config-fover-group)#exit
    Asa1(config)#failover   group   2
    Asa1(config-fover-group)#exit


    Creating contexts and allocating interfaces to contexts

    Asa1(config)#admin-context   admin
    Asa1(config)#context   admin
    Asa1(config-ctx)#config-url     disk0:/.private/admin.cfg

    Creating context c1

    Asa1(config-ctx)#context   c1
    Asa1(config-ctx)#allocate-interface   e0/0.1
    Asa1(config-ctx)#allocate-interface   e0/1.1
    Asa1(config-ctx)#join-failover-group   1
    Asa1(config-ctx)#config-url   disk0:/.private/c1.cfg

    Creating context c2


    Asa1(config-ctx)#context   c2
    Asa1(config-ctx)#allocate-interface   e0/0.2
    Asa1(config-ctx)#allocate-interface   e0/1.2
    Asa1(config-ctx)#join-failover-group   2
    Asa1(config-ctx)#config-url     disk0:/.private/c2.cfg

    Setting IP for the virtual interfaces in contexts


    Asa1(config-ctx)#changeto   context   c1
    Asa1/c1(config)#int   e0/0.1
    Asa1/c1(config-if)#nameif    inside
    Asa1/c1(config-if)#ip   add    172.16.1.1   255.255.255.0   standby   172.16.1.2
    Asa1/c1(config-if)#no   shut
    Asa1/c1(config-if)#int   e0/1.1
    Asa1/c1(config-if)#nameif   outside
    Asa1/c1(config-if)#ip   add   172.16.2.1   255.255.255.0   standby   172.16.2.2
    Asa1/c1(config-if)#no   shut

    Asa1/c1(config-if)#changeto    context    c2
    Asa1/c2(config)#interface    e0/0.2
    Asa1/c2(config-if)#nameif   inside
    Asa1/c2(config-if)#ip    add   192.168.1.1    255.255.255.0   standby   192.168.1.2
    Asa1/c2(config-if)#no    shut
    Asa1/c2(config-if)#int   e0/1.2
    Asa1/c2(config-if)#nameif     outside
    Asa1/c2(config-if)#ip  add   192.168.2.1   255.255.255.0   standby   192.168.2.2
    Asa1/c2(config-if)#no  shut
    Asa1/c2(config-if)#exit
    Asa1/c2(config)#exit


    Asa1(config)#failover   lan  interface   LANFO    e0/2
    Asa1(config)#failover   link   LANFO
    Asa1(config)#failover  interface ip  LANFO  192.168.20.1     255.255.255.0   standby    192.168.20.2
    Asa1(config)#failover   lan   unit   primary
    Asa1(config)#failover   polltime   msec  500


    ASA2


    Asa2(config)#int  e0/0
    Asa2(config-if)#no shut
    Asa2(config-if)#int e0/1
    Asa2(config-if)#no shut
    Asa2(config-if)#int e0/2
    Asa2(config-if)#no shut
    Asa2(config-if)#int e0/3
    Asa2(config-if)#no shut


    Asa2(config)#failover   lan  unit  secondary
    Asa2(config)#failover  lan   interface  LANFO   e0/2
    Asa2(config)#failover   interface   ip   LANFO   192.168.20.1   255.255.255.0   standby   192.168.20.2

    Create an Admin Context

    Asa2(config)#admin-context    admin
    Asa2(config)#context   admin
    Asa2(config-ctx)#config-url  disk0:/.private/admin.cfg


    After the configuration, to make the failover working, you have to use the command   failover    in both appliances.




    For the correct working of Active/active failover, you have to enter some more commands in the primary ASA

    Asa1(config)# failover  group  1
    Asa2(config-fover-group)#primary
    Asa2(config-fover-group)#preempt
    Asa2(config-fover-group)#exit

    Asa2(config)#failover group 2
    Asa2(config-fover-group)#secondary
    Asa2(config-fover-group)#preempt
    Asa2(config-fover-group)#exit