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

    Static route not applied.

    Scheduled Pinned Locked Moved Routing and Multi WAN
    10 Posts 3 Posters 1.1k 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.
    • C
      conejero
      last edited by

      I have setup a pfsense machine with the following configuration:
      WAN: 10.50.0.7 igb0
      LAN: 10.40.70.200 igb2

      I have also setup 2 gateways. A default gateway and a second gateway to a specific network range.
      default gw: 10.50.0.200
      client gw: 10.50.0.4

      I added the static route:
      10.40.40.0/24 via 10.50.0.4

      From the pfsense, a traceroute to 10.40.40.200 goes thru the default gw, rather than the client gw.

      ROUTING TABLE
      Internet:
      Destination Gateway Flags Netif Expire
      default 10.50.0.200 UGS igb0
      10.40.40.0/24 10.50.0.4 UGS igb0
      10.40.70.0/24 link#11 U igb2.40
      gw00 link#11 UHS lo0
      10.50.0.0/24 link#1 U igb0
      10.50.0.7 link#1 UHS lo0
      10.50.70.0/24 link#3 U igb2
      10.50.70.200 link#3 UHS lo0
      localhost link#8 UH lo0

      [2.6.0-RELEASE][@gw00. traceroute 10.40.40.200
      traceroute to 10.40.40.200 (10.40.40.200), 64 hops max, 40 byte packets
      1 10.50.0.201 (10.50.0.201) 0.223 ms 0.218 ms 0.222 ms

      I would have expected the connection to fgo via 10.50.0.4, as this route is setup. What am I missing?

      johnpozJ 1 Reply Last reply Reply Quote 0
      • johnpozJ
        johnpoz LAYER 8 Global Moderator @conejero
        last edited by

        @conejero said in Static route not applied.:

        From the pfsense, a traceroute to 10.40.40.200 goes thru the default gw, rather than the client gw.

        Well something is off here, your trace is going to

        1 10.50.0.201 (10.50.0.201) 0.223 ms 0.218 ms 0.222 ms

        .201, not .200 like you stated your gateway is, and your route table shows. Got some typos in trying to obfuscate IPs?

        An intelligent man is sometimes forced to be drunk to spend time with his fools
        If you get confused: Listen to the Music Play
        Please don't Chat/PM me for help, unless mod related
        SG-4860 24.11 | Lab VMs 2.7.2, 24.11

        C 1 Reply Last reply Reply Quote 0
        • C
          conejero @johnpoz
          last edited by

          @johnpoz 10.50.0.200 is a CARP address. 10.50.0.201 is the first machine on the CARP group.
          Again, the question is, if the routing table states:
          10.40.40.0/24 10.50.0.4 UGS igb0

          Why is ping to 10.40.40.200 NOT going thru 10.50.0.4 as specified on the routing table?

          johnpozJ 1 Reply Last reply Reply Quote 0
          • johnpozJ
            johnpoz LAYER 8 Global Moderator @conejero
            last edited by johnpoz

            @conejero do you show the gateway online?

            I can create an arbitrary gateway and send too it without any issues.

            So while my windows machine at 192.168.9.100 isn't going to route anything, and can not get its firewall to send a reject for a udp traceroute, etc.

            If I create a gateway, and route clearly pfsense when doing a ping sends it to my 192.168.9.100 box.. As you can see in the sniff I did on pfsense when doing a ping from pfsense to 10.40.40.1

            duplicate.jpg

            An intelligent man is sometimes forced to be drunk to spend time with his fools
            If you get confused: Listen to the Music Play
            Please don't Chat/PM me for help, unless mod related
            SG-4860 24.11 | Lab VMs 2.7.2, 24.11

            C 1 Reply Last reply Reply Quote 0
            • C
              conejero @johnpoz
              last edited by

              @johnpoz gateway is online. There is no packet loss.

              C 1 Reply Last reply Reply Quote 0
              • C
                conejero @conejero
                last edited by

                @conejero the only thing is that both gateways belong to the same network, unlike in your example.

                DerelictD johnpozJ 2 Replies Last reply Reply Quote 0
                • DerelictD
                  Derelict LAYER 8 Netgate @conejero
                  last edited by Derelict

                  @conejero Multiple gateways/routers on the WAN get problematic because of route-to/reply-to.

                  If you look in your rule set you will see a rule that forces everything that goes out WAN to anything but a destination on the WAN subnet out to (route-to 10.50.0.200)

                  If you want to try something, remove the gateway from your WAN interface itself. This will break things like automatic outbound NAT because pfSense will no longer see igb0 as a "WAN" interface so you'll need to manually add NAT rules. But it will remove the route-to rules from the WAN. If you switch to manual NAT before removing the gateway from the WAN interface configuration all of the automatic rules will be automatically switched to manual rules first.

                  Another, possibly better soution would be to make a transit network to the router at 10.50.0.4 if possible and get it off WAN altogether.

                  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)

                  C 1 Reply Last reply Reply Quote 1
                  • johnpozJ
                    johnpoz LAYER 8 Global Moderator @conejero
                    last edited by johnpoz

                    @conejero Well I could create a route to some other IP in my wan network to better try to duplicate your issue.. But here I created to gateways in the same network, and different routes per each gateway. And they are followed.

                    You can see depending on where I try and ping, the traffic goes to different gateway.

                    2gateways.jpg

                    My overall point was routing is working as given, and I can not seem to duplicate your issue. So we missing part of the puzzle.

                    edit: looks like Derelict jumped in with what your problem most likely.

                    An intelligent man is sometimes forced to be drunk to spend time with his fools
                    If you get confused: Listen to the Music Play
                    Please don't Chat/PM me for help, unless mod related
                    SG-4860 24.11 | Lab VMs 2.7.2, 24.11

                    1 Reply Last reply Reply Quote 0
                    • C
                      conejero @Derelict
                      last edited by

                      @derelict I removed the gateway setting from the interface WAN. I left the default gw as it was, on 10.50.0.200
                      Now the static routes work properly. I am not all that familiar with FreeBSD. Is there a corresponding "ip rule list" command to print current rule sets?

                      @derelict thank you for your help.

                      DerelictD 1 Reply Last reply Reply Quote 0
                      • DerelictD
                        Derelict LAYER 8 Netgate @conejero
                        last edited by

                        @conejero Easiest way is cat /tmp/rules.debug for the most human-friendly version. You can also pfctl -vvsr to see the raw rule set but it is broken down a lot more that way. It's generally not necessary to look there to get a picture of the rules and what they are doing.

                        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 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.