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

    captive portal new dns servers after signin

    Scheduled Pinned Locked Moved General pfSense Questions
    32 Posts 5 Posters 2.6k 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.
    • M
      michmoor LAYER 8 Rebel Alliance
      last edited by michmoor

      Background: Using captive portal. Clients receive a DHCP address along with DNS setting that points to pfsense. Clients join the Guest Network, captive portal page is seen, sucessful login, internet access.

      Problem: Not a problem per-se but the prior implementation was just WPA2 with a pre-shared key. Unfortunately, the PSK wasn't rotated frequently so a captive portal for guests that links to an approval system [mangaers get email for vendor access which they approve and access is granted for 24hr]
      Is there a way after a device is approved to give new DNS servers? I would like Guets to use google or cloudflare or whatever but not pfsense for dns.
      I dont think i can redirect Client DNS as thats whats needed for the guest portal.
      @Gertjan You seem familiar with captive portals from what i can see in some of your responses. Any idea?

      Firewall: NetGate,Palo Alto-VM,Juniper SRX
      Routing: Juniper, Arista, Cisco
      Switching: Juniper, Arista, Cisco
      Wireless: Unifi, Aruba IAP
      JNCIP,CCNP Enterprise

      johnpozJ GertjanG 2 Replies Last reply Reply Quote 0
      • johnpozJ
        johnpoz LAYER 8 Global Moderator @michmoor
        last edited by

        @michmoor why do you not want them using pfsense for dns? If you don't want them resolving local resources, you can just create a view so they can not.

        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.8, 24.11

        M 1 Reply Last reply Reply Quote 1
        • M
          michmoor LAYER 8 Rebel Alliance @johnpoz
          last edited by michmoor

          @johnpoz create a view…good idea. And that’s exactly it I don’t want them resolving any local resources regardless if there is a firewall rule rejecting that

          edit: the problem with the view is that there are resources in the example.com space that are accessible over the internet and over intranet. How does a view help?

          Firewall: NetGate,Palo Alto-VM,Juniper SRX
          Routing: Juniper, Arista, Cisco
          Switching: Juniper, Arista, Cisco
          Wireless: Unifi, Aruba IAP
          JNCIP,CCNP Enterprise

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

            @michmoor A view allows you to resolve specific things from your local resources.

            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.8, 24.11

            1 Reply Last reply Reply Quote 0
            • GertjanG
              Gertjan @michmoor
              last edited by

              @michmoor said in captive portal new dns servers after signin:

              Any idea?

              Yep, one.

              Add the IP of "another DNS" in the Allowed IP addresses list, for example 8.8.8.8

              bcbd64ad-b68e-4eba-a626-71c57bb7aab8-image.png

              Add this IP to the DNS list on the captive portal DHCP server :

              1bf9e285-9e4a-465b-b13b-c67655ed0145-image.png

              Done.
              Works for me ™©

              No "help me" PM's please. Use the forum, the community will thank you.
              Edit : and where are the logs ??

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

                @Gertjan but sounds like he need to resolve "some" local stuff.

                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.8, 24.11

                GertjanG 1 Reply Last reply Reply Quote 0
                • GertjanG
                  Gertjan @johnpoz
                  last edited by

                  @johnpoz

                  Is there a way after a device is approved to give new DNS servers?

                  Without (manual) interaction on the device after portal login, I'm not sure, never heard of such a thing.

                  @michmoor said in captive portal new dns servers after signin:

                  I would like Guets to use google or cloudflare or whatever but not pfsense for dns

                  I've tried my proposition above. It worked.

                  No "help me" PM's please. Use the forum, the community will thank you.
                  Edit : and where are the logs ??

                  johnpozJ M 2 Replies Last reply Reply Quote 0
                  • johnpozJ
                    johnpoz LAYER 8 Global Moderator @Gertjan
                    last edited by

                    @Gertjan I would agree with you.. Just have the clients use some public dns from the get go, ie hand that out in dhcp.

                    But does this seem like he wants local stuff to resolve, could always use nat reflection to access it as another option if you do need to access local services.

                    here are resources in the example.com space that are accessible over the internet and over intranet.

                    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.8, 24.11

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      michmoor LAYER 8 Rebel Alliance @johnpoz
                      last edited by

                      @johnpoz said in captive portal new dns servers after signin:

                      I would agree with you.. Just have the clients use some public dns from the get go, ie hand that out in dhcp.

                      Ok so question.
                      Have guest use captive portal. Login successfully.
                      Do the guest then have to manually switch to a public DNS server or is there some kind of redirection that can happen?

                      Firewall: NetGate,Palo Alto-VM,Juniper SRX
                      Routing: Juniper, Arista, Cisco
                      Switching: Juniper, Arista, Cisco
                      Wireless: Unifi, Aruba IAP
                      JNCIP,CCNP Enterprise

                      1 Reply Last reply Reply Quote 0
                      • stephenw10S
                        stephenw10 Netgate Administrator
                        last edited by

                        Is there some they can't just use public servers all the time? The captive portal doesn't require using pfSense for DNS.

                        M 1 Reply Last reply Reply Quote 0
                        • M
                          michmoor LAYER 8 Rebel Alliance @stephenw10
                          last edited by

                          @stephenw10 said in captive portal new dns servers after signin:

                          he captive portal doesn't require using pfSense for DNS.

                          i thought clients needed pfsense for dns in order to resolve the captive portal page configured which in my case is https://portal.example.com
                          How would clients log in?

                          Firewall: NetGate,Palo Alto-VM,Juniper SRX
                          Routing: Juniper, Arista, Cisco
                          Switching: Juniper, Arista, Cisco
                          Wireless: Unifi, Aruba IAP
                          JNCIP,CCNP Enterprise

                          1 Reply Last reply Reply Quote 0
                          • stephenw10S
                            stephenw10 Netgate Administrator
                            last edited by

                            Any http request is redirected to the login page. Any recent OS detects that and shows you an alert that you need to login.

                            If you have a custom login page that has components that are not resolvable that could make things more difficult.

                            M 1 Reply Last reply Reply Quote 0
                            • M
                              michmoor LAYER 8 Rebel Alliance @stephenw10
                              last edited by

                              @stephenw10
                              Just so im clear i can have HTTPs redirects to the portal but clients use an external DNS?
                              How would clients know how to resolve the portal?

                              118e6794-dbce-4527-98d7-4dfd8c9894a2-image.png

                              Firewall: NetGate,Palo Alto-VM,Juniper SRX
                              Routing: Juniper, Arista, Cisco
                              Switching: Juniper, Arista, Cisco
                              Wireless: Unifi, Aruba IAP
                              JNCIP,CCNP Enterprise

                              1 Reply Last reply Reply Quote 0
                              • stephenw10S
                                stephenw10 Netgate Administrator
                                last edited by

                                No, not if that server is not resolvable publicly.

                                M 1 Reply Last reply Reply Quote 0
                                • M
                                  michmoor LAYER 8 Rebel Alliance @stephenw10
                                  last edited by

                                  @stephenw10
                                  So as a test on a dev system i made the following change

                                  1. Made portal.example.com dns name available over the internet - through cloudflare. So now if there is a dns query to the portal name it resolves to cloudflare and utlimately makes it to the firewall.

                                  pfsense is running HA proxy on the WAN so it should receive those requests over the internet. Doesnt seem to be working.
                                  The backend configuration i have the backend being pfsense so the IP is 192.168.11.1. This is the same IP i used when resolving portal.example.com internally for captive portal

                                  This is the part where i am confused. When a client connects to the wifi and gets a DHCP address, does the captive portal configuration tell the client to go to https://portal.example.com? If so this works without issue when using internal DNS. External DNS is failing.

                                  Firewall: NetGate,Palo Alto-VM,Juniper SRX
                                  Routing: Juniper, Arista, Cisco
                                  Switching: Juniper, Arista, Cisco
                                  Wireless: Unifi, Aruba IAP
                                  JNCIP,CCNP Enterprise

                                  1 Reply Last reply Reply Quote 0
                                  • stephenw10S
                                    stephenw10 Netgate Administrator
                                    last edited by

                                    Is that actually resolving to the internal IP as expected? From a client before it has logged in?

                                    M 1 Reply Last reply Reply Quote 0
                                    • M
                                      michmoor LAYER 8 Rebel Alliance @stephenw10
                                      last edited by

                                      @stephenw10
                                      If i go under DHCP Services for the interface and set the DNS server as pfsense - 192.168.11.1 - everything works fine. The portal page comes up.

                                      If i go under DHCP Services for the interface and set the DNS server as 8.8.8.8 - portal page doesnt come up. I made the domain, portal.example.com, available over the Internet.

                                      Typically how things would work for an external service is that I configure the HA Proxy Front/Back ends. But in this case the Front and Backend would be the firewall itself. Not sure how to get around this if this is the way to do it.

                                      Firewall: NetGate,Palo Alto-VM,Juniper SRX
                                      Routing: Juniper, Arista, Cisco
                                      Switching: Juniper, Arista, Cisco
                                      Wireless: Unifi, Aruba IAP
                                      JNCIP,CCNP Enterprise

                                      1 Reply Last reply Reply Quote 0
                                      • M
                                        michmoor LAYER 8 Rebel Alliance @Gertjan
                                        last edited by

                                        @Gertjan said in captive portal new dns servers after signin:

                                        I've tried my proposition above. It worked.

                                        Ok so i tried the following just now.

                                        1. On the Allowed IP lists i hadd the Google DNS server, 8.8.8.8 and 8.8.4.4
                                        2. Updated DHCP server for Guest to use both Google DNS server
                                        3. portal.example.com resolves over the internet. I see my test guest client query portal.example.com and gets the response of cloudflare IPs back as expected.
                                        4. The guest client is not prompted for authentication and cannot access internet.

                                        I do have HA Proxy on the WAN side so it listens on port 443. Should that matter? Does that matter? Not sure where to go from here.

                                        Firewall: NetGate,Palo Alto-VM,Juniper SRX
                                        Routing: Juniper, Arista, Cisco
                                        Switching: Juniper, Arista, Cisco
                                        Wireless: Unifi, Aruba IAP
                                        JNCIP,CCNP Enterprise

                                        stephenw10S 1 Reply Last reply Reply Quote 0
                                        • stephenw10S
                                          stephenw10 Netgate Administrator @michmoor
                                          last edited by

                                          @michmoor said in captive portal new dns servers after signin:

                                          gets the response of cloudflare IPs back as expected

                                          That can't work unless you're also passing those IPs in the console. Those need to resolve to 192.168.11.1.

                                          HAProxy should have nothing to do with this. The https traffic from the clients should never leave the captive portal subnet.

                                          Steve

                                          M 1 Reply Last reply Reply Quote 0
                                          • M
                                            michmoor LAYER 8 Rebel Alliance @stephenw10
                                            last edited by michmoor

                                            @stephenw10 then thats the part where im not following here. The suggestions all seem legit but it seems my implementation is wrong.

                                            The guest client should receive external dns servers which presumably it will get from dhcp.
                                            But Guest clients should also log into the captive portal that's on pfsense.
                                            Judging by the comments this seems like it can be done. But im not following how this can be done.

                                            If i use pfsense as the DNS server - everything works just fine. portal.example.com resolves for the client. They are given a login page by pfsense and off they go.
                                            If i give the client an DNS server, pfsense tells them to go to portal.example.com which of course will never resolve to the internal address because the clients are using an external dns server given to them by dhcp(pfsense).

                                            Firewall: NetGate,Palo Alto-VM,Juniper SRX
                                            Routing: Juniper, Arista, Cisco
                                            Switching: Juniper, Arista, Cisco
                                            Wireless: Unifi, Aruba IAP
                                            JNCIP,CCNP Enterprise

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