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

ARP Tables...Most Static Addresses are No Longer Permanent

General pfSense Questions
5
26
2.8k
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.
  • Z
    zkhcohen
    last edited by Jul 6, 2023, 6:18 AM

    I can also validate that Regression #14374 is present on my 3.7.0 installation.

    I noticed that simply opening and saving each DHCP entry with static ARP assigned (without making any changes) will resolve the issue for that specific entry. Rebooting the DHCP service has no impact.

    Another interesting note - when I create an XML backup of my pfSense config and inspect it, all the proper static ARP entries are present. In other words, the configuration is present, it's just not being initialized properly on reboot. Note that I haven't had a chance to test the secondary symptom -- the eventual erasure of static ARP entries for inactive devices.

    Setting up an hourly cron job / shellcmd which sets "arp -s <ip> <mac>" for each entry is the best solution until a patch has been issued.

    Z 1 Reply Last reply Jul 6, 2023, 4:01 PM Reply Quote 0
    • Z
      zkhcohen @zkhcohen
      last edited by Jul 6, 2023, 4:01 PM

      Here's a script which leverages python3.11 to search for and set static arp entries:

      Step 1. Create a shell script called "arp.sh" in the /usr/local/etc/rc.d/ directory:

      #!/bin/sh
      
      python3.11 - <<EOF
      import xml.etree.ElementTree as ET
      import subprocess
      
      # Load the XML file
      tree = ET.parse("/conf/config.xml")
      root = tree.getroot()
      
      # Extract the IP and MAC addresses using list comprehension
      results = [{'mac': staticmap.find("mac").text, 'ip': staticmap.find("ipaddr").text}
                 for staticmap in root.iter("staticmap")
                 if staticmap.find("arp_table_static_entry") is not None]
      
      # Execute the arp commands
      for result in results:
          command = f"arp -s \"{result['ip']}\" \"{result['mac']}\""
      
          print("Command:", command)
      
          completed_process = subprocess.run(command, shell=True, executable="/bin/sh", capture_output=True, text=True)
      
          if completed_process.returncode == 0:
              print("Command executed successfully.")
              print("Output:", completed_process.stdout)
          else:
              print("Command execution failed.")
              print("Error:", completed_process.stderr)
      EOF
      

      Step 2. Run: chmod +x /usr/local/etc/rc.d/arp.sh
      Step 3. In the pfSense UI, navigate to Services > Cron and create the following job:

      0 	* 	* 	* 	* 	root 	/bin/sh /usr/local/etc/rc.d/arp.sh
      

      Step 4. To execute the command manually, run /bin/sh /usr/local/etc/rc.d/arp.sh. Upon checking the pfSense UI Diagnostics > ARP Table, you should see that all of the entries are now "Permanent".

      J 1 Reply Last reply Jul 6, 2023, 5:20 PM Reply Quote 0
      • J
        johnpoz LAYER 8 Global Moderator @zkhcohen
        last edited by Jul 6, 2023, 5:20 PM

        @zkhcohen so your script looks to what is in the arp table and makes them all static - ie perm? That would be a horrible idea

        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

        Z 2 Replies Last reply Jul 6, 2023, 5:27 PM Reply Quote 0
        • Z
          zkhcohen @johnpoz
          last edited by Jul 6, 2023, 5:27 PM

          @johnpoz No. It looks for a pre-existing permanent static arp mapping in the DHCP config and then reapplies it via the CLI.

          1 Reply Last reply Reply Quote 0
          • Z
            zkhcohen @johnpoz
            last edited by Jul 6, 2023, 6:07 PM

            @johnpoz

            A patch was just issued (extremely quickly, I might add), and I can confirm that it fixes the issue in my environment:

            https://redmine.pfsense.org/projects/pfsense/repository/2/revisions/5082edf92795fe8266be49905fe4f07eb682449d

            1 Reply Last reply Reply Quote 1
            • A
              ARAMP1
              last edited by Jul 10, 2023, 1:48 PM

              The patch does not appear to work on 2.7.0.

              J 1 Reply Last reply Jul 10, 2023, 2:23 PM Reply Quote 0
              • J
                johnpoz LAYER 8 Global Moderator @ARAMP1
                last edited by Jul 10, 2023, 2:23 PM

                @ARAMP1 I just tested this on my 2.7 vm and seems to be working..

                So I created a static arp and it was there.

                đź”’ Log in to view

                I then rebooted and it was gone.

                đź”’ Log in to view

                I then applied the patch, and rebooted again and now its there.

                đź”’ Log in to view

                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

                1 Reply Last reply Reply Quote 0
                • A
                  ARAMP1
                  last edited by Jul 10, 2023, 6:33 PM

                  Must have been user error....I got it working. After a couple restarts and wondering what I did wrong, I reinstalled the patch and everything is working.

                  Appreciate the help, gents.

                  3 1 Reply Last reply Nov 22, 2023, 5:26 AM Reply Quote 1
                  • 3
                    32G3LiQxu8 @ARAMP1
                    last edited by Nov 22, 2023, 5:26 AM

                    I’m seeing this behavior in 23.09. ARP table shows dynamic (expires in <time>) ARP entry instead of static (permanent).

                    If I uncheck, “Create an ARP Table Static Entry for this MAC & IP Address pair” and then save.

                    Then recheck “Create an ARP Table Static Entry for this MAC & IP Address pair” and then save.

                    Then go back to ARP table, almost all the dynamic entries are flipped to static (permanent)

                    Anyone else seeing this?

                    J 1 Reply Last reply Nov 22, 2023, 5:29 AM Reply Quote 0
                    • J
                      johnpoz LAYER 8 Global Moderator @32G3LiQxu8
                      last edited by johnpoz Nov 22, 2023, 5:34 AM Nov 22, 2023, 5:29 AM

                      @32G3LiQxu8 there seems to be an issue with when clients update their lease - there is this thread.

                      https://forum.netgate.com/topic/184155/static-arp-in-dhcp-overwritten

                      And this redmine

                      https://redmine.pfsense.org/issues/14970

                      So yeah if it has flipped to dynamic, a resave of the dhcp page where you set it as static will turn it back to perm, but it seems when client updates its lease again it will go back to dynamic.. See the thread linked to above, where you can duplicate it doing it by just having your client release and renew its lease.

                      From the redmine it seems to be correct in the upcoming 24.03 and 2.8 CE releases

                      "This is not reproducible on the latest builds of 2.8.0 and 24.03"

                      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

                      3 1 Reply Last reply Nov 22, 2023, 12:05 PM Reply Quote 0
                      • 3
                        32G3LiQxu8 @johnpoz
                        last edited by Nov 22, 2023, 12:05 PM

                        @johnpoz Thank you for the information. I will wait for a fix.

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