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

Transparently Intercept and Redirect DNS Traffic to an Internal DNS

NAT
9
54
17.6k
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
    Marv21 @gniting
    last edited by Jun 21, 2020, 8:45 PM

    @ibbetsion
    dns_ok is 192.168.8.2 then - right?

    G 1 Reply Last reply Jun 21, 2020, 8:49 PM Reply Quote 0
    • M
      Marv21 @gniting
      last edited by Jun 21, 2020, 8:49 PM

      @ibbetsion

      Where are you running this Dig command from?
      A client from the 7 or the 8 Net?

      G 1 Reply Last reply Jun 21, 2020, 8:55 PM Reply Quote 0
      • G
        gniting @Marv21
        last edited by Jun 21, 2020, 8:49 PM

        @Marv21 Sorry for omitting that, dns_ok is an alias that I use for those hosts that are allowed to make queries to external DNS servers. Any local host not in this alias/group should be re-routed to the local DNS server at 192.168.8.2

        M 1 Reply Last reply Jun 21, 2020, 10:38 PM Reply Quote 0
        • G
          gniting @Marv21
          last edited by Jun 21, 2020, 8:55 PM

          @Marv21 the dig command is running from a host on the 7 Net.

          1 Reply Last reply Reply Quote 0
          • J
            johnpoz LAYER 8 Global Moderator @gniting
            last edited by johnpoz Jun 21, 2020, 10:12 PM Jun 21, 2020, 10:10 PM

            @ibbetsion said in Transparently Intercept and Redirect DNS Traffic to an Internal DNS:

            ; reply from unexpected source: 192.168.8.2#53, expected 8.8.8.8#53

            No shit what do you think was going to happen... This is why you put your NS your going to redirect to on a different vlan.. Or you have to forward it to loopback.. So pfsense does the query, and then sends the answer..

            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

            G 1 Reply Last reply Jun 21, 2020, 10:15 PM Reply Quote 0
            • G
              gniting @johnpoz
              last edited by Jun 21, 2020, 10:15 PM

              @johnpoz the NS is on a different subnet...

              J 1 Reply Last reply Jun 22, 2020, 9:50 AM Reply Quote 1
              • M
                Marv21 @gniting
                last edited by Marv21 Jun 21, 2020, 10:38 PM Jun 21, 2020, 10:38 PM

                @ibbetsion login-to-view

                could you try this just 4 fun?
                Thats mine. So everything will be redirectet from LAN to the SYNAPSELAN (any - directed to to that net or not)

                G 1 Reply Last reply Jun 21, 2020, 10:49 PM Reply Quote 0
                • G
                  gniting @Marv21
                  last edited by Jun 21, 2020, 10:49 PM

                  @Marv21 said in Transparently Intercept and Redirect DNS Traffic to an Internal DNS:

                  @ibbetsion login-to-view

                  could you try this just 4 fun?
                  Thats mine. So everything will be redirectet from LAN to the SYNAPSELAN (any - directed to to that net or not)

                  That caused all DNS resolution to stop working. I think the issue is somewhere else. I am also now finding out that I cannot ping (or ssh) from the 8 Net to anywhere on the 7 Net or anywhere else. But I can go from 7->8 Net. Need to solve that first :)

                  M 1 Reply Last reply Jun 21, 2020, 10:55 PM Reply Quote 0
                  • M
                    Marv21 @gniting
                    last edited by Marv21 Jun 21, 2020, 10:55 PM Jun 21, 2020, 10:55 PM

                    @ibbetsion
                    Have you a allow Rule on the 8 net?
                    YOu need to allow traffic to 7.

                    G 1 Reply Last reply Jun 21, 2020, 10:56 PM Reply Quote 0
                    • G
                      gniting @Marv21
                      last edited by Jun 21, 2020, 10:56 PM

                      @Marv21 said in Transparently Intercept and Redirect DNS Traffic to an Internal DNS:

                      @ibbetsion
                      Have you a allow Rule on the 8 net?
                      YOu need to allow traffic to 7.

                      Yes, there is an allow rule on 8.
                      login-to-view

                      1 Reply Last reply Reply Quote 0
                      • J
                        johnpoz LAYER 8 Global Moderator @gniting
                        last edited by Jun 22, 2020, 9:50 AM

                        @ibbetsion said in Transparently Intercept and Redirect DNS Traffic to an Internal DNS:

                        the NS is on a different subnet...

                        You can not run multiple layer 3 on the same layer 2 and call it a different network..

                        For what your seeing to happen, the NS you redirected to had direct access to answer the client..

                        . I am also now finding out that I cannot ping (or ssh) from the 8 Net to anywhere on the 7 Net or anywhere else.

                        Seems you have bigger issues in your network than just trying to redirect dns..

                        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

                        G 1 Reply Last reply Jun 22, 2020, 10:07 AM Reply Quote 0
                        • G
                          gniting @johnpoz
                          last edited by Jun 22, 2020, 10:07 AM

                          @johnpoz I was able to resolve the other issues. Everything is on track except for the unexpected source issue.

                          A bit more on the network setup.

                          • ISP modem connected to pfsense on WAN port
                          • pfsense's LAN1 port connected to an unmanaged switch which in turn has all other local devices on it
                          • pfsense's OPT1 port connected directly to host running DNS/pihole

                          LAN1=192.168.7.x network
                          OPT1=192.168.8.x network

                          1 Reply Last reply Reply Quote 0
                          • J
                            johnpoz LAYER 8 Global Moderator
                            last edited by johnpoz Jun 22, 2020, 10:43 AM Jun 22, 2020, 10:41 AM

                            Then what your seeing makes zero sense...

                            So I can for sure duplicate your problem when the NS is on the same network..

                            root@ntp:/home/pi# dig @8.8.8.8 www.google.com
                            ;; reply from unexpected source: 192.168.3.10#53, expected 8.8.8.8#53
                            ;; reply from unexpected source: 192.168.3.10#53, expected 8.8.8.8#53
                            

                            But if I put it on a different subnet works fine, or if forward to loopback, or if setup nat reflect auto outbound nat rules so it

                            login-to-view

                            You can see from this sniff, pfsense saw traffic to 8.8.8.8, sent it on from its own interface 3.253 to 3.10, got answer and then sent answer back to 3.32 looking like it came from 8.8.8.8

                            login-to-view

                            But yes if client thinks it sending to A, and gets back answer from B - its going to complain.

                            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

                            G 1 Reply Last reply Jun 22, 2020, 11:06 AM Reply Quote 0
                            • G
                              gniting @johnpoz
                              last edited by Jun 22, 2020, 11:06 AM

                              @johnpoz makes zero sense to me too, hence the continued head-scratching ☺

                              I do have the option enabled to Enable automatic outbound NAT for Reflection. On your network, you have the NAT redirect rule and that's it?

                              M 1 Reply Last reply Jun 22, 2020, 8:08 PM Reply Quote 0
                              • M
                                Marv21 @gniting
                                last edited by Jun 22, 2020, 8:08 PM

                                @ibbetsion
                                Both are /24 ?

                                1 Reply Last reply Reply Quote 0
                                • G
                                  gniting
                                  last edited by Jun 22, 2020, 8:46 PM

                                  Yes

                                  M 1 Reply Last reply Jun 22, 2020, 9:02 PM Reply Quote 0
                                  • M
                                    Marv21 @gniting
                                    last edited by Marv21 Jun 22, 2020, 9:09 PM Jun 22, 2020, 9:02 PM

                                    @ibbetsion
                                    Hmm.
                                    What you could try (if you have not done any own modifications in the filesystem) - Backup everything, reinstall Pfsense und roll back the Backup.
                                    I had it once a while (4years or greater) that i had done this and suddenly everything was ok.

                                    Is this a Virtualized Maschine or something?

                                    Could you post all NAT Rules, Outbond Page, Lan Rules and DNSNet rules here as Screenshots?

                                    Do you have any Floating Rules?

                                    G 1 Reply Last reply Jun 22, 2020, 10:13 PM Reply Quote 0
                                    • J
                                      johnpoz LAYER 8 Global Moderator
                                      last edited by Jun 22, 2020, 9:44 PM

                                      @Marv21 said in Transparently Intercept and Redirect DNS Traffic to an Internal DNS:

                                      s this a Virtualized Maschine or something?

                                      That is a great question...

                                      Why don't you just sniff and see exactly what is happening..

                                      I don't intercept traffic on the same interface and send back in, but yes that outbound nat automatic should do make it look like i comes from the pfsense interface in that network when you do it that way..

                                      If pfsense redirects traffic and doesn't nat it or is not the gateway for the return.. Then yes your client is going to scream at you you - wtf is this I sent to A, why is B sending me a response.

                                      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

                                      G 1 Reply Last reply Jun 22, 2020, 10:30 PM Reply Quote 0
                                      • G
                                        gniting @Marv21
                                        last edited by Jun 22, 2020, 10:13 PM

                                        @Marv21 said in Transparently Intercept and Redirect DNS Traffic to an Internal DNS:

                                        @ibbetsion
                                        Hmm.
                                        What you could try (if you have not done any own modifications in the filesystem) - Backup everything, reinstall Pfsense und roll back the Backup.
                                        I had it once a while (4years or greater) that i had done this and suddenly everything was ok.

                                        Is this a Virtualized Maschine or something?

                                        Could you post all NAT Rules, Outbond Page, Lan Rules and DNSNet rules here as Screenshots?

                                        Do you have any Floating Rules?

                                        No floating rules and machine is not virtualized. I will try the reinstall recommendation.

                                        1 Reply Last reply Reply Quote 0
                                        • G
                                          gniting @johnpoz
                                          last edited by Jun 22, 2020, 10:30 PM

                                          @johnpoz will attempt to diagnose using packet capture.

                                          M 1 Reply Last reply Jun 24, 2020, 9:54 PM Reply Quote 0
                                          40 out of 54
                                          • First post
                                            40/54
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.