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

Logging my daily changing WAN-address

Scheduled Pinned Locked Moved General pfSense Questions
41 Posts 7 Posters 4.6k Views 4 Watching
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.
  • G Offline
    Gertjan @Bob.Dig
    last edited by Gertjan Mar 24, 2025, 10:20 AM Mar 24, 2025, 10:19 AM

    @Bob-Dig said in Easy solution for logging my daily changing WAN-address:

    and I do delete it all the time

    What ?
    You want your WAN IP being logged .... and it is in the system.log (or ppp log ? Not sure, it's years I haven't use pppoe).
    And you delete the file where it is logged.

    @elvisimprsntr said in Easy solution for logging my daily changing WAN-address:

    Use DyDNS.

    That's what I would propose also. Gives you a permanent trace of the WAN IP. It changes , => you get a mail. Stop deleting the mails and you have a permanent trace of your WAN IP.
    Normally, I use a host name to access my WAN IPv4 @home as it changes ones a week. If needed, I have the mails, and the one will tell me when it changed, and what it is.

    When you use DynDNS, you could add a line here where you 'append' the $this->_dnsIP variable (contains the updated WAN IP) and a time stamp to a file, for example here /root/.
    From then on, you'll have a constantly growing (30 bytes a day ?) file that contains the current WAN IP on the last line.

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

    B 1 Reply Last reply Mar 24, 2025, 10:28 AM Reply Quote 0
    • B Offline
      Bob.Dig LAYER 8 @Gertjan
      last edited by Mar 24, 2025, 10:28 AM

      @Gertjan said in Easy solution for logging my daily changing WAN-address:

      It changes , => you get a mail.

      Interesting. The problem with that, having many VPN-clients as gateways makes a lot of gateway-alerts and with that emails. So I would need to fight that first. And I recently changed my email server and now it is more cumbersome creating this types of rules. Maybe I should look into that anyways.

      G F 2 Replies Last reply Mar 24, 2025, 10:40 AM Reply Quote 0
      • G Offline
        Gertjan @Bob.Dig
        last edited by Mar 24, 2025, 10:40 AM

        @Bob-Dig

        Keep in mind that Dyndns, triggered when a WAN type interface event happens, will only update the IP, and send a mail if the previous WAN IP was different as the current, new one.
        So, you'll get a mail and if you do not want a mail, you know now how to disable the mail notif] ( see here - and 7 lines lower for the IPv6 equivalent).

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

        1 Reply Last reply Reply Quote 0
        • F Offline
          fireodo @Bob.Dig
          last edited by fireodo Mar 24, 2025, 10:52 AM Mar 24, 2025, 10:51 AM

          @Bob-Dig said in Easy solution for logging my daily changing WAN-address:

          Maybe I should look into that anyways.

          Hi, I propose you another solution (if you like and you are not to shy to edit a system file) ๐Ÿ˜‰

          Edit this file:

          /usr/local/sbin/ppp-linkup
          

          (this file gets executed each time the pppoe triggers a new connection (implicit a new IP))

          attach at the end of the file (before the "exit 0")

          # IP-Logging
          cat /tmp/pppoe0_ip >> /root/iplog/iplog.log
          date >> /root/iplog/iplog.log
          

          In this example the destination is a file in the root directory: /root/iplog/iplog.log (you can choose another destination as you wish)

          Regards,
          fireodo

          Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
          SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
          pfsense 2.8.0 CE
          Packages: Apcupsd, Cron, Iftop, Iperf, LCDproc, Nmap, pfBlockerNG, RRD_Summary, Shellcmd, Snort, Speedtest, System_Patches.

          G 1 Reply Last reply Mar 24, 2025, 11:02 AM Reply Quote 3
          • G Offline
            Gertjan @fireodo
            last edited by Gertjan Mar 24, 2025, 11:02 AM Mar 24, 2025, 11:02 AM

            @fireodo

            mkdir -p /root/iplog
            touch /root/iplog/iplog.log

            If for some reason, the sub folder didn't exit (because pfSense was re installed, or some &@$!!ยค deleted the "iplog" folder in /root/), its created.
            Same thing for the file "iplog.log" : if it didn't exist, a zero byte "iplog.log" will be created.

            and from now on its happy appending :

            cat /tmp/pppoe0_ip >> /root/iplog/iplog.log
            date >> /root/iplog/iplog.log

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

            F 1 Reply Last reply Mar 24, 2025, 11:06 AM Reply Quote 1
            • F Offline
              fireodo @Gertjan
              last edited by fireodo Mar 24, 2025, 11:08 AM Mar 24, 2025, 11:06 AM

              @Gertjan

              Thanks for the completion! Also after a pfsense-update the "ppp-linkup" file has to be edited again.

              Regards

              Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
              SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
              pfsense 2.8.0 CE
              Packages: Apcupsd, Cron, Iftop, Iperf, LCDproc, Nmap, pfBlockerNG, RRD_Summary, Shellcmd, Snort, Speedtest, System_Patches.

              G 1 Reply Last reply Mar 24, 2025, 11:08 AM Reply Quote 1
              • G Offline
                Gertjan @fireodo
                last edited by Mar 24, 2025, 11:08 AM

                @fireodo said in Easy solution for logging my daily changing WAN-address:

                Also after a update the "ppp-linkup" file has to be edited again.

                I'm pretty sure bob.dig can make a patch out of it, so it can be re installed with a click ^^

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

                F B 3 Replies Last reply Mar 24, 2025, 11:12 AM Reply Quote 1
                • F Offline
                  fireodo @Gertjan
                  last edited by Mar 24, 2025, 11:12 AM

                  @Gertjan said in Easy solution for logging my daily changing WAN-address:

                  I'm pretty sure bob.dig can make a patch out of it, so it can be re installed with a click ^^

                  Of course, but maybe someone else read and want that too ... ๐Ÿค“

                  Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
                  SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
                  pfsense 2.8.0 CE
                  Packages: Apcupsd, Cron, Iftop, Iperf, LCDproc, Nmap, pfBlockerNG, RRD_Summary, Shellcmd, Snort, Speedtest, System_Patches.

                  1 Reply Last reply Reply Quote 1
                  • S Offline
                    stephenw10 Netgate Administrator
                    last edited by Mar 24, 2025, 12:40 PM

                    If you have a dyndns client running on the WAN it should only notify you when the WAN address changes.

                    F 1 Reply Last reply Jun 1, 2025, 1:20 PM Reply Quote 1
                    • B Offline
                      Bob.Dig LAYER 8 @Gertjan
                      last edited by Bob.Dig Mar 24, 2025, 2:19 PM Mar 24, 2025, 1:47 PM

                      @Gertjan said in Easy solution for logging my daily changing WAN-address:

                      I'm pretty sure bob.dig can make a patch out of it, so it can be re installed with a click ^^

                      Actually no, you must mistake me for someone else. But thank you and @fireodo for that solution. I think, I like it the most so far.

                      @stephenw10 said in Easy solution for logging my daily changing WAN-address:

                      If you have a dyndns client running on the WAN it should only notify you when the WAN address changes.

                      True, but any gateway event will also trigger emails, as far as I remember, and with 10+ flaky privacy-VPN-clients, that are WAN-type interfaces, this becomes very annoying, I can tell you. ๐Ÿ˜‰

                      G 1 Reply Last reply Mar 24, 2025, 2:08 PM Reply Quote 0
                      • G Offline
                        Gertjan @Bob.Dig
                        last edited by Mar 24, 2025, 2:08 PM

                        @Bob-Dig said in Easy solution for logging my daily changing WAN-address:

                        True, but any gateway event will also trigger emails, as far as I remember and with 10 VPN clients this becomes very annoying, I can tell you.

                        I get it.
                        Still, the Dyndns setp will only send a mail IF the WAN IP actually did change.
                        If the "do something with the WAN interface" is called many time, it doesn't matter : only if the IP changed, you get a mail.
                        If it changes x times a day, you will get x mails a day, true.

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

                        1 Reply Last reply Reply Quote 0
                        • B Offline
                          Bob.Dig LAYER 8 @Gertjan
                          last edited by Bob.Dig Mar 25, 2025, 8:26 AM Mar 25, 2025, 8:24 AM

                          Marked solved, thanks guys.

                          @Gertjan said in Easy solution for logging my daily changing WAN-address:

                          can make a patch out of it, so it can be re installed with a click

                          If someone reputable wants to make a site "pfSense Helper Scripts", I wouldn't mind. ๐Ÿ˜‰

                          1 Reply Last reply Reply Quote 0
                          • F Offline
                            fireodo @stephenw10
                            last edited by Jun 1, 2025, 1:20 PM

                            @stephenw10

                            Hi,

                            in case of using if_pppoe (in pfsense 2.8.0) what file would have to be edited and attach these lines

                            cat /tmp/pppoe0_ip >> /root/iplog/iplog.log
                            date >> /root/iplog/iplog.log
                            

                            for having the WAN-IP get logged? (the /usr/local/sbin/ppp-linkup is not used anymore)

                            Thanks and nice sunday,
                            fireodo

                            Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
                            SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
                            pfsense 2.8.0 CE
                            Packages: Apcupsd, Cron, Iftop, Iperf, LCDproc, Nmap, pfBlockerNG, RRD_Summary, Shellcmd, Snort, Speedtest, System_Patches.

                            G 1 Reply Last reply Jun 2, 2025, 8:40 AM Reply Quote 1
                            • S Offline
                              stephenw10 Netgate Administrator
                              last edited by Jun 1, 2025, 4:50 PM

                              You could probably add something to pppoe-handler. But that's PHP not a shell script.

                              F 1 Reply Last reply Jun 1, 2025, 4:58 PM Reply Quote 0
                              • F Offline
                                fireodo @stephenw10
                                last edited by fireodo Jun 1, 2025, 4:58 PM Jun 1, 2025, 4:58 PM

                                @stephenw10 said in [solved] Easy solution for logging my daily changing WAN-address:

                                You could probably add something to pppoe-handler. But that's PHP not a shell script.

                                Thanks - I'm not a PHP guru - do you have a "code" example? ๐Ÿค“

                                Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
                                SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
                                pfsense 2.8.0 CE
                                Packages: Apcupsd, Cron, Iftop, Iperf, LCDproc, Nmap, pfBlockerNG, RRD_Summary, Shellcmd, Snort, Speedtest, System_Patches.

                                1 Reply Last reply Reply Quote 0
                                • S Offline
                                  stephenw10 Netgate Administrator
                                  last edited by Jun 1, 2025, 11:54 PM

                                  Ha, I thought you might ask that and...nope not off hand. I'm no php guru either!

                                  But if you're just logging the IP it's probably a one liner....

                                  F 1 Reply Last reply Jun 2, 2025, 8:56 AM Reply Quote 2
                                  • B Offline
                                    Bob.Dig LAYER 8
                                    last edited by Bob.Dig Jun 2, 2025, 7:23 AM Jun 2, 2025, 7:22 AM

                                    Maybe @Gertjan knows how to do it and can give detailed instructions how to do it for a noob like me.

                                    1 Reply Last reply Reply Quote 0
                                    • G Offline
                                      Gertjan @fireodo
                                      last edited by Jun 2, 2025, 8:40 AM

                                      @fireodo said in [solved] Easy solution for logging my daily changing WAN-address:

                                      cat /tmp/pppoe0_ip >> /root/iplog/iplog.log

                                      Doesn't exist anymore ?
                                      I'm not using 2.7.2 or 2.8.0, - not using the pppoe or the new pppoe.

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

                                      F B 2 Replies Last reply Jun 2, 2025, 8:51 AM Reply Quote 0
                                      • F Offline
                                        fireodo @Gertjan
                                        last edited by Jun 2, 2025, 8:51 AM

                                        @Gertjan said in [solved] Easy solution for logging my daily changing WAN-address:

                                        Doesn't exist anymore ?

                                        This (you mentioned) still exist but the executable /usr/local/sbin/ppp-linkup, is not used with the if_pppoe, so the lines that where attached at this file:

                                        cat /tmp/pppoe0_ip >> /root/iplog/iplog.log
                                        date >> /root/iplog/iplog.log
                                        

                                        doesn't function anymore. stephenw10 suggest to modify the /usr/local/sbin/pppoe-handler file but I'm not familiar with PHP ;-)

                                        Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
                                        SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
                                        pfsense 2.8.0 CE
                                        Packages: Apcupsd, Cron, Iftop, Iperf, LCDproc, Nmap, pfBlockerNG, RRD_Summary, Shellcmd, Snort, Speedtest, System_Patches.

                                        1 Reply Last reply Reply Quote 0
                                        • B Offline
                                          Bob.Dig LAYER 8 @Gertjan
                                          last edited by Jun 2, 2025, 8:52 AM

                                          @Gertjan said in [solved] Easy solution for logging my daily changing WAN-address:

                                          Doesn't exist anymore

                                          Or how to do it with the DDNS-thingy.

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                                            This community forum collects and processes your personal information.
                                            consent.not_received