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

    NAT Logs

    Scheduled Pinned Locked Moved General pfSense Questions
    50 Posts 4 Posters 1.8k 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

      For background, I have an Juniper SRX cluster. Troubleshooting an inbound IPsec connection, i was asked to verify if our extranet partner made a telnet attempt to our production IP/Port. Fair enough.

      ny4vpn> show security nat source pool client-1
      

      Running the above command will give me output but what i cared about are Translation hits. This lets me know that the NAT rule is being hit (yes we NAT inbound flows).

      That got me thinking....Is there any logging or is there any way to tell if in pfsense a NAT rule is being hit?
      When i played with OPNsense in the past, that system does log/display if a NAT rule is being hit so curious if theres a way to check in pfsense. I wouldnt be surprised if i overlooked it but curious if theres a way to tell.

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

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

        Confused by the redmine i found

        https://redmine.pfsense.org/issues/11975
        This states its a duplicate of 7800
        Remine 7800 says its part of "3.0"...

        So is this possible?

        edit: If NAT logging isn't supported, then what is the workaround ?

        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

          On an inbound NAT rule an associated firewall rule will only be hit if NAT is happening so you can just enable logging there.

          Otherwise you can use pflow data to log all connections through the firewall.
          https://docs.netgate.com/pfsense/en/latest/firewall/pflow.html

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

            @stephenw10 I have pflow working but it doesn't have data about Source or Destination NAT at least within the Netflow v5 records. So not sure how pflow helps in this.

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

            K 1 Reply Last reply Reply Quote 0
            • K
              kprovost @michmoor
              last edited by

              @michmoor That's expected. Netflow v5 does not support NAT44 (or IPv6 for that matter) information. Only IPFix does.

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

                @kprovost Copy that. Ok i'll make adjustments to the collector.

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

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

                  @kprovost @stephenw10

                  Can confirm i am seeing the additional fields using IPFix.

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

                  M 1 Reply Last reply Reply Quote 1
                  • M
                    mcury @michmoor
                    last edited by

                    @michmoor said in NAT Logs:

                    @kprovost @stephenw10

                    Can confirm i am seeing the additional fields using IPFix.

                    According to RFC 8158, the fields you need are:

                    postNATSourceIPv4Address
                    postNAPTSourceTransportPort
                    postNATDestinationIPv4Address
                    postNAPTDestinationTransportPort

                    I'm also playing with it right now

                    dead on arrival, nowhere to be found.

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

                      @mcury Let me know what you come up with in Graylog.

                      Its parsed automatically which is great but not sure how to utilize this data. Reporting?

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

                      M 1 Reply Last reply Reply Quote 0
                      • M
                        mcury @michmoor
                        last edited by

                        @michmoor said in NAT Logs:

                        @mcury Let me know what you come up with in Graylog.

                        Its parsed automatically which is great but not sure how to utilize this data. Reporting?

                        pfSense is sending the data correctly, I'll try to create an extractor for those fields..

                        6ee610ec-fc25-4072-b97b-dba5371681ff-image.png

                        dead on arrival, nowhere to be found.

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

                          @mcury

                          Its already parsed for me

                          9dfba30c-3c31-4e66-85f1-ad1ebe8277f8-image.png

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

                          M 1 Reply Last reply Reply Quote 0
                          • M
                            mcury @michmoor
                            last edited by

                            @michmoor
                            67b0bb1a-8be3-4ded-807c-7449b7104a76-image.png

                            So you got it. 👍
                            Weird, I don't have those here.. Any tip of what I should do ?

                            dead on arrival, nowhere to be found.

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

                              @mcury Graylog did it for me. For the input i selected IPFIX UDP

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

                              M 1 Reply Last reply Reply Quote 1
                              • M
                                mcury @michmoor
                                last edited by mcury

                                @michmoor said in NAT Logs:

                                @mcury Graylog did it for me. For the input i selected IPFIX UDP

                                Also using that input.

                                Did you enable tracking on the firewall rule that is associated with the NAT rule ?

                                Ohh, disregard that.
                                It is working here..

                                680cd08a-95ed-41f0-b089-38f496296911-image.png

                                dead on arrival, nowhere to be found.

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

                                  @mcury The only piece i dont know how to do is actually display data to show top talkers.
                                  each IPfix record shows bytes which is great but i would like a table that shows all the fields plus the amount of data seen cumulative.

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

                                  M 1 Reply Last reply Reply Quote 0
                                  • M
                                    mcury @michmoor
                                    last edited by mcury

                                    @michmoor said in NAT Logs:

                                    The only piece i dont know how to do is actually display data to show top talkers.
                                    each IPfix record shows bytes which is great but i would like a table that shows all the fields plus the amount of data seen cumulative.

                                    hmm, as I see it, you would nee to create a widget with the search field:

                                    Example if the destination host is in the 192.168.255.0/24 subnet.
                                    postNATSourceIPv4Address:192.168.255.* OR postNATDestinationIPv4Address:192.168.255.*

                                    c41e8893-3c35-415f-87a6-66fe650e1f35-image.png

                                    Then, as per picture above, filter by destination or source (this will give you the external users data), use SUM and Data Table.

                                    dead on arrival, nowhere to be found.

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

                                      @mcury Ok yeah thats the way to go BUT....i have to use NetFlow as netflow already has bytes parsed in the output while IPFix does not.

                                      Still figuring out how to normalize the nf_bytes column to megabytes

                                      11f6a491-d963-4b79-8703-e71335fc279a-image.png

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

                                      M 1 Reply Last reply Reply Quote 0
                                      • M
                                        mcury @michmoor
                                        last edited by mcury

                                        @michmoor said in NAT Logs:

                                        Still figuring out how to normalize the nf_bytes column to megabytes

                                        Try this pipeline rule:

                                        rule "arithmetic"
                                        when
                                        has_field("octetDeltaCount")
                                        then
                                        let size_kb = to_double($message.octetDeltaCount);
                                        set_field("size_bytes", size_kb / to_double(value:"1048576"));
                                        end
                                        

                                        This will give you something like this:

                                        082e7253-69fb-4bbe-ba97-72d657b34e48-image.png

                                        dead on arrival, nowhere to be found.

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

                                          @mcury Not sure if its working to be honest.
                                          There are no errors showing up in the pipeline so messages are being processed.

                                          07813656-4d88-46af-94bd-a1028a62a697-image.png

                                          Message:
                                          ad77d9f7-ce71-4267-bc0a-c27bd6fccf05-image.png

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

                                          M 1 Reply Last reply Reply Quote 0
                                          • M
                                            mcury @michmoor
                                            last edited by mcury

                                            @michmoor said in NAT Logs:

                                            @mcury Not sure if its working to be honest.
                                            There are no errors showing up in the pipeline so messages are being processed.

                                            Did you edit the pipeline connections and assigned to the ipfix stream ?

                                            f81dbcce-4c66-444a-b83c-f513042f1217-image.png

                                            dead on arrival, nowhere to be found.

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