把鍵盤上的H&M扣下來扔了。也算是抵制了吧?
GRE VPN
- 配置IP位址、DHCP、路由、NAT
- 内網可以通路公網2.2.2.2
- 配置GRE VPN
- PC1能直接通路PC2
青海分部IP位址、DHCP、NAT、路由
sys
sys QH
dhcp enable
acl 2000
rule permit so 192.168.10.0 0.0.0.255
int g0/0/0
ip add 192.168.10.254 24
dhcp sel int
int g0/0/1
ip add 12.0.0.1 24
nat outbound 2000
ip route-s 0.0.0.0 0 12.0.0.2
上海總部IP位址、DHCP、NAT、路由
sys
sys SH
dhcp enable
acl 2000
rule permit so 192.168.20.0 0.0.0.255
int g0/0/1
ip add 192.168.20.254 24
dhcp sel int
int g0/0/0
ip add 23.0.0.3 24
nat outbound 2000
ip route-s 0.0.0.0 0 23.0.0.2
ISP公網
sys
sys ISP
int g0/0/0
ip add 12.0.0.2 24
int g0/0/1
ip add 23.0.0.2 24
int lo 2
ip add 2.2.2.2 32
PC1
PC2
青海分部
interface Tunnel0/0/1
tunnel-protocol gre
source 12.0.0.1
destination 23.0.0.3
上海總部
interface Tunnel0/0/1 #建立隧道口
tunnel-protocol gre #指定協定
source 23.0.0.3 #指定隧道源
destination 12.0.0.1 #指定隧道目标
配置完GRE隧道發現PC1和PC2還ping 不通,因為沒有路由。
靜态路由
青海分部
ip route-static 192.168.20.0 255.255.255.0 Tunnel0/0/1
ip route-static 192.168.20.0 255.255.255.0 192.168.13.3
ip route-static 192.168.10.0 255.255.255.0 Tunnel0/0/1
ip route-static 192.168.10.0 255.255.255.0 192.168.13.1
PC1與PC2之間互通,GRE VPN建成功
動态路由
實際的生産環境中基本上用的都是動态路由ospf
ospf 1 router-id 1.1.1.1
area 0
net 192.168.10.0 0.0.0.255
net 192.168.13.0 0.0.0.255
ospf 1 router-id 3.3.3.3
area 0
net 192.168.20.0 0.0.0.255
net 192.168.13.0 0.0.0.255
OSPF鄰居建立成功
PC1與PC2仍然能通。
GRE 隧道路由宣告注意事項:使用動态路由協定宣告接口時千萬不能宣告公網接口。
測試
OSPF程序中宣告公網接口
ospf 1 router-id 1.1.1.1
area 0
net 12.0.0.1 0.0.0.0
OSPF鄰居down了,一會又開始重建立鄰居變成了full。這個過程反複重複。
PC1和PC2之間ping不通!!!
驗證隧道、路由表
GRE:Generic Routing Encapsulation,通用路由封裝
- 一種三層VPN封裝技術
- 在任意一種網絡協定上傳送任意一種其它網絡協定的封裝方法
- 解決了跨越異種網絡的封包傳輸問題,異種封包傳輸的通道稱為Tunnel(隧道)
GRE VPN隧道口虛假狀态問題:隻要有到達隧道目标的路由,隧道口即可激活
解決方法:開啟GRE的Keeplive,用于檢測隧道對端是否可達。
把上海總部R2的 Tunnel0/0/1 删掉
OSPF鄰居down了
分部路由器上的Tunnel口狀态都是up(隧道口虛假狀态)。
在R1上配置Keeplive,檢測到了R3路由器上的Tunnel口down了。
GRE隧道恢複正常!!!