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

久しぶりにGNS3(その5:トンネリング:GRE over IPsec)

Posted at

GRE over IPsecにトライ

本シリーズその4ではIPsecを確認した。IPsec(VPN)上で、EIGRPなどマルチキャストをベースとするルーティングプロトコルを扱うには、「GRE over IPsec」を扱う必要があるとのこと。ここではGNS3上でそれを確認する。

参考にしたサイト

  1. GRE over IPsec
  2. GRE over IPSecの設定

1ではパケットの構造がわかりやすく記載されている。簡単に言うと、IPsecヘッダ+GREヘッダ+IPヘッダ、、、という構造となっている(トンネルモードの場合)。GNS3での設定方法については、上記2および本シリーズその3を参考にした。

対象ネットワーク

GREoverIPsec_Topology.png
ルーターR1とルーターR2とを間をGRE over IPsec化(トンネリング)する。また、R1およびR2には、それぞれ、ローカルネットワーク10.1.1.0/24および10.2.2.0/24が接続されている。

各ルーターの設定

(PC1およびPC2の設定はほぼ自明のため省略。)

R1

IKE(鍵交換プロトコル)の設定。

crypto isakmp policy 11
 encr aes
 authentication pre-share
 group 2
crypto isakmp key testpwd address 192.168.20.22
  • Priority:11(1:High - 65534:Low)
  • 暗号化アルゴリズム:AES
  • 事前鍵交換方式(パスワード:testpwd)
  • Diffie-Hellman交換:グループ2
  • 相手先IPアドレス:192.168.20.22(対向ルーターR2)

IPsecの設定。

crypto ipsec transform-set IPSEC-TEST esp-aes esp-sha-hmac 

crypto ipsec profile GREoverIPSec
 set transform-set IPSEC-TEST 
  • transform-set名称:IPSEC-TEST
  • 暗号化アルゴリズム:AES
  • ハッシュアルゴリズム:SHA
  • プロファイル名:GREoverIPSec(transform-set名称とリンク)

トンネリングI/Fおよび物理I/Fの設定。

interface Tunnel1
 ip address 172.16.1.1 255.255.255.0
 tunnel source FastEthernet0/0
 tunnel destination 192.168.20.22
 tunnel mode ipsec ipv4
 tunnel protection ipsec profile GREoverIPSec
      
interface FastEthernet0/0
 ip address 192.168.10.11 255.255.255.0
       
interface FastEthernet0/1
 ip address 10.1.1.254 255.255.255.0
  • トンネリングI/FのIPアドレス設定
  • トンネリングの送信元設定:FastEthernet0/0
  • トンネリングの相手先設定:対向ルーターR2のIPアドレス
  • トンネリングでIPsecおよびIPv4利用
  • トンネリングプロファイル選択
  • 物理I/FのIPアドレス設定

ルーティング設定。

router eigrp 11
 network 10.1.1.0 0.0.0.255
 network 172.16.1.0 0.0.0.255
 no auto-summary

ip route 192.168.20.22 255.255.255.255 FastEthernet0/0
  • EIGRP対象となるネットワークの選択:10.1.1.0/24および172.16.1.0/24(トンネリングのネットワーク)
  • 対向ルーターR2のIPアドレスへのスタティックルート設定

R2

R1とほぼ同じのため、説明省略。

crypto isakmp policy 11
 encr aes
 authentication pre-share
 group 2
crypto isakmp key testpwd address 192.168.10.11

crypto ipsec transform-set IPSEC-TEST esp-aes esp-sha-hmac 

crypto ipsec profile GREoverIPSec
 set transform-set IPSEC-TEST 

interface Tunnel1
 ip address 172.16.1.2 255.255.255.0
 tunnel source FastEthernet0/0
 tunnel destination 192.168.10.11
 tunnel mode ipsec ipv4
 tunnel protection ipsec profile GREoverIPSec
        
interface FastEthernet0/0
 ip address 192.168.20.22 255.255.255.0

interface FastEthernet0/1
 ip address 10.2.2.254 255.255.255.0

router eigrp 11
 network 10.2.2.0 0.0.0.255
 network 172.16.1.0 0.0.0.255
 no auto-summary

ip route 192.168.10.11 255.255.255.255 FastEthernet0/0

ISP

interface FastEthernet0/0
 ip address 192.168.10.1 255.255.255.0

interface FastEthernet0/1
 ip address 192.168.20.1 255.255.255.0

ここはほぼ自明。説明略。

実験

ルーターR1の状況

起動直後のWiresharkデータは下記のとおり。
ARPISAKMPIPSEC.png
ARPによる対向ルーターR2のMacアドレス取得(ルーターISPが応答)、IKEによる鍵交換、IPSecと続いている。

EIGRPパケットも暗号化されてしまっているので、EIGRPパケットの状況をデバッグコマンドを用いて確認。

R1#debug eigrp packets 
EIGRP Packets debugging is on
    (UPDATE, REQUEST, QUERY, REPLY, HELLO, IPXSAP, PROBE, ACK, STUB, SIAQUERY, SIAREPLY)
