• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Switching the default gateway via cli

Scheduled Pinned Locked Moved Routing and Multi WAN
3 Posts 2 Posters 558 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K
    kanemari
    last edited by Dec 19, 2018, 2:32 AM

    hi there,

    I have a pfsense setup using multi WAN (2 x ADSL2) which is working pretty well.

    The only time I run into trouble is when one of my WAN connection becomes degraded due to line faults, but not degraded to the point where it fails. i.e. the line speed drops to only 2-3Mbps but ping and packet loss is still ok until under load. It doesnt happen often but I am trying to work out some sort of notification for when it does.

    I was hoping to use speedtest-cli on regular intervals and send the info via email. The only problem is, I cant control which gateway speedtest-cli uses when it performs the test.

    Since the system is able to switch the default gateway easily enough when one in the group fails, I figured there should be a command I can use via the CLI to switch them manually. I would then just run speedtest-cli twice, after each gateway swap, and email the results.

    does anyone know if it is possible to control the default gateway in this way? I had thought about just using "route add default x.x.x.x" but since the interfaces are different I didnt think it would work, and I am in a remote location from the server right now so didnt want to break it without having physical access to it :)

    any help appreciated, thanks!

    1 Reply Last reply Reply Quote 0
    • D
      Derelict LAYER 8 Netgate
      last edited by Dec 22, 2018, 8:15 PM

      My VDSL:

      speedtest-cli --source 76.2.X.Y

      Retrieving speedtest.net configuration...
      Testing from CenturyLink (76.2.X.Y)...
      Retrieving speedtest.net server list...
      Selecting best server based on ping...
      Hosted by OffsiteDataSync (Las Vegas, NV) [15.98 km]: 39.691 ms
      Testing download speed................................................................................
      Download: 10.35 Mbit/s
      Testing upload speed................................................................................................
      Upload: 0.87 Mbit/s
      
      

      Chattanooga, Tennessee, USA
      A comprehensive network diagram is worth 10,000 words and 15 conference calls.
      DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
      Do Not Chat For Help! NO_WAN_EGRESS(TM)

      1 Reply Last reply Reply Quote 1
      • K
        kanemari
        last edited by Dec 23, 2018, 12:40 PM

        Had tried this and it didnt work, but just now realised I had the gateway wrong.

        Have set up a daily email to run that script for each gateway that I have, against the same server. Works like a charm! Thanks for your help 👍

        1 Reply Last reply Reply Quote 0
        3 out of 3
        • First post
          3/3
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
          This community forum collects and processes your personal information.
          consent.not_received