CentOSでIPsec

VPSYAMAHA RTX 間をIPSECしたい

まだメモ

1.1.1.1 : 相手グローバル
2.2.2.2 : 自分グローバル
3.3.3.1 : 相手ローカル
4.4.4.1 : 自分ローカル

トンネルを堀る
iptunnel add ipsec0 mode ipip remote 1.1.1.1. local 2.2.2.2
トンネルにアドレスを割り振る
ifconfig ipsec0 4.4.4.1 netmask 255.255.255.0

cf: http://www.atmarkit.co.jp/fnetwork/netcom/ifconfig/ifconfig.html

ルーティング設定
route add -net 3.3.3.0/24 dev ipsec0
/etc/ipsec-tools.conf
#!/usr/sbin/setkey -f
flush;
spdflush;
spdadd 4.4.4.1 3.3.3.0/24 any -P out ipsec esp/tunnel/2.2.2.2-1.1.1.1/require;
spdadd 3.3.3.0/24 4.4.4.1 any -P in ipsec esp/tunnel/1.1.1.1-2.2.2.2/require;
/etc/racoon/psk.txt

racoon : IKEデーモン

1.1.1.1 PASSPHRASE
/etc/racoon/racoon.conf
path pre_shared_key "/etc/racoon/psk.txt"
remote 1.1.1.1 {
   exchange_mode aggressive;
   my_identifier fqdn "PCNAME"
   proposal {
      encryption_algorithm aes;
      hash_algorithm md5;
      authentication_method pre_shared_key;
      dh_group modp1024;
   }
}
sainfo anonymous {
   pfs_group modp1024;
   encryption_algorithm aes;
   authentication_algorithm hmac_md5;
}