Chapter 1. IPsec

Written by Hiten M. Pandya.

This section will guide you through the process of setting up IPsec, and to use it in an environment which consists of FreeBSD and Microsoft Windows 2000/XP machines; to make them communicate securely. In order to setup IPsec, it is necessary that you are familiar with the concepts of building a custom kernel (see ).

IPsec is a protocol which sits on top of the Internet Protocol (IP) layer. It allows two or more hosts to communicate in a secure manner (hence the name). The FreeBSD IPsec ``network stack'' is based on the KAME implementation, which has support for both protocol families, IPv4 and IPv6.

Note: FreeBSD 5.0 contains a ``hardware accelerated'' IPsec stack, known as ``Fast IPsec'', that was obtained from OpenBSD. It employs cryptographic hardware (whenever possible) via the crypto(4) subsystem to optimize the performance of IPsec. This subsystem is new, and does not support all the features that are available in the KAME version of IPsec. However, in order to enable hardware-accelerated IPsec, the following kernel option has to be added to your kernel configuration file:

      options    FAST_IPSEC  # new IPsec (cannot define w/ IPSEC)
   

Note, that it is not currently possible to use the ``Fast IPsec'' subsystem in lue with the KAME implementation of IPsec. Consult the fast_ipsec(4) manual page for more information.

IPsec consists of two sub-protocols:

ESP and AH can either be used together or seperately, depending on the environment.

IPsec can either be used to directly encrypt the traffic between two hosts (known as Transport Mode); or to build ``virtual tunnels'' between two subnets, which could be used for secure communication between two corporate networks (known as Tunnel Mode). The latter is more commonly known as a Virtual Private Network (VPN). The ipsec(4) manual page should be consulted for detailed information on the IPsec subsystem in FreeBSD.

To add IPsec support to your kernel, add the following options to your kernel configuration file:

    options   IPSEC        #IP security
    options   IPSEC_ESP    #IP security (crypto; define w/ IPSEC)
 

If IPsec debugging support is desired, the following kernel option should also be added:

    options   IPSEC_DEBUG  #debug for IP security