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

    Possible default gateway bug in DHCP

    Scheduled Pinned Locked Moved DHCP and DNS
    10 Posts 3 Posters 2.4k 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.
    • T
      timthetortoise
      last edited by

      Looks to affect 2.1.2, not sure about 2.1.1 but I'd assume so.
      Just checked, affects 2.1-release as well. Not sure how many versions back this bug goes.

      Steps to reproduce:
      1. Change WAN interface to a static IP
      2. Set LAN DHCP range, don't set the gateway, save
      4. Release and renew lease on client
      5. Check routing table, no default gateway.

      I'm not sure where this issue is stemming from, but am looking into it. If anyone can confirm they can reproduce, it'd be appreciated. This seems to be a pretty huge bug.

      Edit: quick fix for this specific scenario (I'm assuming not ideal, so don't make this change unless you really don't want to put in a gateway), edit /etc/inc/services.inc. Go to line 707. The block starts out like this:

          703                 if ($dhcpifconf['gateway']) {
          704                         $routers = $dhcpifconf['gateway'];
          705                         $add_routers = true;
          706                 } else {
          707                         $routers = $ifcfgip;
          708                 }
      
      

      and should end up looking like this:

          703                 if ($dhcpifconf['gateway']) {
          704                         $routers = $dhcpifconf['gateway'];
          705                         $add_routers = true;
          706                 } else {
          707                         $add_routers = true;
          708                         $routers = $ifcfgip;
          709                 }
      
      

      Again, not ideal, do this at your own risk, etc., but this gets the correct behavior when no gateway is specified.

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        Make sure you have a gateway selected on your WAN (Interfaces > WAN) and NO gateway set on Interfaces > LAN.

        It works with a proper configuration, that is a very common setup that we perform constantly.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • T
          timthetortoise
          last edited by

          Interesting. Why is a default gateway on the WAN interface required to serve a default gateway for the LAN interface though?

          1 Reply Last reply Reply Quote 0
          • jimpJ
            jimp Rebel Alliance Developer Netgate
            last edited by

            Selecting a gateway on the WAN marks it as a WAN-type interface to pfSense.

            With no WAN-type interfaces, DHCP will act as though the unit is NOT a gateway to reach the Internet as it has no WAN-type interfaces.

            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

            1 Reply Last reply Reply Quote 0
            • T
              timthetortoise
              last edited by

              DHCP isn't always simply a gateway to reach the internet though, many companies will have a completely locked down set of networks that still require routing to happen, which requires default gateways on clients. It's not as big of an issue as I thought initially, but it does seem, to me, like pretty unexpected behavior. Having DHCP only hand out a gateway if there's a default gateway on the router itself is behavior I've never seen on any other equipment, personally.

              1 Reply Last reply Reply Quote 0
              • jimpJ
                jimp Rebel Alliance Developer Netgate
                last edited by

                Your case is the minority, and though it isn't covered automatically, you can do so manually. There's no bug or problem here.

                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                Need help fast? Netgate Global Support!

                Do not Chat/PM for help!

                1 Reply Last reply Reply Quote 0
                • N
                  none
                  last edited by

                  Hi Jim,

                  I got stuck in this problem using 2.1.5 amd64. I have Quagga OSPFd to set routes, so I have no gateways set by me or dhcp. So I got the issue above, when a client uses dhcp to get IP's and stuff, no default gw is set. This is only fixed when I say there the gw address on dhcpd page. This is not good for me. I tested this on 2.1 amd64, and it behaved differently. It sends the gw IP.

                  this is expected and I must workaround it ?

                  thanks,

                  none

                  1 Reply Last reply Reply Quote 0
                  • jimpJ
                    jimp Rebel Alliance Developer Netgate
                    last edited by

                    For your uncommon edge case, yes, you must manually enter the gateway IP that you want in the DHCP settings.

                    If pfSense has no knowledge of a gateway in its config, it can't know that it's capable of acting as a gateway in that role, so you must manually fill in the setting. There is no viable way to detect your case compared to someone who intentionally didn't set a gateway because they didn't want pfSense to act as a gateway.

                    Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                    Need help fast? Netgate Global Support!

                    Do not Chat/PM for help!

                    1 Reply Last reply Reply Quote 0
                    • N
                      none
                      last edited by

                      Ok Jim,

                      did it and is ok. Thanks for the answer :)

                      This was really changed from 2.1 to now ?

                      att,

                      none

                      1 Reply Last reply Reply Quote 0
                      • jimpJ
                        jimp Rebel Alliance Developer Netgate
                        last edited by

                        AFAIK it's been that way forever (Or at least back to the 1.2.x days).

                        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                        Need help fast? Netgate Global Support!

                        Do not Chat/PM for help!

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.