簡單GRE隧道搭建

2021-10-04 17:21:06 字數 1247 閱讀 5337

2.1.1.配置ip

r1:#ip link set eth0 up

#ip addr add 169.254.1.108/24 dev eth0

#ip link set eth1 up

#ip addr add 169.254.2.108/24 dev eth1

r2:#ip link set eth0 up

#ip addr add 169.254.1.109/24 dev eth0

#ip link set eth1 up

#ip addr add 169.254.3.109/24 dev eth1

2.1.2.建立gre介面

r1:#ip tunnel add gre1 mode gre local 169.254.1.108 remote 169.254.1.109 dev eth0 key 1 csum (隧道介面位址local、remote)

#ip link set gre8 up

#ip addr add 10.10.10.1 peer 10.10.10.2/24 dev gre1 (隧道內位址)

r2:#ip tunnel add gre1 mode gre local 169.254.1.109 remote 169.254.1.108 dev eth0 key 1 csum (隧道介面位址local、remote)

#ip link set gre9 up

#ip addr add 10.10.10.2 peer 10.10.10.1/24 dev gre1 (隧道內位址)

2.1.3.建立靜態路由

r1:#ip route 169.254.3.0/24 via 10.10.10.1

r2:#ip route 169.254.2.0/24 via 10.10.10.2

2.2.1.建立gre介面及配置

r1:(只需配置紅框內即可,r2同理)

2.2.2.建立靜態路由(若使用動態路由協議則不需要手動建立)(1)在gre介面開啟(up)的情況下,在l2機器ping r1 機器的eth0、eth1有回應;

(2)在gre介面關閉(down)的情況下,在l2機器ping r1 機器的eth0、eth1無回應。

抓包分析:

Linux下搭建gre隧道

server1 搭建gre隧道server2 pc1 ping 通pc2 範例 基於h560n server1 ip 192.168.1.253 pc1 ip 192.168.2.3 server2 ip 192.168.1.3 pc1 ip 192.168.3.3 server1端配置 載入gre...

華為 GRE實驗(GRE隧道)

每日一句 we are all in the gutter,but some of us arelooking at the stars.我們都生活在陰溝裡,但仍有人仰望星空。奧斯卡 王爾德 公司1和公司2之間通過gre隧道傳輸192.168.10.0 24 和 192.168.20.0 24資料流...

linux搭建GRE隧道 麼啥好說的

gre介紹 gre隧道是一種ip over ip的隧道,是通用路由封裝協議,可以對某些網路層協議的資料報進行封裝,使這些被封裝的資料報能夠在ipv4 ipv6 網路中傳輸。tunnel 是乙個虛擬的點對點的連線,提供了一條通路使封裝的資料報文能夠在這個通路上傳輸,並且在乙個tunnel 的兩端分別對...