Skip to main content
Shashwati
Staff
Staff
July 27, 2024

Technical Tip: SSL VPN connection to a Loopback Interface using Virtual IP

  • July 27, 2024
  • 0 replies
  • 20421 views

 

Description

This article describes how to use an SSL VPN connection to a Loopback Interface using Virtual IP and some SSL VPN hardening recommendations.

Scope FortiGate.
Solution
  1. Configure Loopback Interface.

 

1.PNG

CLI Reference:


config system interface
    edit "Loopback"
        set vdom "root"
        set ip 10.10.10.10 255.255.255.0
        set allowaccess ping
        set type loopback
        set role lan
        set snmp-index 31
    next
end

 

  2. FortiGate WAN Interface and static route (port2 in this example).  

 

POrt2.png   static route.png

 

CLI Reference:


config system interface
    edit "port2"
        set ip 192.168.12.12 255.255.240.0
        set allowaccess ping https ssh http ftm
    next
end


config router static
    edit 1
        set gateway 192.168.12.1
        set device "port2"
end

 

  1.  Configure Virtual IP using External IP address of port2,  specify port2 as the interface and the mapped IPv4 address as the IP of the Loopback interface with ports matching those of the SSLVPN port.

 

VIPYU.png

 

CLI Reference:

 

config firewall VIP
    edit "VPN-Interface"
        set extip 192.168.12.12
        set mappedip 10.10.10.10
        set extintf "port2"
        set portforward enable
        set extport 10443
        set mappedport 10443 <--- The same port where SSL will listen on.
    next
end

 

  1. Configure SSL VPN using Loopback Interface.

 

22.PNG

 

CLI Reference:

 

config vpn ssl settings
     set servercert "Fortinet_Factory"
     set tunnel-ip-pools "SSLVPN_TUNNEL_ADDR1"
     set tunnel-ipv6-pools "SSLVPN_TUNNEL_IPv6_ADDR1"
     set source-interface "Loopback"
     set source-address "all"
     set source-address6 "all"
     set default-portal "test"
end 

 

  1. Configure the Firewall policy for VIP access from outside.

 

23.PNG

 

CLI Reference:

 

config firewall policy
    edit 14
        set name "Loopback"
        set srcintf "port2"
        set dstintf "Loopback"
        set action accept
        set srcaddr "all"
        set dstaddr "VPN-Interface"
        set schedule "always"
        set service "ALL"
    next

 

  1. Configure the Firewall policy for SSL VPN users.

 

24.PNG

 

CLI Reference:


config firewall policy
    edit 12
        set name "sslvpn"
        set srcintf "ssl.root"
        set dstintf "port3"
        set action accept
        set srcaddr "all"
        set dstaddr "all"
        set schedule "always"
        set service "ALL"
        set groups "Guest-group
    next
end

 

  1. To harden the SSL VPN service to protect against failed login attempts, further restrictions can be put on the source on the WAN to the Loopback policy to specify allowed Geographical locations.

 

25.PNG

 

CLI Reference:


config firewall policy
    edit 14
        set name "Loopback"
        set srcintf "port2"
        set dstintf "Loopback"
        set action accept
        set srcaddr "SSLVPN_Whitelist_countries"
        set dstaddr "VPN-Interface"
        set schedule "always"
        set service "ALL"
    next
end

 

  1. Connect to the SSL VPN using the Virtual IP.       

                                                                                                      FCT-settings-new.JPG

 

7.PNG

 

In some cases, if a user is required to connect to VPN through an internal network or Wi-Fi connection while both are behind the firewall, then one more policy is required that from the LAN or the Wi-Fi interface to the SSL VPN loopback interface.

 

1.JPG

 

SSL VPN user list:       

                                                                                                                                        
8.PNG

Note:

Even with this setup, the Banned-IP or Quarantine IP feature will not be able to block SSL VPN connection attempts. Banned-IP or Quarantine IP feature is only applied to real forwarding traffic, traffic that goes through FortiGate.

Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
Virtual event | September 2026. SASE summit. The age of autonomous trust. Register here!