1
1

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 1 year has passed since last update.

CenturyルーターでIPsec

Posted at

Centuryルーターでサイト間IPsecを実現

Centuryルーター2台を用いて、NAT環境下でIPsec-VPNを実現したときのメモ。

ネットワーク構成

image.png

  • Router1とRouter2とがIPsec化
  • 左側がNAT内側、右側がNAT外側
  • Router1のWAN IPアドレスはDHCPにより取得、Router2のWAN IPアドレスは固定IPアドレス(aaa.bbb.ccc.ddd)
  • LAN側ネットワークは、左側が192.168.20.0/24、右側が192.168.10.0/24
  • 用いたRouterは”NXR-G110”

設定

情報はあるが、、

下記メーカーサイトに設定情報が記載されていたが、これではうまく動作せず、、であった(小生の環境が不適切であっただけかもしれないが)。

GUI

いつもはCLIで設定することが多いが、方針を変更して、GUIによる設定を行ったところ、正しく動作した。その内容を下記する。

ログイン

Loginのコピー.JPG

  • ポート800でアクセス

インターフェース

Interfaceのコピー.JPG

  • Router1のインターフェース設定
    • "ehternet0"がLAN側
    • "ethernet1"がWAN側
  • Router2では、ethernet1(WAN)側は固定IPアドレス設定

NAT

NAT2のコピー.JPG

  • ethernet1(WAN)にマスカレードを適用

IPsecトンネル

IPsecTunnel1のコピー.JPG
IPsecTunnel2のコピー.JPG

  • リモート(接続先)アドレスを指定(Router1のみ)
  • リモート(接続先)もローカル(自分)もIDとして、KEY-IDを指定し、同じ内容を入力
  • 認証方式はPSK、同じパスワードを入力
  • トンネルの対象となる送信元アドレスおよび宛先アドレスの指定
  • NATトラバーサル使用

設定状況は下記となる。
image.png

スタティックルート

image.png
リモートのLAN側ネットワークはトンネルインターフェースを利用。

設定情報

GUIで設定した内容のコンフィグである。関連するところのみ記載。

Router1

ipsec local policy 1
 address ip 
 self-identity key himitsu2
!
ipsec isakmp policy 1
 version 2
 authentication pre-share himitsu1
 authentication remote pre-share himitsu1
 hash sha256
 encryption aes128
 group 2
 isakmp-mode aggressive
 remote address ip aaa.bbb.ccc.ddd
 remote identity key himitsu2
 local policy 1
!
ipsec tunnel policy 1
 description Client
 set transform esp-aes128 esp-sha256-hmac 
 set key-exchange isakmp 1
 match address __webipsec1 nat-traversal  # ここにNATトラバーサルの設定があることが特徴
!
interface tunnel 0
 no ip address
 tunnel mode ipsec ipv4
 tunnel protection ipsec policy 1
!
interface ethernet 0
 ip address 192.168.20.1/24
!
interface ethernet 1
 ip address dhcp 
 ip masquerade
 ipsec policy 1
!
ip route 192.168.10.0/24 tunnel 0
!
ipsec access-list __webipsec1 ip 192.168.20.0/24 192.168.10.0/24

Router2

ipsec local policy 1
 address ip 
 self-identity key himitsu2
!
ipsec isakmp policy 1
 version 2
 authentication pre-share himitsu1
 authentication remote pre-share himitsu1
 hash sha256
 encryption aes128
 group 2
 isakmp-mode aggressive
 remote address ip any
 remote identity key himitsu2
 local policy 1
!
ipsec tunnel policy 1
 description Client
 set transform esp-aes128 esp-sha256-hmac 
 set key-exchange isakmp 1
 match address __webipsec1 nat-traversal  # ここにNATトラバーサルの設定があることが特徴
!
interface tunnel 0
 no ip address
 tunnel mode ipsec ipv4
 tunnel protection ipsec policy 1
!
interface ethernet 0
 ip address 192.168.10.1/24
!
interface ethernet 1
 ip address aaa.bbb.ccc.ddd/24
 ip masquerade
 ipsec policy 1
!
ip route 0.0.0.0/0 aaa.bbb.ccc.1
ip route 192.168.20.0/24 tunnel 0
!
ipsec access-list __webipsec1 ip 192.168.10.0/24 192.168.20.0/24

上記は、メーカーサイトの下記記載とは異なる。

なお、ESPパケットが流れるだけなので、パケットデータは省略。

EOF

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?