スポンサーリンク
スポンサーリンク

GRE Tunnel – エミュレータによる動作検証 (Routing Static / OSPF) 

 

この記事でわかる事

・GRE Tunnel 設定の設定
・GRE Tunnel を使ったコンフィグ
・Static と ospf によるルーティング設定
・GRE Tunnel利用時のフレームオーバヘッド
・GRE通信時のパケットキャプチャ (Wireshark)

検証NW構成

●GRE Tunnelの設定

interface Tunnel [<0-2147483647>] //Tunnel番号は 双方ルータで合わせる必要無し
ip address x.x.x.x  mask //Tunnelを張るルータと同一セグメントにする
tunnel source y.y.y.y //物理IFの送信元アドレス
tunnel destination z.z.z.z //物理IFの宛先アドレス

tunnel destination への到達性が無い場合、Up/downになる事により、GRE Tunnelが張れません。Tunnelが張れない場合、tunnel destinationへの到達性を確認した方が良いです。

R1#show ip interface brief
Tunnel0   1.1.1.1    YES    manual   up   down

検証コンフィグ (Static route)

R1-config

hostname R1
!
interface Tunnel0
ip address 1.1.1.1 255.255.255.0
tunnel source 10.1.1.1
tunnel destination 10.1.1.2
!
interface GigabitEthernet0/0
ip address 10.1.1.1 255.255.255.0
duplex auto
speed auto
media-type rj45
!
interface GigabitEthernet0/1
ip address 192.168.1.254 255.255.255.0
duplex auto
speed auto
media-type rj45
!
ip route 192.168.2.100 255.255.255.255 Tunnel0

Static routeの場合は、宛先セグメントのNext-hopをTunnel IFに設定する。
R2-config

hostname R2
!
interface Tunnel0
ip address 1.1.1.2 255.255.255.0
tunnel source 10.1.1.2
tunnel destination 10.1.1.1
!
interface GigabitEthernet0/0
ip address 10.1.1.2 255.255.255.0
duplex auto
speed auto
media-type rj45
!
interface GigabitEthernet0/1
ip address 192.168.2.254 255.255.255.0
duplex auto
speed auto
media-type rj45
!
ip route 192.168.1.100 255.255.255.255 Tunnel0

show ip route ospf (static)

R1-ルーティングテーブル

R1#show ip route static
Gateway of last resort is not set

192.168.2.0/32 is subnetted, 1 subnets
S 192.168.2.100 is directly connected, Tunnel0

R2-ルーティングテーブル

R2#show ip route static
Gateway of last resort is not set

192.168.1.0/32 is subnetted, 1 subnets
S 192.168.1.100 is directly connected, Tunnel0

検証コンフィグ (OSPF)

R1-config

hostname R1
!
interface Tunnel0
ip address 1.1.1.1 255.255.255.0
tunnel source 10.1.1.1
tunnel destination 10.1.1.2
!
interface GigabitEthernet0/0
ip address 10.1.1.1 255.255.255.0
duplex auto
speed auto
media-type rj45
!
interface GigabitEthernet0/1
ip address 192.168.1.254 255.255.255.0
duplex auto
speed auto
media-type rj45
!
router ospf 1
passive-interface GigabitEthernet0/1
network 1.1.1.1 0.0.0.0 area 0
network 192.168.1.0 0.0.0.255 area 0

OSPFを動かすのはTunnele IFとLAN IF
R2-config

hostname R2
!
interface Tunnel0
ip address 1.1.1.2 255.255.255.0
tunnel source 10.1.1.2
tunnel destination 10.1.1.1
!
interface GigabitEthernet0/0
ip address 10.1.1.2 255.255.255.0
duplex auto
speed auto
media-type rj45
!
interface GigabitEthernet0/1
ip address 192.168.2.254 255.255.255.0
duplex auto
speed auto
media-type rj45
!
router ospf 1
passive-interface GigabitEthernet0/1
network 1.1.1.2 0.0.0.0 area 0
network 192.168.2.0 0.0.0.255 area 0

show ip route ospf (OSPF)

R1-ルーティングテーブル

R1#show ip route ospf
Gateway of last resort is not set

O 192.168.2.0/24 [110/1001] via 1.1.1.2, 00:05:08, Tunnel0

R2-ルーティングテーブル

R2#show ip route ospf
Gateway of last resort is not set

O 192.168.1.0/24 [110/1001] via 1.1.1.1, 00:05:16, Tunnel0

オーバヘッド(GREヘッダ)

GRE Tunnelを利用することにより、オーバーヘッドが生じます。つまりフレーム長が大きくなります。何byte増えるのかは、MSS/MTU/Packet Fragmentの観点から把握する必要があります。

■GREを使わない場合、ICMP(64byte)送信時
フレーム全体は98byteになります。

Ethernet IP icmp
14byte 20byte 64byte

■GREを使う場合、ICMP(64byte)送信時
フレーム全体は122byteになります。

Ethernet IP GRE IP icmp
14byte 20byte 4byte 20byte 64byte

■結果
GRE ヘッダ(4byte) + IPヘッダ(20byte) = 24byteがオーバヘッダ分になります。

 

GRE通信時のパケットキャプチャ (Wireshark)

GRE Tunnelを通るフレームをキャプチャするとどう見えるのか?

【Wireshark より】

1行目:TunnelのSource IP と Dest IP  (20byte)
2行目:GREヘッダ (4byte)
3行目:End to End のSource IP と Dest IP  (20byte)
4行目:ICMPを送信

スポンサーリンク