拓扑
需求:centos8与防火墙建立gre隧道
linux端配置:
[root@localhost ~]# cat set_gre.sh
#!bin/bashinterface_name="gre1"
local_ip="10.0.2.2"
remote_ip="201.1.1.2"
ipaddress="10.10.10.1"
peer_address="10.10.10.2/32"
route_net="192.168.50.0/24"modprobe ip_gre #加载gre模块
ip tunnel add $interface_name mode gre remote $remote_ip local $local_ip ttl 255 #gre隧道
ip add add $ipaddress peer $peer_address dev $interface_name #设置gre接口IP
ip link set $interface_name up #设置接口up
ip route add $route_net dev $interface_name #添加路由
华为USG配置
interface GigabitEthernet1/0/0ip address 201.1.1.2 255.255.255.0
#
interface Tunnel0ip address 10.10.10.2 255.255.255.0tunnel-protocol gresource 201.1.1.2 destination 1.1.1.2 #对端nat后的地址
#
firewall zone trustadd interface Tunnel0
#
firewall zone untrustadd interface GigabitEthernet1/0/0
#
security-policyrule name permit_anyaction permit
#
ip route-static 0.0.0.0 0.0.0.0 201.1.1.1
#