文章目录
GRE 隧道的实现(仅隧道,不支持加密)
拓扑图(规划)
第一:在vpn网关上创建gre隧道(两端都要)
interface Tunnel0/0/0
ip address 10.0.0.1 255.255.255.0 #隧道ip这个ip经过测试,可以是公网IP,但是建议使用私有IP(节约IP)
tunnel-protocol gre #设置封装协议
source 118.169.17.3 #设置gre本端,可以是本端公网出口IP,也可是出接口
destination 117.169.17.1 #设置gre对端,必须是对端公网地址
第二:检查gre隧道是否正常建立连接(是否协议up,状态up)
第三:引流(可使用静态或ospf,rip等),介绍静态路由的方式引流到gre隧道中(两端都要)
第四:测试两端的主机互ping,是否能通
display interface Tunnel 0/0/0
ip route-static 192.168.2.0 24 Tunnel 0/0/0 #可以是隧道口,也可以是隧道对端的IP
ping 10.0.0.1
ping 192.168.2.1
gre优化(在仅用做GRE隧道时可选,但在与其他协议连用时,不能使用)
第五:使能GRE隧道的校验和功能
#为了增强GRE隧道的安全性,可以对GRE隧道两端进行端到端校验或者设置GRE隧道的识别关键字,通过这种安全机制防止错误识别、接收其它地方来的报文
interface Tunnel0/0/0
gre checksum
第六:配置GRE隧道的识别关键字
#如果在隧道两端的Tunnel接口配置识别关键字,则必须指定相同的识别关键字;或隧道两端都不配置此命令。如果使用plain选项,
#识别关键字将以明文形式保存在配置文件中,存在安全隐患。建议使用cipher选项,将识别关键字加密保存。
interface Tunnel0/0/0
gre key 1
第七:监测链路是否可用,若是不可用则关闭gre隧道(尴尬的是,关闭后不会自动打开)
#配置5s发送一次,重试次数3次,通过在接口下disp keepalive packets count命令可查看发送了多少个keepalive报文
interface Tunnel0/0/0
keepalive period 5 retry-times 3
gre over ipsec的实现(安全加密),并跨公网运行ospf协议,联通两个内网
拓扑图(规划)
第一:创建IKE提议
ike proposal 1
encryption-algorithm 3des-cbc
authentication-algorithm md5
第二:配置IKE对等体
ike peer r3 v2
pre-shared-key simple test
ike-proposal 1
第三:配置IPSEC提议
ipsec proposal 1
esp encryption-algorithm 3des
第四:配置IPSEC的配置文件
ipsec profile gre
ike-peer r3
proposal 1
第五:对gre隧道进行保护(注意在这个模式下,千万不能配置gre key ;以及gre check;也建议配置keepalive)
interface Tunnel0/0/0
ip address 192.168.2.1 255.255.255.0
tunnel-protocol gre
source 117.169.17.1
destination 118.169.17.3
ipsec profile gre
第六:配置路由(可以配置动态路由,或则静态路由指向隧道),在模拟器上可能偶尔不会成功,重启即可解决
#既然是隧道桥,那么就是将本地内网的网段,和配置的隧道的接口网段,发布出去(不能是发布路由器公网接口的地址段)
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255 #内网网段
network 192.168.2.0 0.0.0.255 #gre隧道接口地址网段
#
ip route-static 0.0.0.0 0.0.0.0 117.169.17.2
#查看ospf邻居,及路由表,和接口地址
dis ospf peer
dis ip route
dis ip int bri
附:GRE Over IPSec witch OSPF配置示例
++++++PE1路由器配置+++++++++
sysname PE1
#
ipsec proposal 1
esp encryption-algorithm 3des
#
ike proposal 1
encryption-algorithm 3des-cbc
authentication-algorithm md5
#
ike peer r3 v2
pre-shared-key simple test
ike-proposal 1
#
ipsec profile gre
ike-peer r3
proposal 1
#
interface GigabitEthernet0/0/0
ip address 117.169.17.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.1.1 255.255.255.0
#
interface Tunnel0/0/0
ip address 10.0.0.1 255.255.255.0
tunnel-protocol gre
source 117.169.17.1
destination 118.169.17.3
ipsec profile gre
#
ospf 1
area 0.0.0.0
network 192.168.1.1 0.0.0.255
network 10.0.0.1 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 117.169.17.2
#
++++++PE2路由器配置++++++++
sysname PE2
#
ipsec proposal 1
esp encryption-algorithm 3des
#
ike proposal 1
encryption-algorithm 3des-cbc
authentication-algorithm md5
#
ike peer r3 v2
pre-shared-key simple test
ike-proposal 1
#
ipsec profile gre
ike-peer r3
proposal 1
#
interface GigabitEthernet0/0/0
ip address 118.169.17.3 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.2.1 255.255.255.0
#
interface Tunnel0/0/0
ip address 10.0.0.2 255.255.255.0
tunnel-protocol gre
source 118.169.17.3
destination 117.169.17.1
ipsec profile gre
#
ospf 1
area 0.0.0.0
network 192.168.2.2 0.0.0.255
network 10.0.0.2 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 118.169.17.2
#
附:华为设备配置手册
http://support.huawei.com/hedex/hdx.do?docid=EDOC1000015444&lang=zh
如果文章对你有帮助,欢迎点击上方按钮打赏作者
暂无评论