1、GRE介紹
linux
GRE(Generic Routing Encapsulation)即通用路由封裝協議,是有Cisco公司開發的一項輕量級隧道協議(目前網絡廠商基本都支持GRE協議)。它可以將各類網絡協議(IP協議與非IP協議)封裝在隧道內。GRE之因此稱爲輕量級隧道協議時由於GRE頭部小,因此封裝效率高。可是GRE沒有任何安全機制,是以明文方式傳輸,可經過抓包看到Tunnl IP信息。通常都是使用IPSec來對GRE進行加密保護。安全
GRE是一種典型的三層隧道封裝技術,其數據包格式以下:網絡
GRE數據包實際格式ide
2.1 GRE隧道測試邏輯拓撲oop
2.2 GRE隧道測試設備命名及IP地址分配信息測試
2.3 測試拓撲及軟件版本描述加密
本次測試使用的是GNS3 IOU L3鏡像進行測試,版本爲i86bi-linux-l3-adventerprisek9-15.5.2Tspa
2.4 GRE邏輯拓撲圖router
HQ-Route基本網絡配置blog
interface Loopback0
ip address 192.168.10.1 255.255.255.0
interface Ethernet0/0
ip address 20.20.10.10 255.255.255.0
ip route 0.0.0.0 0.0.0.0 20.20.10.1
end
ISP-Route基本網絡配置
interface Ethernet0/0
ip address 20.20.10.1 255.255.255.0
interface Ethernet0/1
ip address 20.20.20.1 255.255.255.0
end
BR-Route基本網絡配置
interface Loopback0
ip address 192.168.20.1 255.255.255.0
interface Ethernet0/1
ip address 20.20.20.10 255.255.255.0
ip route 0.0.0.0 0.0.0.0 20.20.20.1
end
配置完成基礎網絡後,就能夠開始gre tunnl的配置,並配置ospf動態路由
4.1 配置GRE Tunnl
HQ-Route
interface Tunnel0
ip address 172.16.10.1 255.255.255.252
tunnel source 20.20.10.10
tunnel destination 20.20.20.10
BR-Route
interface Tunnel0
ip address 172.16.10.2 255.255.255.252
tunnel source 20.20.20.10
tunnel destination 20.20.10.10
4.2 配置OSPF
HQ-Route
router ospf 100
router-id 172.16.10.1
network 172.16.10.0 0.0.0.3 area 0
network 192.168.10.0 0.0.0.255 area 0
BR-Route
router ospf 100
router-id 172.16.10.2
network 172.16.10.0 0.0.0.3 area 0
network 192.168.20.0 0.0.0.255 area 0
在HQ-Route中帶源ping BR-Route中lo0地址