R1#
*Mar  1 00:03:45.859: EIGRP: Sending HELLO on FastEthernet0/1
*Mar  1 00:03:45.859:   AS 11, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0
*Mar  1 00:03:46.039: EIGRP: Sending HELLO on Tunnel1
*Mar  1 00:03:46.039:   AS 11, Flags 0x0, Seq 0/0 idbQ 1/0 iidbQ un/rely 0/0
*Mar  1 00:03:46.663: EIGRP: Received HELLO on Tunnel1 nbr 172.16.1.2
*Mar  1 00:03:46.663:   AS 11, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0 peerQ un/rely 0/0
R1#
*Mar  1 00:03:50.495: EIGRP: Sending HELLO on FastEthernet0/1
*Mar  1 00:03:50.495:   AS 11, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0
*Mar  1 00:03:50.619: EIGRP: Sending HELLO on Tunnel1
*Mar  1 00:03:50.619:   AS 11, Flags 0x0, Seq 0/0 idbQ 1/0 iidbQ un/rely 0/0
R1#
*Mar  1 00:03:54.959: EIGRP: Sending HELLO on FastEthernet0/1
*Mar  1 00:03:54.959:   AS 11, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0
*Mar  1 00:03:55.131: EIGRP: Sending HELLO on Tunnel1
*Mar  1 00:03:55.131:   AS 11, Flags 0x0, Seq 0/0 idbQ 1/0 iidbQ un/rely 0/0
R1#
*Mar  1 00:03:56.603: EIGRP: Received HELLO on Tunnel1 nbr 172.16.1.2
*Mar  1 00:03:56.603:   AS 11, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0 peerQ un/rely 0/0

マルチキャストHELLOパケットがトンネリングI/FであるTunnel 1から送受信されているのがわかる。

R1からPC2(R2のローカルネットワーク上のPC)へのping

R1#ping 10.2.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/41/44 ms

PC1(R1のローカルネットワーク上のPC)からPC2(R2のローカルネットワーク上のPC)へのping


OK。

PC1> ping 10.2.2.2 -c 10
10.2.2.2 icmp_seq=1 timeout
10.2.2.2 icmp_seq=2 timeout
84 bytes from 10.2.2.2 icmp_seq=3 ttl=62 time=43.820 ms
84 bytes from 10.2.2.2 icmp_seq=4 ttl=62 time=35.630 ms
84 bytes from 10.2.2.2 icmp_seq=5 ttl=62 time=52.023 ms
84 bytes from 10.2.2.2 icmp_seq=6 ttl=62 time=57.209 ms
84 bytes from 10.2.2.2 icmp_seq=7 ttl=62 time=55.340 ms
84 bytes from 10.2.2.2 icmp_seq=8 ttl=62 time=57.745 ms
84 bytes from 10.2.2.2 icmp_seq=9 ttl=62 time=56.519 ms
84 bytes from 10.2.2.2 icmp_seq=10 ttl=62 time=54.070 ms

最初にタイムアウトが発生しているが、GatewayのMacアドレス取得に時間がかかっているだけで、問題なし。

ISPからPC2へのping

ISP#ping 10.2.2.2 

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.2.2.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

前述のとおり、ISPにはIPアドレス10.2.2.2(PC2)へのルーティング情報がないので、当然応答なし。OK。

ルーティング情報など

R1

R1#show ip route
(略)

C    192.168.10.0/24 is directly connected, FastEthernet0/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, Tunnel1
     192.168.20.0/32 is subnetted, 1 subnets
S       192.168.20.22 is directly connected, FastEthernet0/0
     10.0.0.0/24 is subnetted, 2 subnets
D       10.2.2.0 [90/297270016] via 172.16.1.2, 00:09:46, Tunnel1
C       10.1.1.0 is directly connected, FastEthernet0/1

EIGRPにより、対向ルーターR2にぶら下がるネットワーク10.2.2.0/24への経路が表示されている。EIGRP情報は下記のとおり。

R1#show ip eigrp neighbors 
IP-EIGRP neighbors for process 11
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
0   172.16.1.2              Tu1                7 00:10:23  158  5000  0  5

R1#show ip eigrp topology 
IP-EIGRP Topology Table for AS(11)/ID(192.168.10.11)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
       r - reply Status, s - sia Status 

P 10.2.2.0/24, 1 successors, FD is 297270016
        via 172.16.1.2 (297270016/281600), Tunnel1
P 10.1.1.0/24, 1 successors, FD is 281600
        via Connected, FastEthernet0/1
P 172.16.1.0/24, 1 successors, FD is 297244416
        via Connected, Tunnel1

R2

R2#show ip route
(略)

     192.168.10.0/32 is subnetted, 1 subnets
S       192.168.10.11 is directly connected, FastEthernet0/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, Tunnel1
C    192.168.20.0/24 is directly connected, FastEthernet0/0
     10.0.0.0/24 is subnetted, 2 subnets
C       10.2.2.0 is directly connected, FastEthernet0/1
D       10.1.1.0 [90/297270016] via 172.16.1.1, 00:06:08, Tunnel1

R2#show ip eigrp neighbors 
IP-EIGRP neighbors for process 11
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
0   172.16.1.1              Tu1               14 00:06:24  535  5000  0  4

R2#show ip eigrp topology 
IP-EIGRP Topology Table for AS(11)/ID(192.168.20.22)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
       r - reply Status, s - sia Status 

P 10.1.1.0/24, 1 successors, FD is 297270016
        via 172.16.1.1 (297270016/281600), Tunnel1
P 10.2.2.0/24, 1 successors, FD is 281600
        via Connected, FastEthernet0/1
P 172.16.1.0/24, 1 successors, FD is 297244416
        via Connected, Tunnel1

ISP

ISP#show ip route
(略)

C    192.168.10.0/24 is directly connected, FastEthernet0/0
C    192.168.20.0/24 is directly connected, FastEthernet0/1
1
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
1
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?