お知らせ

  • 利用規約を守って投稿してください。また、よくある質問および投稿の手引きも参照してください。
  • メッセージの投稿にはアカウントが必要です。未登録の方は、ユーザ登録ページからアカウントを作成することができます。

#1 2010-09-17 01:18:18

ipsec
新しいメンバ
登録日: 2010-09-17

ipsec-tools(racoon)を使ってtunnel接続

ubuntu 9.04 日本語Remixです。

下記サイトを参考に、ipsec-tools(racoon)を使ってtunnel接続をしようとしています。
http://moimoitei.blogspot.com/2007/03/linux-ipsec-tunnel.html

CentOS5.5でも同じことをやり、pingで疎通確認できましたが、ubuntuでは疎通が確認できません。

原因が、racoonの設定なのか、ルーティングなのか、OSの違いなのか、見当がつきません。
ご助言のほど、よろしくお願いします。

なお、普段はCentOSを使っており、ubuntuには慣れておりませんので(すいません)、
コマンドや設定の例示もしていただけると幸いです。
重ねて、お願いします。

【設定】

===== 凡例 =====

XX.XX.XX.XX  相手側グローバルアドレス
YY.YY.YY.YY クライアントのeth0アドレス(プライベートアドレス)
192.168.1.0/24 相手側ローカルネットワーク
192.168.150.201 クライアントのトンネル用アドレス(ipsec0)

===== トンネルデバイス等 =====

modprobe ipip
ip tunnel add ipsec0 mode ipip remote XX.XX.XX.XX local YY.YY.YY.YY dev eth0
ip addr add 192.168.150.201 dev ipsec0
ip link set ipsec0 up
ip route add 192.168.1.0/24 dev ipsec0

===== ipsec-tools.confの設定 =====

#!/usr/sbin/setkey -f

flush;
spdflush;

spdadd 192.168.150.201 192.168.1.0/24 any -P out ipsec
esp/tunnel/YY.YY.YY.YY-XX.XX.XX.XX/require;

spdadd 192.168.1.0/24 192.168.150.201 any -P in ipsec
esp/tunnel/XX.XX.XX.XX-YY.YY.YY.YY/require;

===== racoon.confの設定 =====

path include "/etc/racoon";
path pre_shared_key "/etc/racoon/psk.txt";
path certificate "/etc/racoon/certs";

remote XX.XX.XX.XX
{
        exchange_mode aggressive;
        my_identifier fqdn "testuser1";
        proposal {
                encryption_algorithm aes;
                hash_algorithm md5;
                authentication_method pre_shared_key;
                dh_group 2;
        }
}

sainfo anonymous
{
        pfs_group 2;
        lifetime time  12 hours;
        encryption_algorithm aes;
        authentication_algorithm hmac_md5;
        compression_algorithm deflate;
}

【ログ等】

===== racoon.log =====

2010-09-17 00:18:22: INFO: @(#)ipsec-tools 0.7 (http://ipsec-tools.sourceforge.net)
2010-09-17 00:18:22: INFO: @(#)This product linked OpenSSL 0.9.8g 19 Oct 2007 (http://www.openssl.org/)
2010-09-17 00:18:22: INFO: Reading configuration from "/etc/racoon/racoon.conf"
2010-09-17 00:18:22: INFO: Resize address pool from 0 to 255
2010-09-17 00:18:22: INFO: 127.0.0.1[500] used as isakmp port (fd=6)
2010-09-17 00:18:22: INFO: 127.0.0.1[500] used for NAT-T
2010-09-17 00:18:22: INFO: YY.YY.YY.YY[500] used as isakmp port (fd=7)
2010-09-17 00:18:22: INFO: YY.YY.YY.YY[500] used for NAT-T
2010-09-17 00:18:22: INFO: 192.168.150.201[500] used as isakmp port (fd=8)
2010-09-17 00:18:22: INFO: 192.168.150.201[500] used for NAT-T
2010-09-17 00:18:22: INFO: ::1[500] used as isakmp port (fd=9)
2010-09-17 00:18:22: INFO: fe80::20c:29ff:feec:d88%eth0[500] used as isakmp port (fd=10)
2010-09-17 00:19:08: INFO: IPsec-SA request for XX.XX.XX.XX queued due to no phase1 found.
2010-09-17 00:19:08: INFO: initiate new phase 1 negotiation: YY.YY.YY.YY[500]<=>XX.XX.XX.XX[500]
2010-09-17 00:19:08: INFO: begin Aggressive mode.
2010-09-17 00:19:08: NOTIFY: couldn't find the proper pskey, try to get one by the peer's address.
2010-09-17 00:19:08: INFO: ISAKMP-SA established YY.YY.YY.YY[500]-XX.XX.XX.XX[500] spi:802dbf6e7a8e3ab7:e570e163d4aa727d
2010-09-17 00:19:09: INFO: initiate new phase 2 negotiation: YY.YY.YY.YY[500]<=>XX.XX.XX.XX[500]
2010-09-17 00:19:09: INFO: IPsec-SA established: ESP/Tunnel XX.XX.XX.XX[0]->YY.YY.YY.YY[0] spi=106298393(0x655fc19)
2010-09-17 00:19:09: INFO: IPsec-SA established: ESP/Tunnel YY.YY.YY.YY[500]->XX.XX.XX.XX[500] spi=4188915109(0xf9adc5a5)

===== setkey -D =====

YY.YY.YY.YY XX.XX.XX.XX
        esp mode=tunnel spi=4188915109(0xf9adc5a5) reqid=0(0x00000000)
        E: aes-cbc  106ad0d2 b5a3dd9d a00829c9 dae9c0d6
        A: hmac-md5  f89ecc13 ccd3f159 356dcae3 b58fbe85
        seq=0x00000000 replay=4 flags=0x00000000 state=mature
        created: Sep 17 00:19:09 2010   current: Sep 17 00:20:01 2010
        diff: 52(s)     hard: 43200(s)  soft: 34560(s)
        last: Sep 17 00:19:10 2010      hard: 0(s)      soft: 0(s)
        current: 2100(bytes)    hard: 0(bytes)  soft: 0(bytes)
        allocated: 25   hard: 0 soft: 0
        sadb_seq=1 pid=27294 refcnt=0
XX.XX.XX.XX YY.YY.YY.YY
        esp mode=tunnel spi=106298393(0x0655fc19) reqid=0(0x00000000)
        E: aes-cbc  f1757b1e 06f13546 418203a0 9716ca8b
        A: hmac-md5  d6f4af0f e2b425e9 dc31ce61 ed29ba1c
        seq=0x00000000 replay=4 flags=0x00000000 state=mature
        created: Sep 17 00:19:09 2010   current: Sep 17 00:20:01 2010
        diff: 52(s)     hard: 43200(s)  soft: 34560(s)
        last: Sep 17 00:19:10 2010      hard: 0(s)      soft: 0(s)
        current: 2100(bytes)    hard: 0(bytes)  soft: 0(bytes)
        allocated: 25   hard: 0 soft: 0
        sadb_seq=0 pid=27294 refcnt=0

以上です。

オフライン

 

Board footer

Powered by FluxBB