I will not go into the details of kernel compilation. There are good howtos on the Internet for that. You want to have IPsec configured in your kernel. In Linux 2.6 this would look similar to this:
CONFIG_NET_KEY=y
CONFIG_CRYPTO_HMAC=y
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_DES=y
CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
Beyond the kernel configuration, be sure that your OS is up and running, and network-connections are working fine.