0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【後編②】ネットワーク構築(IPsec)

Posted at

今回やること

前回の構築の引き続きとなります。

前回の記事
【前編】ネットワーク構築(IPsec)
【後編①】ネットワーク構築(IPsec)

前回設定した内容まとめ

どこまでやったか分からなくなるので、設定した内容をまとめます。
改めてフェーズも調べました。

IKEフェーズ パラメータ R1ステータス
1 事前共有鍵 kensyo
2 暗号アルゴリズム esp-aes
2 ハッシュアルゴリズム esp-sha-hmac
2 トランスフォームセット名前 KENSYO

投入したコマンドもまとめます。

コマンド 説明
crypto isakmp policy 1 ISAKMPポリシーの定義 ※1
authentication pre-share 認証方式をpre-shareに設定
crypto isakmp key 0 kensyo address 192.168.12.2 事前共有鍵の設定。パスはkensyo
crypto ipsec transform-set KENSYO esp-aes esp-sha-hmac トランスフォームセット定義

※1 補足としてpriorityは1~10000まで設定できる。

この状態でwriteして中断したはずです。
では早速構築再開していきます。

構築

では早速前回の続きからスタートします。

まずはACLを設定してあげます。
IPsec対象のトラフィックを指定するためですね。

R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#acc
R1(config)#$ 100 permit ip 192.168.10.0 0.0.0.255 192.168.20.0 0.0.0.255
R1(config)#access-list 100 permit ip 192.168.10.0 0.0.0.255 192.168.20.0 0.0.0$
R1(config)#

なんだ$は!?
となって2回コマンドを叩きましたが、長すぎるとでるやつっぽい?
調べてみようとするも、HITせず。
バックスペースで消していくとコマンドがつらつらでてきたのでOKでしょう。

ACLはトラフィック指定するために拡張ACLで設定してあげます。
なので100の値で設定します。

次に暗号マップを設定してあげます。
今まで設定きたやつをグループ化してあげる?みたいな勝手なイメージを持っています。

R1(config)#
R1(config)#cry
R1(config)#crypto map BENKYO 1 ipse
R1(config)#crypto map BENKYO 1 ipsec-isakm
R1(config)#crypto map BENKYO 1 ipsec-isakmp ?
  dynamic  Enable dynamic crypto map support
  profile  Enable crypto map as a crypto-profile
  <cr>

R1(config)#crypto map BENKYO 1 ipsec-isakmp              ※暗号マップ定義
% NOTE: This new crypto map will remain disabled until a peer
        and a valid access list have been configured.
R1(config-crypto-map)#

英語がいっぱいでてきましたね。
わからん!

【翻訳】
この新しい暗号マップは、ピアになるまで無効のままになります
有効なアクセスリストが設定されている

とりあえず対向のR2の設定投入してピア確立すれば有効になるっていうことかな?

OKそうなので続行。

では対象トラフィックの指定とピアの設定とトランスフォームセットの指定をしていきます。

R1(config-crypto-map)#
R1(config-crypto-map)#mat
R1(config-crypto-map)#match add
R1(config-crypto-map)#match address 100     ※ACL指定
R1(config-crypto-map)#set pe
R1(config-crypto-map)#set peer 192.168.12.2   ※対向のR2とピア
R1(config-crypto-map)#set tr
R1(config-crypto-map)#set transform-set KENSYO ※作ったトランスフォームセット名前指定
R1(config-crypto-map)#

これでR1への一通りの設定が完了しました。(多分・・・)

各インターフェイスを設定していきます。

R1(config)#
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.12.2
R1(config)#int f0/1
R1(config-if)#ip add 192.168.10.1
% Incomplete command.

R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#
R1(config)#
*Mar  1 03:54:34.592: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 03:54:35.593: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config)#int f0/0
R1(config-if)#ip add 192.168.12.1 255.255.255.0
R1(config-if)#

F0/0には暗号マップを適用しなくてはいけません。
なので割り当てていきます。

R1(config-if)#cry
R1(config-if)#crypto map
R1(config-if)#crypto map BENKYO
R1(config-if)#
*Mar  1 03:56:17.729: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON
R1(config-if)#no sh
R1(config-if)#end
R1#

これでR1の設定は完了したはずです!
予定時間超過のため、ここまでで中断します。

R1#write memo
Warning: Attempting to overwrite an NVRAM configuration previously written
by a different version of the system image.
Overwrite the previous NVRAM configuration?[confirm]y
Building configuration...
[OK]
R1#

例のごとくwriteを忘れず。

まとめ

いやー調べながら設定をしてみましたが、ひとつのルーターに投入するだけでも結構かかりました。
恐るべしIPsec・・・

なんとなく感覚はつかめたので、今後も細かい暗号化アルゴリズムだったりハッシュアルゴリズムだったり
ライフタイムの設定などの理解がまだまだなので、引き続き勉強したいと思います。

以上となります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?