Site to Site Dual WAN/Dual OVPN all load balanced

  • Hi guys, I have done lots of searching and used the info in these forums to almost fully complete my setup. I just need a bit of clarification on OSPF setup.
    I have 2 sites which have 2 ADSL connections each. Currently both sites have Dual WAN setup with load balancing setup and working fine.

    I have also managed to create 2 working OVPN Site to Site connections with no load balance/failover. Here is a diagram of the setup

    SITE A  LAN –- PFSENSE --- WAN/OPVN1.A  ------------------------ WAN/OVPN1.B --- PFSENSE --- LAN SITE B
                                     |--- WAN/OPVN2.A  ------------------------WAN/OVPN2.B  ---|

    How do I go about setting up OSPF to failover/loadbalance the VPN connections? I am having a few problems figuring out what the settings mean/finding a good tutorial on OSPF

    I am wondering what to put in global settings for router id, area etc?
    Also in another post on the forum it mentions you need to bind the OPVN connection to a new interface because it doesnt show up in the drop down in the OSPF "interface settings", however on my setup the ovpn connections are showing up (I am wondering if this was an old post and you no longer need to do this step?)


  • the use of openospf is deprecated, as in not recommanded. you'd better remove it and use quagga ospf, it has less issues.

    also with quagga you can select the ovpn tunnel as interface without assigning a seperate one.

  • @heper:

    ovpn tunnel as interface without assigning a seperate one.

    Is there any functional difference between a ovpn* interface (ifconfig) and a pfSense webGUI OPTx interface ?

    And would it be advisable (best practice) to assign a webGUI OPTx interface to onvpn* regardless ?

  • Rebel Alliance Developer Netgate

    Yes, if you assign the interface, it will get a gateway, it also can need some special handling (e.g. make sure you don't delete the VPN without first deleting the assigned interface).

    If you need/want the behavior of the assigned interface, it's available. However it's not required for most cases.

    In the case of OpenOSPFd it was only required because the package wasn't smart enough to list the OpenVPN interfaces unless they were assigned, it didn't do anything else special in that case.

  • Thanks for the clarification jimp.

    Btw, does pfSense OpenVPN now support OSPF load balancing across equal cost path ?

  • Rebel Alliance Developer Netgate

    Not that I'm aware of. Quagga is the recommended OSPF daemon at the moment, I don't know if (a) it's capable of equal cost OSPF, and (b) if it is, if it actually works on FreeBSD, and © if it does, if it works with pfSense (it might require RADIX_MPATH in the kernel)

  • Hey,
    I am using Quagga, I was just after some clarification on the router id and area. I have set the area to and the router id's to the local lan e.g. on site A and on site B
    I am testing with just one OPVN link at the moment, and it seems to find it, but doesnt do any routing when i remove the "remote network" from the ovpn client/server setup.

    I am using for the tunnel network

  • Here is the OSPF status from the client machine at site B, any help appreciated

     OSPF Routing Process, Router ID:
     Supports only single TOS (TOS0) routes
     This implementation conforms to RFC2328
     RFC1583Compatibility flag is disabled
     OpaqueCapability flag is disabled
     Initial SPF scheduling delay 200 millisec(s)
     Minimum hold time between consecutive SPFs 1000 millisec(s)
     Maximum hold time between consecutive SPFs 10000 millisec(s)
     Hold time multiplier is currently 1
     SPF algorithm last executed 1m25s ago
     SPF timer is inactive
     Refresh timer 10 secs
     Number of external LSA 0\. Checksum Sum 0x00000000
     Number of opaque AS LSA 0\. Checksum Sum 0x00000000
     Number of areas attached to this router: 1
     Area ID: (Backbone)
       Number of interfaces in this area: Total: 1, Active: 1
       Number of fully adjacent neighbors in this area: 1
       Area has no authentication
       SPF algorithm executed 2 times
       Number of LSA 2
       Number of router LSA 2\. Checksum Sum 0x0001d02b
       Number of network LSA 0\. Checksum Sum 0x00000000
       Number of summary LSA 0\. Checksum Sum 0x00000000
       Number of ASBR summary LSA 0\. Checksum Sum 0x00000000
       Number of NSSA LSA 0\. Checksum Sum 0x00000000
       Number of opaque link LSA 0\. Checksum Sum 0x00000000
    eighbor ID Pri State           Dead Time Address         Interface            RXmtL RqstL DBsmL       1 Full/DROther      34.078s       ovpnc1:         0     0     0
           OSPF Router with ID (
                    Router Link States (Area
    Link ID         ADV Router      Age  Seq#       CkSum  Link count       86 0x80000046 0xf686 2       85 0x80000043 0xd9a5 2

  • Hi Guys, I think I am getting close, I didn't have "redistribute connected subnets" at each end ticked.

    To clean up my Quagga routing table I have added the ADSL gateways to the exlcusion list when passing subnets. This way OSPF is only passing the local lan subnets. Will this cause an issue?

    To get it to work, I now have a Lan firewall rule which when accessing the subnets, it just uses the * gateway. So hopefully it is using Quagga to load balance across the OPVN links.
    Then I have all other traffic from the Lan going across the WANBalancer gateway I setup (which was working nicely before i started with the opvn connections).
    Is this correct?

    EDIT: ARGH! Now I can only get one VPN connection to connect at a time. If i have both VPN connections enabled on the server, the last one to enable just shows this:

    VPN on WAN UDP:1194 0 See Note Below No Management Daemon 0 0

    And the logs contain:

    Sep 18 14:24:50 openvpn[12660]: /sbin/ifconfig ovpns1 mtu 1500 netmask up
    Sep 18 14:24:50 openvpn[12660]: FreeBSD ifconfig failed: external program exited with error status: 1
    Sep 18 14:24:50 openvpn[12660]: Exiting

    The VPN connections both work, the other one just has to be disabled. Any ideas :)  ???  :(

    Edit 2: Upgraded to the latest snapshot, seems to be working :) Now to test and make sure load balancing is working

    Edit 3: Ok it isn't load balancing, do I need to setup a gateway group with the VPN interfaces and have a firewall rule which directs traffic through that?

  • Bumpy :)
    Still cannot get it to load balance the vpn connections…

  • afaik the freebsd kernel currently does not support loadbalancing when using ospf (don't know the details).

    what quagga will do is provide failover.

  • @heper:

    afaik the freebsd kernel currently does not support loadbalancing when using ospf (don't know the details).
    what quagga will do is provide failover.

    Check previous posts in this thread (mine and jimp's)

  • Sorry for "hijacking the thread" but are there any tutorials on site to site openvpn using ospf ?

    Thanks a lot !

  • don't know of any full blown tutorial, but its fairly easy. some info bout ospf can be found here:,37084.0.html

    First thing you should do is get you tunnel(s) up and running and routing properly without ospf.
    Then you install quagga-ospf on both ends
    Then you configure:

    • set a master password

    • pick an available area. if this is your (company) network, anything will be available

    • personally i like to specify what routes to distribute and don't use "Redistribute connected subnets"

    • on the interface settings specify where you want to bind ospf to

    • hit save

    • repeat on other end

    After both end run ospf on the correctly, check their status screens
    it should have found neighbours, and routes to distribute and lots of incomprehensible garbage you shouldn't worry about :D
    verify the "Quagga OSPF Routes". Are those the subnets you wish to distribute ?
    If yes, remove all routes from your Openvpn configuration (ie remote network/ local network/ pushed routes)
    I keep the tunnel network fields in the openvpn config, incase the ospf fails and i need to reach the other side quickly, but i don't believe this to be necessary

    and finally, verify you have other ways to reach to other end tunnel in case something goes wrong. Hit Save and if needed restart the services.

  • Thanks a lot heper, I'll check it out.

  • heper,
    I tried setting up ospf as you described but for some reason the Quagga UI makes some changes that I didnt specify while ignoring other that I do.

    I have two openvpn tunnels. The tunnel networks are conn1: and conn2:
    The quagga will sometimes add those two networks as networks to distribute without me specifying them. So if conn1 is up while conn2 is down ospf will add a route to via con1 and it will prevent the openvpn connection conn2 from coming online (openvpn client fails to add the route).

    Another issue i was having was being able to distribute the openvpn 'Remote Users' network via quagga. I have a 'Remote Users' openvpn server with network
    I tried to add the network to be distributed via ospf but it only distributes the route

    Oddly enough both these issues dont' appear when i use openospfd.

    Any help would be greatly appreciated.

Log in to reply