2012年4月6日 星期五

奇科電腦 使用GRE建立site-to-site VPN tunnel

<更多技術小秘訣請參考http://www.geego.com.tw/tech_support/new-tips>

為了方便企業在不同地理區域也能共同分享各分部的資源,企業總部與分部之間可以建立VPN通道達成資源分享的目的,本篇介紹以Cisco GRE(Generic Routing Encapsulation) 的方式來建立VPN通道

文件RFC2784(http://tools.ietf.org/html/rfc2784) 定義了GRE(Generic Routing Encapsulation)的規範,是一個簡單的IP封包封裝協定,GRE通道可以讓路由器連接兩個不同的區域網路達成一種VPN的效果

GRE tunnel
------------site A -- -- -- -- -- -- -- -- siteB-------------
59.12.30.9   211.22.33.99

================================================
Site A configuration:
#create gre tunnel
/sbin/ip tunnel add HQ_branch mode gre remote 211.22.33.99 \
local 59.12.30.9 ttl 255 dev eth0 key 1.2.3.4

# bring up gre tunnel interface
ip link set HQ_branch up

# assign gre tunnel ip
/sbin/ip addr add 10.1.255.1/32 peer 10.2.255.1/32 dev HQ_Branch
ifconfig HQ_Branch multicast
================================================
Site B configuration:

# add gre tunnel to hq
/sbin/ip tunnel add Branch_HQ mode gre remote 59.12.30.9 \
local 211.22.33.99 ttl 255 dev eth0 key 1.2.3.4

# bring up gre tunnel interface
/sbin/ip link set Branch_HQ up

# assign ip to gre tunnel
/sbin/ip addr add 10.2.255.1/32 peer 10.1.255.1/32 dev Branch_HQ
ifconfig Branch_HQ multicast
=================================================

沒有留言:

張貼留言