Native Vxlan over IPSEC and loopback interface. advanced configuration
- November 13, 2018
- 4 replies
- 24277 views
I allow myself to write this post because I have a lot of difficulty in configuring vxlan over ipsec, the operation is not guaranteed (at least from my experience)
 
from the FortiOS version 5.6.2 vxlan can be used natively
considered that the
[ul] 
I decided to make a configuration using IPSEC with loopback interface and use the native vxlan with the loopback interfaces.
With this configuration, traffic with the native vxlan is encrypted with the IPSEC
 
attached the configuration adopted between fortigate 80E and Fortigate 90E
######################### FTG80E ###############
 
##creation of subnet address
 
config firewall address
edit "LoopBackLocal172.30.31.0"
set subnet 172.30.31.0 255.255.255.0
next
edit "LoopBackRemote172.30.30.0"
set subnet 172.30.30.0 255.255.255.0
next
end
########## loopback interface creation ##########
config system interface
edit "Loopback"
set vdom "root"
set ip 172.30.31.1 255.255.255.0
set allowaccess ping https ssh http
set type loopback
next
end
########## phase 1 configuration #########
config vpn ipsec phase1-interface
edit "VXlanSuIpsec"
set interface "wan1"
set keylife 28800
set peertype any
set proposal aes128-sha1 aes256-sha256 aes128-sha256 aes256-sha1
set dhgrp 14 2
set remote-gw #remote ip public
set psksecret 123456789
next
end
########## phase 2 configuration ##########
config vpn ipsec phase2-interface
edit "VXlanIpsecPh2"
set phase1name "VXlanSuIpsec"
set proposal aes128-sha1 aes256-sha1 aes128-sha256 aes256-sha256 aes128gcm aes256gcm
set dhgrp 14 2
set keepalive enable
set src-addr-type name
set dst-addr-type name
set keylifeseconds 3600
set src-name "LoopBackLocal172.30.31.0"
set dst-name "LoopBackRemote172.30.30.0"
next
end
 
######### native vxlan configuration using vpn ipsec with loopback interface ########
config system vxlan
edit "vxlan"
set interface "Loopback"
set vni 1
set remote-ip "172.30.30.1"
next
end
config system interface
edit "vxlan"
set vdom "root"
set type vxlan
set interface "Loopback"
next
end
######## Virtual Switch Configuration for bridge between native vxlan and port 7. #########
######## port 7 firewall must be configured in trunk on switch port ##########
 
config system switch-interface
edit "Switch-Vxlan"
set vdom "root"
set member "port7" "vxlan"
next
end
 
######## Policy configuration ######
 
config firewall policy
edit 1
set name "Loopback TO ipsecVPN"
set srcintf "Loopback"
set dstintf "VXlanSuIpsec"
set srcaddr "LoopBackLocal172.30.31.0"
set dstaddr "LoopBackRemote172.30.30.0"
set action accept
set schedule "always"
set service "ALL"
set logtraffic all
next
edit 2
set name "ipsecVPN TO Loopback"
set srcintf "VXlanSuIpsec"
set dstintf "Loopback"
set srcaddr "LoopBackRemote172.30.30.0"
set dstaddr "LoopBackLocal172.30.31.0"
set action accept
set schedule "always"
set service "ALL"
set logtraffic all
next
end
 
############# static route configuration ##########
########## remember to add the default gateway associated with wan1 ############
config router static
edit 2
set dst 172.30.30.0 255.255.255.0
set distance 1
set device "VXlanSuIpsec"
next
end
 
 
########################### FTG90E ###############
 
##creation of subnet address
 
config firewall address
edit "LoopBackLocal172.30.30.0"
set subnet 172.30.30.0 255.255.255.0
next
edit "LoopBackRemote172.30.31.0"
set subnet 172.30.31.0 255.255.255.0
next
end
 
########## loopback interface creation ##########
config system interface
edit "Loopback"
set vdom "root"
set ip 172.30.30.1 255.255.255.0
set allowaccess ping https ssh http
set type loopback
next
end
 
########## phase 1 configuration #########
config vpn ipsec phase1-interface
edit "VXlanSuIpsec"
set interface "wan1"
set keylife 28800
set peertype any
set proposal aes128-sha1 aes256-sha256 aes128-sha256 aes256-sha1
set dhgrp 14 2
set remote-gw #remote ip public
set psksecret 123456789
next
end
########## phase 2 configuration ##########
config vpn ipsec phase2-interface
edit "VXlanIpsecPh2"
set phase1name "VXlanSuIpsec"
set proposal aes128-sha1 aes256-sha1 aes128-sha256 aes256-sha256 aes128gcm aes256gcm
set dhgrp 14 2
set keepalive enable
set src-addr-type name
set dst-addr-type name
set keylifeseconds 3600
set src-name "LoopBackLocal172.30.30.0"
set dst-name "LoopBackRemote172.30.31.0"
next
end
######### native vxlan configuration using vpn ipsec with loopback interface ########
config system vxlan
edit "vxlan"
set interface "Loopback"
set vni 1
set remote-ip "172.30.31.1"
next
end
config system interface
edit "vxlan"
set vdom "root"
set type vxlan
set interface "Loopback"
next
end
 
######## Virtual Switch Configuration for bridge between native vxlan and port 7. #########
######## port 7 firewall must be configured in trunk on switch port ##########
config system switch-interface
edit "Switch-Vxlan"
set vdom "root"
set member "internal7" "vxlan"
next
end
 
######## Policy configuration ######
config firewall policy
edit 1
set name "Loopback TO ipsecVPN"
set srcintf "Loopback"
set dstintf "VXlanSuIpsec"
set srcaddr "LoopBackLocal172.30.30.0"
set dstaddr "LoopBackRemote172.30.31.0"
set action accept
set schedule "always"
set service "ALL"
set logtraffic all
next
edit 2
set name "ipsecVPN TO Loopback"
set srcintf "VXlanSuIpsec"
set dstintf "Loopback"
set srcaddr "LoopBackRemote172.30.31.0"
set dstaddr "LoopBackLocal172.30.30.0"
set action accept
set schedule "always"
set service "ALL"
set logtraffic all
next
end
########## loopback interface creation ##########
########## remember to add the default gateway associated with wan1 ############
config router static
edit 2
set dst 172.30.31.0 255.255.255.0
set distance 1
set device "VXlanSuIpsec"
next
end